Nagios Plugin [.sh] not working as command

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
sunnysthakur
Posts: 6
Joined: Tue Feb 26, 2013 8:26 am

Nagios Plugin [.sh] not working as command

Post by sunnysthakur »

Hello.

I am working on setup a nagios plugin for monitor tomcat instance from tomcat manager.

This is a script file downloaded from http://exchange.nagios.org/directory/Pl ... on/details

This is working fine when executed as shell by passing variables

[root@monitor ~]# ./check_TomcatApplication --user admin --password password --host 192.168.11.15 --port 8080 --appname DEMO_32

OK: Application DEMO_32 is running!

Now when i configured this as a nagios command in command.cfg this is not working.

define command{
command_name check_TomcatApplication
command_line $USER1$/check_TomcatApplication --user $USER13$ --password $USER14$ --host $HOSTADDRESS$ --port $ARG1$ --appname $ARG2$
}


Below is the lines added in services.cfg of nagios to add the same for host

# check Tomcat Status
define service{
use generic-service
host_name hostname
service_description Tomcat Status
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups winadmins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_TomcatApplication!8080!DEMO_32


But on UI it says application is not running.

Please help me to figure out this issue
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Plugin [.sh] not working as command

Post by sreinhardt »

Your definition and cli command certainly look good. Am I correct in guessing that your definition of $USER13$ and $USER14$ are the same as what you are using on the command line check? Also do those variables have any special characters that may need escaping? Just for testing, could you try hard coding in the user\pass into the nagios check and see if that works properly, no need to post the command, just to see if that makes any changes when running.
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.
sunnysthakur
Posts: 6
Joined: Tue Feb 26, 2013 8:26 am

Re: Nagios Plugin [.sh] not working as command

Post by sunnysthakur »

Hello,

Thanks for helping me out here.
I used hard values for --user and -password and now this is working fine.

Appreciated your help.. :)
Locked