Page 1 of 1

Nagios plugin with argument doesn't work

Posted: Mon Jul 27, 2020 8:45 am
by Imagin0s
Hello,

I have created a plugin developped in bash which check content of TSM log.
The plugin can be launched without any argument like that : /usr/lib64/nagios/plugins/check_backup_tsm
Or it can be launched with an argument like that : /usr/lib64/nagios/plugins/check_backup_tsm no_check_sunday

When I use the plugin without the argument, it works just fine but as soon as I use it with the argument it doesn't work correctly. It's launched as it doesn't have argument :?:

Here are my conf :

Content of /etc/nagios/nrpe.cfg :
command[check_backup_tsm]=/usr/lib64/nagios/plugins/check_backup_tsm $ARG1$

Content of /etc/nagios/objects/commands.cfg :
define command{
command_name NRPE_check_backup_tsm
command_line $USER1$/check_nrpe -t 60 -H $HOSTADDRESS$ -c check_backup_tsm -a $ARG1$
}

Content of /etc/nagios/objects/services.cfg :
define service{
use generic-service ; Name of service template to use
host_name GITLAB APP S01VL9907789, GITLAB APP S01VL9907788, GITLAB DATA S01VL9907787, GITLAB DATA S01VL9907786, GITLAB REDIS S01VL9907785, GITLAB REDIS S01VL9907784
service_description Last BackupUp
check_command NRPE_check_backup_tsm!no_check_sunday
#check_period early
servicegroups Gitlab
notifications_enabled 1
contacts nagiosadmin

I have reloaded/restarted my nagios service on server side.

Would you please advise ?

Thanks,
Regards.

Re: Nagios plugin with argument doesn't work

Posted: Tue Aug 04, 2020 3:29 am
by Imagin0s
Hello
Up

Re: Nagios plugin with argument doesn't work

Posted: Wed Aug 05, 2020 4:23 pm
by gormank
Have you tried running the following from the nagios host after after swapping the macros for valid path, address and argument? Run as the nagios user...
$USER1$/check_nrpe -t 60 -H $HOSTADDRESS$ -c check_backup_tsm -a $ARG1$

Re: Nagios plugin with argument doesn't work

Posted: Mon Aug 10, 2020 3:09 am
by Imagin0s
Hello,
Sorry for the late reply.
Yes I have just tried it :

Command :
/usr/lib64/nagios/plugins/check_nrpe -t 60 -H S01VL9907788 -c check_backup_tsm -a no_check_sunday

Output :
Curious behavior. No logs are availables for at least one of them : /apps/backup_restore/logs/s01vl9907788*.crs.200809.csv or /apps/backup_restore/logs/s01vl9907788*.crs.200808.csv, please check the dsmc logs on the server

The above output is expected if you launch locally the command :
/usr/lib64/nagios/plugins/check_backup_tsm

But I am expecting that the command is launched as :
/usr/lib64/nagios/plugins/check_backup_tsm no_check_sunday

Thanks.
Regards.

Re: Nagios plugin with argument doesn't work

Posted: Mon Aug 10, 2020 3:56 pm
by gormank
What's the output on the host where it runs (not the nagios host) with and without the argument?

See if a parameter like dont_blame_nrpe is defined in nrpe.cfg. Just grep blam from the file since I probably have the dont part wrong. I think if it's 0 nrpe doesn't pass arguments.

Re: Nagios plugin with argument doesn't work

Posted: Mon Aug 10, 2020 3:57 pm
by gormank
# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed. This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments

dont_blame_nrpe=1

Re: Nagios plugin with argument doesn't work

Posted: Wed Aug 12, 2020 2:11 am
by Imagin0s
I have already tried to run the plugin with arguments on the nagios client and it works fine :

root@s01vl9907788:/usr/lib64/nagios/plugins$ ./check_backup_tsm no_check_sunday
Everything seems OK this saturday

Re: Nagios plugin with argument doesn't work

Posted: Wed Aug 12, 2020 2:16 am
by Imagin0s
The directive dont_blame_nrpe is well configured :

root@xxxxxxxxxxxxx:/etc/nagios$ cat nrpe.cfg|grep blame
dont_blame_nrpe=1
# command arguments *AND* the dont_blame_nrpe directive in this

By the way, the plugin check_http also uses arguments and it works fine.

Re: Nagios plugin with argument doesn't work

Posted: Mon Aug 24, 2020 2:37 am
by Imagin0s
Hello
Up