Page 1 of 1

nagios plugin command argument missing

Posted: Tue Nov 18, 2014 11:34 pm
by kchen4
hi,

I'm encountering a strange issue when trying to run plugin command. My command is written in Perl named "/usr/local/nagios/libexec/xdcr_monitor.pl", I found each time it was called 2 times and for the first time it worked well but not all arguments are passed to it for the second time. I opened nagios debug and checked debug log, and found:

[1416395862.935456] [2048.2] [pid=27703] Not currently in macro. Running output (85): '/usr/local/nagios/libexec/xdcr_monitor.pl -H 10.64.218.133 -U Administrator -P 123456'
[1416395862.935462] [2048.1] [pid=27703] Done. Final output: '/usr/local/nagios/libexec/xdcr_monitor.pl -H 10.64.218.133 -U Administrator -P 123456' <<<<<<<<<<< the first time, arguments were passed normally

[1416395864.063038] [2320.2] [pid=27703] Raw Command Input: $USER1$/xdcr_monitor.pl -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$
[1416395864.063043] [2320.2] [pid=27703] Expanded Command Output: $USER1$/xdcr_monitor.pl -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ <<<<<<<<< missed macros for argument parsing for the second time
[1416395864.063156] [2048.2] [pid=27703] Not currently in macro. Running output (66): '/usr/local/nagios/libexec/xdcr_monitor.pl -H 10.64.218.133 -U -P '
[1416395864.063160] [2048.1] [pid=27703] Done. Final output: '/usr/local/nagios/libexec/xdcr_monitor.pl -H 10.64.218.133 -U -P ' <<<<<<<<<<< so the last 2 arguments are empty

It seems that 2 events are invoked at that time, I don't know why it worked like that, and it continuously happened.
Could you help me? Thanks a lot!

Re: nagios plugin command argument missing

Posted: Wed Nov 19, 2014 5:08 pm
by sreinhardt
Do you have multiple services or hosts calling this command? How do you have the command and service configurations defined presently?

Re: nagios plugin command argument missing

Posted: Wed Nov 19, 2014 9:00 pm
by kchen4
Thanks for your response. Currently in our nagios environment there are many other commands working well, but mine works abnormally.

my configurations are as follows, I didn't find anything wrong with them. What confusing me is that if my nagios config file is incorrect, the first call of command would not succeed.

define command{
command_name xdcr_monitor
command_line $USER1$/xdcr_monitor.pl -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$
}

define service{
hostgroup_name xdcr_test_cluster
service_description Couchbase XDCR monitor
check_command xdcr_monitor!Administrator!123456
max_check_attempts 2
check_interval 1
retry_interval 1
check_period 24x7
notification_interval 30
notification_period 24x7
notification_options w,c
notifications_enabled 0
contacts proddba
}

Re: nagios plugin command argument missing

Posted: Wed Nov 19, 2014 11:58 pm
by kchen4
Thanks for your help. I checked my config files carefully and found my command was called 2 times so that's the root cause.
However, I still think that doesn't make sense that some arguments were missing when running the same command for the second time. I tend to consider it as a potential bug.
Thanks.

Re: nagios plugin command argument missing

Posted: Thu Nov 20, 2014 4:35 pm
by lmiltchev
Thanks for the feedback! I am glad your issue has been resolved! I am locking this topic.

Re: nagios plugin command argument missing

Posted: Thu Nov 20, 2014 4:43 pm
by sreinhardt
Well, nagios is only going to execute what you have provided it. Up to this point as long as you are using legal characters, I do not know of any such bug. Doesn't mean that it couldn't happen though, so if you see it again definitely let us know. I'll lock this up for now as it sounds like you are all cleared up on duplicate executions.