Plugin output display problem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Plugin output display problem

Post by skynardo »

Running Nagios XI 2014 R2.5 and deploying a cpu plugin that I modified to use sar data. Running the check locally seems to work fine, but when nrds runs the passive check, it shows up in Nagios without the data.
Entry from nrfs.cfg --> command[check_cpu_linux]=/usr/local/nagios/libexec/check_cpu_linux.sh -w 10 -c 5 -t id
Manually running above check:
[nagios@devserver libexec]$ /usr/local/nagios/libexec/check_cpu_linux.sh -w 10 -c 5 -t id
OK : CPU IDLE: 99% | Id=99%;10;5

XI Service Detail Status Information displays:
OK : CPU IDLE: %

I can't figure out what I'm doing wrong here.
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Re: Plugin output display problem

Post by skynardo »

Looks like this is related to sar not running (or not running in the same fashion) via cron job.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Plugin output display problem

Post by lmiltchev »

Did you check to see if the config was updated on the client? Are the version numbers the same? Can you run the following commands on the remote box and show us the output?

Code: Select all

cat /usr/local/nrdp/clients/nrds/nrds.cfg
crontab -u nagios -l
Also, in Nagios XI, go to:

Home->Service Detail-><your service>->Advanced tab and show us a screenshot
Admin->NRDS Config Manager-><your config>->Edit and show us a screenshot
Be sure to check out our Knowledgebase for helpful articles and solutions!
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Re: Plugin output display problem

Post by skynardo »

The nagios config is good and the plugin works when it is run directly, or if I run the following line from the nagios crontab /usr/local/nrdp/clients/nrds/nrds.pl -H 'devserver' 2>&1. It is only when the cron job is run non-interactively that the CPU IDLE value is not returned. Im guessing it is a difference in the output of sar when run non-interactively, Will have to do some more troubleshooting of the plugin.

Does the LOG_FILE feature of in the NRDS Config under Additional Settings work? I have specified /logs/techserv/nagios/nrds.log and have verified that the nagios user can touch this file on the client, but nothing seems to get written here.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Plugin output display problem

Post by lmiltchev »

What are the permissions on the log file? Can you run the following command and show us the output?

Code: Select all

ls -l /logs/techserv/nagios/nrds.log
Be sure to check out our Knowledgebase for helpful articles and solutions!
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Re: Plugin output display problem

Post by skynardo »

As info, I had to change my plugin to parse a different column (minus 1) to get the %IDLE Time when tty is not present. I'm still not sure what is going on but am moving on for now.

Here is my nrds.log and an example nrds.cfg file.

[nagios@deva511a ~]$ ls -lrt /logs/techserv/nagios
total 0
-rw-rw-r-- 1 nagios nagios 0 Mar 31 15:25 nrds.log

CONFIG_VERSION="0.2"
CONFIG_OS="Linux"
CONFIG_NAME="Linux_standard_tomcat"
URL="https://nagiosxi/nrdp/"
TOKEN="mytokenvalue"
PLUGIN_DIR="/usr/local/nagios/libexec"
SEND_NRDP="/usr/local/nrdp/clients/send_nrdp.sh"
TMPDIR="/usr/local/nrdp/clients/tmp"
COMMAND_PREFIX=""
LOG_FILE="/logs/techserv/nagios/nrds.log"
UPDATE_CONFIG="1"
UPDATE_PLUGINS="1"

command[check_cpu_linux]=/usr/local/nagios/libexec/check_cpu_linux.sh -w 10 -c 5 -t id
command[check_swap_linux]=/usr/local/nagios/libexec/check_swap_linux -w 60 -c 80
command[check_all_linux]=/usr/local/nagios/libexec/check_all_linux -f /usr/local/nagios/etc/check_all_linux.cfg
command[check_fsspace_linux]=/usr/local/nagios/libexec/check_fsspace_linux -f /usr/local/nagios/etc/check_fsspace_linux.cfg
command[check_heap_used]=/usr/local/nagios/libexec/check_jmxeval.sh /usr/local/nagios/etc/jmxeval-heap_used.xml
command[check_catalina_log]=/usr/local/nagios/libexec/check_catalina_log.sh
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Plugin output display problem

Post by lmiltchev »

I had to talk to the NRDS developer about this one. It seems like the "LOG_FILE" setting is not used in the Linux version. It's left there, because it is used in the Windows NRDS client (default log file: C:\Program Files\Nagios\NRDS_Win\logs\NRDS_Debug.log). :(

You can probably modify the cron entry to redirect the output to a file, i.e.

Code: Select all

*/5 * * * * /usr/local/nrdp/clients/nrds/nrds.pl -H 'hostname' > /logs/techserv/nagios/nrds.log 2>&1
Every time the cron job is run the log will be overwritten. I would not recommend using ">>" instead of ">". If you append the output, this log could grow out of control, unless you trim it.
As info, I had to change my plugin to parse a different column (minus 1) to get the %IDLE Time when tty is not present. I'm still not sure what is going on but am moving on for now.
Is the issue resolved after the mods you made?
Be sure to check out our Knowledgebase for helpful articles and solutions!
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Re: Plugin output display problem

Post by skynardo »

Yes, the initial problem I was having seems to have been plugin related. Thanks for the nrds logging info.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Plugin output display problem

Post by ssax »

Are we ok to mark this as resolved and lock the topic?
skynardo
Posts: 136
Joined: Tue Sep 18, 2012 8:59 am
Location: St. Louis, MO

Re: Plugin output display problem

Post by skynardo »

ok with me
Locked