diff --git a/defaults/main.yml b/defaults/main.yml index 6edc3ae..04a7a35 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,6 +4,12 @@ nrpe_allowed_hosts: '127.0.0.1,51.158.69.165' nrpe_load_warning: "{{ ansible_processor_cores|int }}" nrpe_load_critical: "{{ (ansible_processor_cores * 2)|int }}" +nrpe_disk_usage_warning: 80 +nrpe_disk_usage_critical: 90 + +nrpe_disk_inode_warning: 80 +nrpe_disk_inode_critical: 90 + nrpe_memory_warning: 80 nrpe_memory_critical: 90 diff --git a/templates/nrpe.j2 b/templates/nrpe.j2 index 5a55032..bdc8673 100644 --- a/templates/nrpe.j2 +++ b/templates/nrpe.j2 @@ -1,5 +1,5 @@ # Ansible managed - DO NOT EDIT MANUALLY ! -allowed_hosts={{ nrpe_allowed_hosts }} +allowed_hosts={{ nrpe_allowed_hosts }} dont_blame_nrpe=1 # base @@ -18,7 +18,7 @@ command[check_proc_age]=/usr/lib/nagios/plugins/check_proc_age -p -w 400 command[check_systemd_failed]=/usr/lib/nagios/plugins/check_systemd_failed command[check_needrestart]=/usr/lib/nagios/plugins/check_needrestart -# check_disk_usage +# disk # -w <%>: Warning threshold for block usage. # -c <%>: Critical threshold for block usage. # -W <%>: Warning threshold for inode usage. @@ -26,22 +26,13 @@ command[check_needrestart]=/usr/lib/nagios/plugins/check_needrestart # -e : Exclude a mount point by exact match (e.g., -e /tmp). # -E : Exclude mount points matching a regex pattern (e.g., -E '/run/user/.*'). # -x : Exclude a filesystem type (e.g., -x tmpfs). -command[check_disk_usage]=/usr/lib/nagios/plugins/check_disk_usage -w 80 -c 90 -e /run -e /dev -e /dev/shm -e /sys -e /proc -e /sys/kernel/debug/tracing -x tmpfs -x overlay -x fuse -x proc -x devtmpfs - -command[check_disk_root]=/usr/lib/nagios/plugins/check_disk -w 30% -W 30% -c 10% -K 10% -p / +command[check_disk_usage]=/usr/lib/nagios/plugins/check_disk_usage -w {{ nrpe_disk_usage_warning }} -c {{ nrpe_disk_usage_critical }} -W {{ nrpe_disk_inode_warning }} -C {{ nrpe_disk_inode_critical }} -e /run -e /dev -e /dev/shm -e /sys -e /proc -e /sys/kernel/debug/tracing -x tmpfs -x overlay -x fuse -x proc -x devtmpfs command[check_rw_root]=/usr/lib/nagios/plugins/check_rofs / -{% if nrpe_disk is defined %} -{% for target in nrpe_disk %} -command[check_disk_data]=/usr/lib/nagios/plugins/check_disk -w 30% -W 30% -c 10% -K 10% -p /data -command[check_rw_data]=/usr/lib/nagios/plugins/check_rofs /data -{% endfor %} -{% endif %} - {% if nrpe_mysql is defined %} # mysql -command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -u {{ nrpe_mysql_user }} -p{{ nrpe_mysql_password }} -H {{ nrpe_mysql_host }} -d mysql -command[check_mysql_longqueries]=/usr/lib/nagios/plugins/check_mysql_longqueries -u {{ nrpe_mysql_user }} -p{{ nrpe_mysql_password }} -H {{ nrpe_mysql_host }} -w 600 -c 1200 +command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -u {{ nrpe_mysql_user }} -p{{ nrpe_mysql_password }} -H {{ nrpe_mysql_host }} -d mysql +command[check_mysql_longqueries]=/usr/lib/nagios/plugins/check_mysql_longqueries -u {{ nrpe_mysql_user }} -p{{ nrpe_mysql_password }} -H {{ nrpe_mysql_host }} -w 600 -c 1200 {% endif %} {% if nrpe_postgresql is defined %} @@ -58,9 +49,9 @@ command[check_smtp]=/usr/lib/nagios/plugins/check_tcp -p 25 -H {{ nrpe_smtp_host {% endif %} {% if nrpe_mail_service is defined %} {% if nrpe_mail_service == 'postfix' %} -command[check_mailq]=/usr/bin/sudo /usr/lib/nagios/plugins/check_postfix_mailqueue -w {{ nrpe_mailq_warning }} -c {{ nrpe_mailq_critical }} +command[check_mailq]=/usr/bin/sudo /usr/lib/nagios/plugins/check_postfix_mailqueue -w {{ nrpe_mailq_warning }} -c {{ nrpe_mailq_critical }} {% elif nrpe_mail_service == 'exim' %} -command[check_mailq]=/usr/bin/sudo /usr/lib/nagios/plugins/check_exim_mailqueue -w {{ nrpe_mailq_warning }} -c {{ nrpe_mailq_critical }} +command[check_mailq]=/usr/bin/sudo /usr/lib/nagios/plugins/check_exim_mailqueue -w {{ nrpe_mailq_warning }} -c {{ nrpe_mailq_critical }} {% endif %} {% endif %} @@ -76,7 +67,7 @@ command[check_3ware]=/usr/bin/sudo /usr/lib/nagios/plugins/check_raid {% if nrpe_docker_container is defined %} {% for container in nrpe_docker_container %} -command[check_docker_{{ container }}]=/usr/lib/nagios/plugins/check_docker --containers {{ container }}.* --status running --restarts 2:5 --present +command[check_docker_{{ container }}]=/usr/lib/nagios/plugins/check_docker --containers {{ container }}.* --status running --restarts 2:5 --present {% endfor %} {% endif %}