check_portsindex_age - NRPE ports age check
I monitor the age of the file /usr/ports/INDEX-8 (or 7 or whatever the version of FreeBSD is running on the server) and trigger a warning if it is older than 14 days, and go critical if it is older than one month.
command[check_portsindex_age]=/usr/local/libexec/nagios/check_file_age -w 1209600 -c 2592000 -f /usr/ports/INDEX-7
Configuring Nagios
I added the following service to the configuration on the Nagios server:
define service{ use generic-service hostgroup_name freebsd-servers,freebsd-jails service_description nrpe_check_portsindex_age check_command check_nrpe2!check_portsindex_age }
I want all my FreeBSD servers and jails to have their ports age checked, so I added the hostgroup freebsd-servers
and freebsd-jails
to this check.
Configuring NRPE
Add the following line to /usr/local/etc/nrpe.cfg
:
command[check_portsindex_age]=/usr/local/libexec/nagios/check_file_age -w 1209600 -c 2592000 -f /usr/ports/INDEX-7
1209600 seconds is 14 days, 2592000 is 30 days. Remember to use the correct INDEX-x file, in this example I am monitoring a FreeBSD 7 server.
Remember to restart NRPE after changing the config:
sudo /usr/local/etc/rc.d/nrpe2 restart