nagios-nrpe: add a wraper to check_dhcpd to define the number of dhcpd processes that must be running depending on the CARP state

This commit is contained in:
Jérémy Dubois 2022-04-13 15:41:47 +02:00
parent bbe56e3422
commit bd1d29b1bd
4 changed files with 17 additions and 1 deletions

View File

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- base: zzz_evobackup upstream release 22.03
- etc-git: manage commits with an optimized shell script instead of many slow Ansible tasks
- etc-git: add versioning for /usr/share/scripts
- nagios-nrpe: add a wraper to check_dhcpd to define the number of dhcpd processes that must be running depending on the CARP state
### Fixed

View File

@ -0,0 +1,14 @@
#!/bin/sh
# Simple wraper to define the number of dhcpd processes that must be running
# depending on the CARP active or backup state
# Can be customized if dhcpd must be running even in backup state
dhcpd_processes_number=1
CARP_STATUS=$(/sbin/ifconfig carp0 | /usr/bin/grep "status" | /usr/bin/awk '{print $2}')
if [ "$CARP_STATUS" = "backup" ]; then
dhcpd_processes_number=0
fi
/usr/local/libexec/nagios/check_procs -c ${dhcpd_processes_number}:${dhcpd_processes_number} -C dhcpd

View File

@ -60,6 +60,7 @@
- {name: 'check_pf_states', force: false}
- {name: 'check_mailq.pl', force: true}
- {name: 'check_dhcp_pool', force: false}
- {name: 'check_dhcpd.sh', force: false}
notify: restart nrpe
- name: Nagios plugins are installed - template

View File

@ -32,7 +32,6 @@ command[check_unbound]=/usr/local/libexec/nagios/check_dig -l evolix.net -H loca
#command[check_smb]=/usr/local/libexec/nagios/check_tcp -H IPLOCALE -p 445
command[check_mysql]=/usr/local/libexec/nagios/check_mysql -H 127.0.0.1 -f /etc/nrpe.d/.my.cnf
#command[check_vpn]=/usr/local/libexec/nagios/check_ping -H IPDISTANTE -p 1 -w 5000,100% -c 5000,100%
command[check_dhcpd]=/usr/local/libexec/nagios/check_procs -c1:1 -C dhcpd
command[check_bioctl]=/usr/local/libexec/nagios/check_bioctl -d sd2
# Local checks (not packaged)
@ -49,6 +48,7 @@ command[check_ospfd_simple]=doas /usr/local/libexec/nagios/plugins/check_ospfd_s
#command[check_bgpd]=doas /usr/local/libexec/nagios/plugins/check_openbgpd -u
command[check_connections_state]=doas /usr/local/libexec/nagios/plugins/check_connections_state.sh
command[check_packetfilter]=doas /usr/local/libexec/nagios/plugins/check_packetfilter.sh
command[check_dhcpd]=/usr/local/libexec/nagios/plugins/check_dhcpd.sh
command[check_dhcp_pool]=/usr/local/libexec/nagios/plugins/check_dhcp_pool
# This is an Ansible managed file !