XI | how to know what command in actual is submitted to Core

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ericssonvietnam
Posts: 239
Joined: Mon Jun 27, 2016 11:05 pm

XI | how to know what command in actual is submitted to Core

Post by ericssonvietnam »

Nagios XI 5.2.9

I 've using Nagios XI 5.2.9 and getting strange issue with snmp checks:-
when i execute the command from bash sheel, it works fine and display result but when executed from XI, it get executed but without any result..

eg( from command shell):-

Code: Select all

id && /usr/local/nagios/libexec/check_netapp_ontap.pl -H HOST -u USER -p PASSWORD -c public -o interface_health desc
uid=500(nagios) gid=500(nagios) groups=500(nagios),501(nagcmd)
sess103/esealna004esealna004_lif1 home is sess103 but current node is sess104
But when same command get executed from XI, i got:-
Command description:-

Code: Select all

$USER1$/check_netapp_ontap.pl -H $HOSTADDRESS$ -u USERNAMEXX -p $USER3$ $ARG1$ $ARG2$ $ARG3$ ; -n vhost/cluster-node
Service description:-

Code: Select all

$USER1$/check_netapp_ontap.pl -H $HOSTADDRESS$ -u USERNAMEXX -p $USER3$ $ARG1$ $ARG2$ $ARG3$ ; -n vhost/cluster-node
         $ARG1$= -c public, $ARG2$=-o interface_health desc 
O/P on Portal:

Code: Select all

Netapp : LIF state	Ok	18m 6s	1/3	2016-10-05 16:40:30	OK - No problems found (0 checked)
Instead of (o checked) it should be
" sess103/esealna004esealna004_lif1 home is sess103 but current node is sess104"
To troubleshoot, can you tell me how to get what exact command XI is submitting to CORE?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: XI | how to know what command in actual is submitted to

Post by lmiltchev »

I am not familiar with the plugin - probably @WillemDH can chime in. :)

Looking at your command and service though, I believe they need to be modified as such:

command:

Code: Select all

$USER1$/check_netapp_ontap.pl -H $HOSTADDRESS$ -u USERNAMEXX -p $USER3$ $ARG1$ $ARG2$ $ARG3$
service:

Code: Select all

check_netapp_ontap.pl!-c public!-o interface_health desc!-n vhost/cluster-node
Unfortunately, I am not able to test this in house.

BTW, what is the actual command and output that you currently see when you test it under the CCM?

CCM->Services-><your service>->Test Check Command
Be sure to check out our Knowledgebase for helpful articles and solutions!
ericssonvietnam
Posts: 239
Joined: Mon Jun 27, 2016 11:05 pm

Re: XI | how to know what command in actual is submitted to

Post by ericssonvietnam »

That is why to troubleshoot, i am interest to know, how to get details of what command in actual Xi submit to core for execution.!

If there is any possible way,do let me know..!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: XI | how to know what command in actual is submitted to

Post by rkennedy »

I would look at your /usr/local/nagios/var/objects.cache to see how the host / service is fully compiled, and then look at your assigned check_command. From there, look at your command definition, and match up the two.

If you're looking at debugging the actual plugins, it varies by the language. With something like bash, you could add this to the top -

Code: Select all

echo $@ >> /tmp/debug.txt
Which would have it log everything after the script to /tmp/debug.txt whenever it's executed. Here's an example -

Code: Select all

[root@localhost libexec]# cat gg.sh
#!/bin/bash
echo $@ >> /tmp/debug.txt

[root@localhost libexec]# ./gg.sh dsf gsd sgd
[root@localhost libexec]# cat /tmp/debug.txt
dsf gsd sgd

[root@localhost libexec]# ./gg.sh dsf gsd sgd das sgd
[root@localhost libexec]# cat /tmp/debug.txt
dsf gsd sgd
dsf gsd sgd das sgd
Former Nagios Employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: XI | how to know what command in actual is submitted to

Post by lmiltchev »

Also, when you test your check under the CCM by going to: CCM->Services-><your service>->Test Check Command, you will be able to see the exact command that is being submitted.
Keep in mind that CCM may try to do some escaping - you may see backslashes ("\") in some instances, i.e. DB checks, etc.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked