Add monit monitoring
This commit is contained in:
parent
c76e081dc3
commit
6ff025d4b7
4 changed files with 25 additions and 1 deletions
|
@ -1,2 +1,3 @@
|
||||||
---
|
---
|
||||||
|
apache_check_memory_limit: 500.0 MB
|
||||||
dhparams_path: /etc/ssl/dhparams.pem
|
dhparams_path: /etc/ssl/dhparams.pem
|
||||||
|
|
|
@ -13,3 +13,8 @@
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: munin-node
|
name: munin-node
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
- name: reload monit
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: monit
|
||||||
|
state: reloaded
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart munin-node
|
notify: restart munin-node
|
||||||
|
|
||||||
- name: "Mpnitoring | Enable Munin plugins"
|
- name: "Monitoring | Enable Munin plugins"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: "/usr/share/munin/plugins/{{ item }}"
|
src: "/usr/share/munin/plugins/{{ item }}"
|
||||||
dest: "/etc/munin/plugins/{{ item }}"
|
dest: "/etc/munin/plugins/{{ item }}"
|
||||||
|
@ -34,3 +34,10 @@
|
||||||
- apache_processes
|
- apache_processes
|
||||||
- apache_volume
|
- apache_volume
|
||||||
notify: restart munin-node
|
notify: restart munin-node
|
||||||
|
|
||||||
|
- name: "Monitoring | Enable Monit configuration"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: monit.conf
|
||||||
|
dest: /etc/monit/conf-enabled/apache2
|
||||||
|
mode: 0644
|
||||||
|
notify: reload monit
|
||||||
|
|
11
templates/monit.conf
Normal file
11
templates/monit.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Ansible managed
|
||||||
|
|
||||||
|
check process apache with pidfile /run/apache2/apache2.pid
|
||||||
|
group webserver
|
||||||
|
start program = "/usr/sbin/service apache2 start" with timeout 60 seconds
|
||||||
|
stop program = "/usr/sbin/service apache2 stop"
|
||||||
|
if cpu > 60% for 2 cycles then alert
|
||||||
|
if cpu > 80% for 5 cycles then restart
|
||||||
|
if totalmem > {{ apache_check_overrides.memory_limit | default(apache_check_memory_limit) }} for 3 cycles then restart
|
||||||
|
if children > 250 then restart
|
||||||
|
if 3 restarts within 5 cycles then timeout
|
Loading…
Reference in a new issue