En esta oportunidad vamos a mostrar como verificar la memoria de un cliente linux, en nuestro nagios 4 core, usando NRPE, esta opción no la vi por defecto así que vamos a descargar un script y configurarlo para que se pueda ver en la interface web de Nagios.
1- Configuración en el cliente linux
Descargamos el plugin necesario para chequear la memoria ram
En Debain/Ubuntu:
# cd /usr/lib/nagios/plugins/ # wget https://raw.githubusercontent.com/justintime/nagios-plugins/master/check_mem/check_mem.pl # mv check_mem.pl check_mem # chmod +x check_mem
En RHEL/CentOS:
# cd /usr/lib64/nagios/plugins/ (or /usr/lib/nagios/plugins/ for 32-bit) # wget https://raw.githubusercontent.com/justintime/nagios-plugins/master/check_mem/check_mem.pl # mv check_mem.pl check_mem # chmod +x check_mem
# ./check_mem -f -w 20 -c 10
OK - 84.2% (3409072 kB) free.|TOTAL=4050680KB;;;; USED=641608KB;3240544;3645612;; FREE=3409072KB;;;; CACHES=391132KB;;;;
# nano /etc/nagios/nrpe.cfg
Y agregamos lo siguiente, casí al final donde están los otros comandos
Para Debian/Ubuntu: command[check_mem]=/usr/lib/nagios/plugins/check_mem -f -w 20 -c 10 Para RHEL/CentOS 32 bit: command[check_mem]=/usr/lib/nagios/plugins/check_mem -f -w 20 -c 10 Para RHEL/CentOS 64 bit: command[check_mem]=/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10
Importante reiniciamos el servicio
# service nagios-nrpe-server restart
2- Configuración en el server Nagios
El comando ya lo teníamos cargado de la anterior publicación, por lo que vamos directamente al archivo cfg del cliente en cuestión y le agregamos lo siguiente al final
define service{ use generic-service host_name cliente service_description Check RAM check_command check_nrpe!check_mem }
Guardamos y reiniciamos nagios
# service nagios restart
Y verificamos como quedo.