2

I wrote a bash script for a custom nagios plugin that passes two command arguments for the warning and critical thresholds. When I run the bash script locally while passing the two arguments it works correctly (also tested by su to nrpe user and works there as well). However, when I run it remotely on the monitoring server the script does not work correctly, meaning, it doesn't appropriately assign the warning and critical thresholds.

From this I believe it to be an issue with argument passing, however, I am fairly sure I have it configured correctly. The only weird thing I would say about it is that I have added sudo to the command in nrpe.cfg on the remote host.

The setup looks like this:

remote host

/etc/nagios/nrpe.cfg

command[customcheck_bash]=/usr/bin/sudo /usr/lib/nagios/plugins/customcheck.sh --warning $ARG1$ --critical $ARG2$

monitoring server

/etc/nagios3/commands.cfg

define command{
    command_name    customcheck_bash
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$

    }

/etc/nagios3/conf.d/custom_server.cfg

define service {
    use                             generic-service
    host_name                       client
    service_description             Custom checker
    check_command                   check_nrpe!customcheck_bash!10!20
    }

any help would be appreciated, I've looked at countless sites for this but can't seem to figure it out.

Thanks!

user322111
  • 21
  • 2

1 Answers1

3

finally figured this out and was very trivial. What you suggested would've helped if I had seen it in time. But basically the issue was this line:

command[customcheck_bash]=/usr/bin/sudo /usr/lib/nagios/plugins/customcheck.sh --warning $ARG1$ --critical $ARG2$

you do not need the --warning and --critical flags

C413
  • 61
  • 5