graphing in Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

graphing in Nagios XI

Post by yaanatech »

I am having an issue where data is not graphing, below is a test script I wrote to graph some disk usage; using the graph Explorer plugin to watch this on a single graph.

Test works fine, Status Ok is of course returned, under advanced I see there is perfdata; but it isn't graphing. Am I missing something in how NagiosXI graphs data? I have seen this work on other scripts.

Code: Select all

#!/bin/bash

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3

AA=`df -H | grep /dev/sda2 | awk '{print $5}'| sed 's/%//g'`
AB=`df -H | grep /dev/sdb1 | awk '{print $5}'| sed 's/%//g'`
AC=`df -H | grep /dev/sdb2 | awk '{print $5}'| sed 's/%//g'`
AD=`df -H | grep /dev/sdc1 | awk '{print $5}'| sed 's/%//g'`
AE=`df -H | grep /dev/sdc2 | awk '{print $5}'| sed 's/%//g'`
AF=`df -H | grep /dev/sdd1 | awk '{print $5}'| sed 's/%//g'`
AG=`df -H | grep /dev/sdd2 | awk '{print $5}'| sed 's/%//g'`

echo "Status Ok: /dev/sda2 $AA, /dev/sdb1 $AB, /dev/sdb2 $AC, /dev/sdc1 $AD, /dev/sdc2 $AE, /dev/sdd1 $AF, /dev/sdd2 $AG | sda2=$AA;sdb1=$AB,sdb2=$AC;sdc1=$AD;sdc2=$AE;sdd1=$AF;sdd2=$AG"
exit $STATE_OK
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: graphing in Nagios XI

Post by abrist »

You may want to specify your unit of measurement in percents as that is the metric you are awking.

Code: Select all

sda2=$AA%;sdb1=$AB%,sdb2=$AC%;sdc1=$AD%;sdc2=$AE%;sdd1=$AF%;sdd2=$AG%
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.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: graphing in Nagios XI

Post by yaanatech »

I had a comma where I need an ; in the graphing portion.

Nagios is using the default graphing .xml, how do I change the units to be a % in the graph? Instead of 68.002 as an example - it just shows 68. Given how Nagios can break if you touch default configs, i have avoided touching files I don't fully understand.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: graphing in Nagios XI

Post by abrist »

Good catch on the comma. In order to make the graph use percentage, you just need to declare the value's unit of measurement as a percent in the perfdata. In my example above, I added a percent sign after the values, this should be enough for the perfdata to be treated as a percentage rather than a float or int value.
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.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: graphing in Nagios XI

Post by yaanatech »

Oh right, sweet. I'll try that. Thanks for the suggestion.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: graphing in Nagios XI

Post by slansing »

Good catch, let us know if this resolves the issue.