User Tools

Site Tools


monitoring:nagios_tips

Check_nrpe with SSL or not

Check if commands can run with SSL

[root@nagios linux]# /usr/lib64/nagios/plugins/check_nrpe -H lnx081  -c check_fs
OK

Which on lnxb080 looks like this in config

check_lnx_nrpe!check_fs 

Because this is a command shortcut for the command above see command.cfg

Or without:

[root@nagios linux]# /usr/lib64/nagios/plugins/check_nrpe -H lnx081 -n -c check_fs
CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).

Which on nagios looks like this in config

check_lnx_param_nossl_nrpe!check_fs 

Because this is a command shortcut for the command above see command.cfg

The same command exists for commands with parameters e.g. check-disk

VI commands to remove all _nossl_nrpe checks:

[ESC]+:s/check_lnx_nossl_nrpe/check_lnx_nrpe/g

[ESC]+:s/check_lnx_param_nossl_nrpe/check_lnx_param_nrpe/g

nossl :

command_name    check_lnx_param_nossl_nrpe
check_nrpe -H $HOSTADDRESS$ -n -c $ARG1$ -a $ARG2$
[root@nagios linux]# /usr/lib64/nagios/plugins/check_nrpe -H nagios -n -c check_disk -a 20% 35% /

ssl:

command_name    check_lnx_param_nrpe
check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$

Other example

[root@nagios linux]# /usr/lib64/nagios/plugins/check_nrpe -H lnx033   -c check_procs -a '-w 500 -c 700 -s RSZDT'
PROCS CRITICAL: 126 processes with STATE = RSZDT | procs=126;-w;-s;0;
[root@nagios linux]# /usr/lib64/nagios/plugins/check_nrpe -H lnx033  -n -c check_procs -a '-w 500 -c 700 -s RSZDT'
CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).

When playing with these configurations on the nagios server don't forget to reload nagios: But before reloading check if the configurations are ok by launching:

nagios -v /etc/nagios/nagios.cfg

Then:

systemctl reload nagios.service

Check_nrpe with parameter

Server:

Change check_nrpe!check_users!15!20 to check_nrpe!check_users!"15 20"

Multiple performance values

When you develop a custom check, it is possible to send more than one variable in a check. Simply seperated your variable definitions by a pipe symbol (do not use spaces). Here is an example output of a check sending three performance values:

0 Nagios_Status ok=33012|crit=17|warn=120|unkw=16 Services ok/cr/wa/un: 33012/17/120/16

Pour générer des graphs dans nagios à partir d'un script NRPE, il suffit de structurer l'output comme suit :

echo "OK: Memory 75% | memory=75%"

Cela affichera : “OK : Memory 75%” et ca passera la variable “memory” avec sa valeur dans nagios“

Syntaxe avec plusieurs valeurs :

echo “OK - memory = $memory%, paging = $paging%|memory=$memory,paging=$paging”

monitoring/nagios_tips.txt · Last modified: 2023/01/18 13:03 by manu