Problem with a check
-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Problem with a check
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?
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
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)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Re: Problem with a check
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.
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.
-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Re: Problem with a check
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?
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?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Problem with a check
Can you post the contents of /usr/local/nagios/libexec/tsmmonitor.sh as well as
Thanks
Code: Select all
ls -l /usr/local/nagios/libexec/tsmmonitor.sh-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Re: Problem with a check
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. Thanks for looking at it.
[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. Thanks for looking at it.
You do not have the required permissions to view the files attached to this post.
Re: Problem with a check
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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Re: Problem with a check
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
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
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Problem with a check
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.
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.
-
guppy_rules
- Posts: 12
- Joined: Thu Feb 09, 2012 10:21 am
Re: Problem with a check
Hi,
As user nagios it's runs without any problem. I think that the problem nagiosxi is, but I don't know why.
As user nagios it's runs without any problem. I think that the problem nagiosxi is, but I don't know why.