Page 1 of 1

No performance graphs were found for this service.

Posted: Tue Oct 24, 2017 7:10 am
by EOCulubong
Hi Guys,

Good evening. I am just starting to learn nagios and here is what I am having problems now. Hope someone could help me.

I am having problems with this script that I am using. I am trying to use rawNumbers.php on nagvis, but nagvis gives me an Error state.

I tried to read and search for answers, but it is true that in order for rawNumbers.php to work is to have the service collecting perfdata? Or is there any other way I can be able to display the output properly in nagvis.

Below is the scrip that I am using:

Code: Select all

#!/bin/bash

# Return codes:
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3

# Arguments:
WARNLEVEL=$1
CRITLEVEL=$2

STATS=$(/opt/ardome/bin/derivemgr stats | awk "END{print;exit}" | awk '{ print substr( $2, 0 ) }')


if [ $STATS -lt $WARNLEVEL ]
then
  echo "OK: Derived Stats - $STATS"
  exitstatus=$STATE_OK
  exit $exitstatus
elif [ $STATS -lt $CRITLEVEL -a $STATS -gt $WARNLEVEL ]
then
  echo "WARNING: Derived Stats - $STATS"
  exitstatus=$STATE_WARNING
  exit $exitstatus
elif [ $STATS -gt $CRITLEVEL ]
then
  echo "CRITICAL: Derived Stats $STATS"
  exitstatus=$STATE_CRITICAL
  exit $exitstatus
fi
The code works, below is the sample output of the command:

OK: Derived Stats - 307


I just want to have the result of the script "307" in this example to be displayed on nagvis.

Thanks and Regards,
Del

Re: No performance graphs were found for this service.

Posted: Tue Oct 24, 2017 8:30 am
by mcapra
If all you need is for the script to provide performance data, the nagios plugin development guidelines have a section dedicated to performance data.

Essentially you'd need to modify your plugin's output to look something like this:

Code: Select all

OK: Derived Stats - 307 | stats=307

Re: No performance graphs were found for this service.

Posted: Tue Oct 24, 2017 11:18 am
by kyang
Thanks @mcapra!

@EOculubong, take a look at the links. What mcapra said, is what you'd need to have in order to make perf graphs show for that service.

Re: No performance graphs were found for this service.

Posted: Wed Oct 25, 2017 1:15 am
by EOCulubong
Hi Guys,

Thanks for the info, will definitely check the links.

Regards,
Del

Re: No performance graphs were found for this service.

Posted: Wed Oct 25, 2017 2:08 am
by EOCulubong
Hi @mcapra and @kyang,

It works, I just changed my script to this:

Code: Select all

STATS=$(/opt/ardome/bin/derivemgr stats | awk "END{print;exit}" | awk '{ print substr( $2, 0 ) }')


if [ $STATS -lt $WARNLEVEL ]
then
  echo "OK: Derived Stats - $STATS | stats=$STATS"
  exitstatus=$STATE_OK
  exit $exitstatus
elif [ $STATS -lt $CRITLEVEL -a $STATS -gt $WARNLEVEL ]
then
  echo "WARNING: Derived Stats - $STATS | stats=$STATS"
  exitstatus=$STATE_WARNING
  exit $exitstatus
elif [ $STATS -gt $CRITLEVEL ]
then
  echo "CRITICAL: Derived Stats $STATS | stats=$STATS"
  exitstatus=$STATE_CRITICAL
  exit $exitstatus
fi
Thanks and Regards,
Del

Re: No performance graphs were found for this service.

Posted: Wed Oct 25, 2017 9:04 am
by kyang
Great to hear! Do you have any more questions?

Or are we okay to close this topic?

Re: No performance graphs were found for this service.

Posted: Thu Oct 26, 2017 1:43 am
by EOCulubong
Hi @kyang none so far.

We can close this topic now.

Thanks again. :D

Re: No performance graphs were found for this service.

Posted: Thu Oct 26, 2017 9:22 am
by kyang
Sounds great! I'll be closing this topic as resolved!

If you have any more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!