Page 1 of 2

Problem with a check

Posted: Thu May 02, 2013 8:43 am
by guppy_rules
Hello,

I hope that someone can help me with an issue. I've created an check to monitor the scratch tapes available. When I run this command on the commandline (as user nagios) the check will work. But when I put this check into nagiosxi and run it then I get an unknown error. Where can I find the exact command that nagiosxi is running?

From the commandline:
[nagios@nagiosxi libexec]$ /usr/local/nagios/libexec/tsmmonitor.sh -s=TSMLM1 scratch
scratch - tsmserver TSMLM1: number of scratch tapes 29, OK

From nagiosxi:
Testing check from command line...

COMMAND: /usr/local/nagios/libexec/tsmmonitor.sh -s=TSMLM1 scratch
OUTPUT:

What's the difference?

Re: Problem with a check

Posted: Thu May 02, 2013 11:04 am
by abrist
Are you just checking the command with " test check" or are you creating a full check? (there are known limitations with the "test check" functionality as it has escaping issues and runs as the user apache, not nagios)

Re: Problem with a check

Posted: Mon May 06, 2013 1:29 am
by guppy_rules
Hi,

I don't know what you mean with "full check". I know that there are limitations with the "test check", but with this command I see in nagiosxi status Unknown. But I don't know why it is unknown because on commandline the check works.

Re: Problem with a check

Posted: Mon May 06, 2013 1:53 am
by guppy_rules
Hi,

Ive tried it also with other commands. Let me give an example:

This command works on the commandline AND within nagiosxi
[root@nagiosxi libexec]# su -c '/usr/local/nagios/libexec/tsmmonitor.sh diskvol' nagios
diskvol -number of disk volumes without readwrite access 0, OK
[root@nagiosxi libexec]# echo $?
0

This command works on commandline but NOT within nagiosxi
[root@nagiosxi libexec]# su -c '/usr/local/nagios/libexec/tsmmonitor.sh -s=tsmlm1 diskvol' nagios
diskvol -number of disk volumes without readwrite access 0, OK
[root@nagiosxi libexec]# echo $?
0

The difference is that with the second one I have an other TSM servername. But the output is the same.
Can someone explain why nagiosxi doesn't understand the second command?

Re: Problem with a check

Posted: Mon May 06, 2013 10:58 am
by scottwilkerson
Can you post the contents of /usr/local/nagios/libexec/tsmmonitor.sh as well as

Code: Select all

ls -l /usr/local/nagios/libexec/tsmmonitor.sh
Thanks

Re: Problem with a check

Posted: Tue May 07, 2013 4:21 am
by guppy_rules
Hi,

[root@nagiosxi libexec]# ls -l tsmmonitor.sh
-rwxr-xr-x 1 root root 59445 May 6 08:49 tsmmonitor.sh

I've attached the script.
tsmmonitor.txt
Thanks for looking at it.

Re: Problem with a check

Posted: Tue May 07, 2013 10:29 am
by abrist
Make sure you always test your commands from the XI cli as user "nagios". Additionally, if you are using the "test check command" in the CCM, the command will be run as user "apache". Have you created a full service check for the 'scratch' command or just attempted the test?

Re: Problem with a check

Posted: Tue May 07, 2013 10:34 am
by guppy_rules
Hi,

I create a full service check. When Nagioxsi runs this check I get an Unknown status. With the "test check command" I get no results back (but that's oke because user apache is not allowed to run the dsmadmc command).
On the command line as user nagios the check works (as told in previous post)

Commandline output:
[root@nagiosxi libexec]# su -c '/usr/local/nagios/libexec/tsmmonitor.sh -s=tsmlm1 diskvol' nagios
diskvol -number of disk volumes without readwrite access 0, OK
[root@nagiosxi libexec]# echo $?
0

Re: Problem with a check

Posted: Tue May 07, 2013 11:13 am
by sreinhardt
Two things, what happens if instead of su -c you fully su into the nagios user and execute? Also can you try "chown nagios.nagios /usr/local/nagios/libexec/tsmmonitor.sh" While I realize the plugin has everyone set to read and execute, its better to have nagios as the specific owner.

Re: Problem with a check

Posted: Mon May 13, 2013 6:06 am
by guppy_rules
Hi,

As user nagios it's runs without any problem. I think that the problem nagiosxi is, but I don't know why.