nagios plugin command argument missing

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kchen4
Posts: 3
Joined: Tue Nov 18, 2014 11:25 pm

nagios plugin command argument missing

Post 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!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: nagios plugin command argument missing

Post by sreinhardt »

Do you have multiple services or hosts calling this command? How do you have the command and service configurations defined presently?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
kchen4
Posts: 3
Joined: Tue Nov 18, 2014 11:25 pm

Re: nagios plugin command argument missing

Post 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
}
kchen4
Posts: 3
Joined: Tue Nov 18, 2014 11:25 pm

Re: nagios plugin command argument missing

Post 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.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: nagios plugin command argument missing

Post by lmiltchev »

Thanks for the feedback! I am glad your issue has been resolved! I am locking this topic.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: nagios plugin command argument missing

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked