2

I am trying to configure Nagios to monitor FreeSWITCH as mentioned at https://github.com/kjhosein/nagios-freeswitch-plugin .

I have downloaded the script from git and followed listed steps.

On remote (NRPE) server I have added below line in nrpe.cfg file

command[check_freeswitch_health]=/usr/lib64/nagios/plugins/check_freeswitch_health.pl $ARG1$

On Nagios server,added in commands.cfg file

define command {
    command_name    check_freeswitch_health
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_freeswitch_health $ARG1$
  }

and in services.cfg file

define service {
    host_name       freeswitch01
    service_description     FreeSWITCH - Calls Count
    check_command   check_freeswitch_health!-a '-q show-calls-count'!!!!!!!
  }

But on Nagios web interface I am getting

CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

On remote server, logs(/var/log/syslog) showing below error

Request contained command arguments!
Client request was invalid, bailing out...

What I am missing here ? Can anyone please assist me with correct configurations ?

Thanks,

Rutu

1
  1. Make sure you can run that perl script locally, as the nagios/nrpe user.
  2. Make sure that perl script doesn't depend on ENV (e.g., $PATH). Verify by running through env -i /usr/lib64/nagios/plugins/check_freeswitch_health.pl ...
  3. Use your generic check_nrpe command definition, instead of writing a check_{whatever} for every different NRPE command you want to run.
  4. To pass args with -a, you must enable command arguments in nrpe.cfg by setting dont_blame_nrpe=1

For example, if your check_nrpe command looks like this:

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

Then your service definition would be:

define service {
    host_name       freeswitch01
    service_description     FreeSWITCH - Calls Count
    check_command   check_nrpe!check_freeswitch_health!-q show-calls-count
}

(Why do you have !!!!!!! at the end of your command?)

Or, if the only option you ever pass to that perl script is -q, you can put it in the command definition in the NRPE config:

command[check_freeswitch_health]=/usr/lib64/nagios/plugins/check_freeswitch_health.pl -q $ARG1$

Then your check_command would be just check_nrpe!check_freeswitch_health!show-calls-count

  • Hi Keith, Thank you for detailed explanation to my query. 1.Make sure you can run that perl script locally, as the nagios/nrpe user. >>How can I check that perl script is run as nagios/nrpe user? 2.Make sure that perl script doesn't depend on ENV (e.g., $PATH). >>When I run env -i /usr/lib/nagios/plugins/check_freeswitch_health.pl -q show-calls-count on nrpe server,it gives: REESWITCH_HEALTH OK - Result of check is: 0 total. | show-calls-count=0;; – Rutu Jan 20 '16 at 5:40
  • 3.Use your generic check_nrpe command definition, instead of writing a check_{whatever} for every different NRPE command you want to run. >> I have tried as you have suggested but still getting same issue. I have script check_freeswitch_health.pl at /usr/lib/nagios/plugins/ Is there any specific steps to install nagios-freeswitch-plugin ? – Rutu Jan 20 '16 at 5:56
  • Added a step 4 for you ;-) Not sure how I missed this the first time, sorry. – Keith Jan 20 '16 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.