Page 2 of 2

Re: Different result in web interface and command line

Posted: Wed Sep 17, 2014 2:12 pm
by Box293
I have some suggestions for you as I came across a similar problem a while ago.

My biggest tip is to perform ALL of your tests running as the nagios user, as this is how the monitoring engine is going to do it.

Code: Select all

su nagios
then do your tests

NOTE:
su - nagios
This is NOT how the monitoring engine executes the plugin.

Also, some programs detect that you are not running in a terminal session and require a special parameter to overcome this.
For example top requires the -b argument to run in batch mode:

Code: Select all

top -n 1 -b
Also, you might be missing some output if it is being redirected to STDERR instead of STDOUT.

You can append your command with 2>&1 to redirect STDERR to STDOUT.

Code: Select all

top -n 1 -b 2>&1
Finally, try breaking your code up and echoing the value of just one component. Trying it all in one line can lead to lots of frustration. Start with the first command along with the 2>&1 redirection and see what error you get. If that works add your pipe and next bit of code and test again.

Sorry I don't have a direct answer but these tips should help you pinpoint the problem.

Re: Different result in web interface and command line

Posted: Sun Sep 21, 2014 3:45 am
by hafthanhf
Thanks you all,
I've fixxed the problem.
I when I investigated the promblem come from expect plugin. U know, when I run expect plugin as nagios user, It gave me the wrong promblem, so I remove some "|" part in the show command that is spawn to destination routers. And it work.
Here is what I changed in expect script:
the old script:

Code: Select all

send "show bgp summary | find AS | except inet | no-more | except AS\n"
After editted:

Code: Select all

send "show bgp summary | no-more\n"
I don't know how the monitoring engine do when I added many "|" part in expect script but It gives wrong result.
Btw, I want to update this plugin to nagios exchange, but don't know how to remove the old plugin II posted before, plz tell me how :P

Re: Different result in web interface and command line

Posted: Mon Sep 22, 2014 3:32 pm
by lmiltchev
If you are the original poster, you *should* be able to edit your post on the Nagios Exchange. Can you provide us with a link to the plugin? If you are not able to modify the listing, we can probably do it for you. Let me know if you need help with that.

Re: Different result in web interface and command line

Posted: Fri Oct 03, 2014 4:14 am
by hafthanhf
lmiltchev wrote:If you are the original poster, you *should* be able to edit your post on the Nagios Exchange. Can you provide us with a link to the plugin? If you are not able to modify the listing, we can probably do it for you. Let me know if you need help with that.
Thanks lmiltchev, I'll edit it myself , but, could you please remove the duplicate post of it, below is the link:
http://exchange.nagios.org/directory/Pl ... er/details

Re: Different result in web interface and command line

Posted: Fri Oct 03, 2014 12:05 pm
by lmiltchev
Thanks lmiltchev, I'll edit it myself , but, could you please remove the duplicate post of it, below is the link:
http://exchange.nagios.org/directory/Pl ... er/details
Done.