Add monit monitoring
This commit is contained in:
parent
a8e8382eca
commit
04be772437
4 changed files with 31 additions and 5 deletions
|
@ -1,19 +1,24 @@
|
||||||
---
|
---
|
||||||
- name: reload apache2
|
- name: reload apache2
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: apache2
|
name: apache2
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
||||||
- name: reload php-fpm
|
- name: reload php-fpm
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "php{{ php_version.stdout }}-fpm"
|
name: "php{{ php_version.stdout }}-fpm"
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
||||||
- name: stop php-fpm-socket
|
- name: stop php-fpm-socket
|
||||||
command: systemctl stop php-fpm@*.socket
|
ansible.builtin.command: systemctl stop php-fpm@*.socket
|
||||||
|
|
||||||
- name: stop php-fpm-service
|
- name: stop php-fpm-service
|
||||||
command: systemctl stop php-fpm@*.service
|
ansible.builtin.command: systemctl stop php-fpm@*.service
|
||||||
|
|
||||||
- name: start php-fpm-socket
|
- name: start php-fpm-socket
|
||||||
command: systemctl start php-fpm@*.socket --all
|
ansible.builtin.command: systemctl start php-fpm@*.socket --all
|
||||||
|
|
||||||
|
- name: reload monit
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: monit
|
||||||
|
state: reloaded
|
||||||
|
|
|
@ -18,3 +18,8 @@
|
||||||
- name: User tasks
|
- name: User tasks
|
||||||
ansible.builtin.import_tasks: user.yml
|
ansible.builtin.import_tasks: user.yml
|
||||||
tags: never, user
|
tags: never, user
|
||||||
|
|
||||||
|
- name: Monitoring tasks
|
||||||
|
ansible.builtin.import_tasks: monitoring.yml
|
||||||
|
tags: monitoring
|
||||||
|
|
||||||
|
|
8
tasks/monitoring.yml
Normal file
8
tasks/monitoring.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
- name: "Monitoring | Enable Monit monitoring"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: monit.j2
|
||||||
|
dest: /etc/monit/conf-enabled/phpfpm
|
||||||
|
mode: "0644"
|
||||||
|
when: '"monit" in ansible_facts.packages'
|
||||||
|
notify: reload monit
|
8
templates/monit.j2
Normal file
8
templates/monit.j2
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
check process php-fpm with pidfile /run/php/php{{ php_version.stdout }}.pid
|
||||||
|
group webserver
|
||||||
|
start program = "/usr/sbin/service php{{ php_version.stdout }}-fpm start"
|
||||||
|
stop program = "/usr/sbin/service php{{ php_version.stdout }}-fpm stop"
|
||||||
|
if failed unixsocket /run/php/{{ php_version.stdout }}-fpm.sock for 3 cycles then restart
|
||||||
|
if 3 restarts within 5 cycles then timeout
|
Loading…
Add table
Reference in a new issue