Thanks to Claudio for finding the solution to this issue.  To add to the 
instructions below I found that on my installation the line in nagiosgraph.conf 
to enable the rrdopts.conf file was commented out.  You will need to uncomment 
this and make sure that it points to the correct place in order for the graphs 
to be correctly updated.

James

From: Claudio Kuenzler [mailto:c...@claudiokuenzler.com]
Sent: 19 December 2012 14:19
To: Nagios Users List
Subject: Re: [Nagios-users] Nagios Graph converting figures to binary bytes 
rather than decimal

James and I continued the troubleshooting off-list and we came to the solution, 
which we want to share of course.
Here's more or less my mail:

---------------------------------------

You're absolutely right, the graphs were not correct. With both *1000**2 and 
*1024**2.

Actually, thanks to your e-mail I figured that in the past years I've lived in 
denial. I must have come up with the multiplication of 1000 in the map file as 
a kind of workaround, because the graph was closer to the actual reality. Then 
I must have forgotten that and went on....

I broke it down to this:

# df

Filesystem      Size               Used              Avail             Use% 
Mounted on
/dev/md4         682587992     117456312     530731228      19% /

# df -h

Filesystem      Size            Used          Avail          Use% Mounted on
/dev/md4         651G          113G          507G          19% /

So df shows a value in KB (682587992).

The Nagios plugin itself takes this value and presents it in MB (666589):

/=114709MB;533271;599930;0;666589

So in order to present Nagiosgraph the values, we have to go down to the lowest 
level, which in this case is Byte.
To get Byte value from the Nagios output we have to multiply it with 1024^2: 
666589*1024*1024 = 698969227264

The job of Nagiosgraph is now to take this 698969227264 value and divide it so 
often through 1024 until a "reasonable" and human readable value is given, 
which would be the 651 GB.

But here's the problem: Nagiosgraph divides 698969227264 through 1000 instead 
of 1024, showing the graph at 698 GB.
But why? It took me some guesses which I had to confirm but: Nagiosgraph BY 
DEFAULT divides through 1000. Probably because the initial reason for rrd 
graphs was the graphing of network connections which are usually in bits. 
Anyhow we need to tell Nagiosgraph to divide through 1024 for our disk checks.
There's a special file for that called rrdopts.conf. I added the following 
lines to it:

# disk values need to be divided by 1024 not 1000
Diskspace /=-b 1024
Root Partition=-b 1024

The string left defines the service description in Nagios. So in my case this 
is "Diskspace /". -b 1024 tells Nagiosgraph to take 1024 as a base value.
See the following entry from the "rrdgraph" manpage:

[-b|--base value] If you are graphing memory (and NOT network traffic) this 
switch should be set to 1024 so that one Kb is 1024 byte. For traffic 
measurement, 1 kb/s is 1000 b/s.

Now you just have to make sure, that rrdopts.conf is not commented in your 
nagiosgraph.conf file and there you go.
Positive thing is that there is no need to recreate the rrd files. This rrd 
option is only for viewing/drawing the graphs. Which means that the correct 
values are shown immediately.


On Tue, Dec 18, 2012 at 2:51 PM, James Osbourn 
<james.osbo...@citrix.com<mailto:james.osbo...@citrix.com>> wrote:
Hi Claudio,

I modified your code as it was not working for me and wanted to check what was 
going on.  I have reverted back to using the example that you have given and I 
am still getting the same result as can be seen here
The filesystem is only 450GB in size, yet the graph values are still showing 
460.80, which is the byte value show in decimal GB.

I cannot work out why the graph is showing the wrong values when all other 
information is correct.

James

From: Claudio Kuenzler 
[mailto:c...@claudiokuenzler.com<mailto:c...@claudiokuenzler.com>]
Sent: 18 December 2012 12:15

To: Nagios Users List
Subject: Re: [Nagios-users] Nagios Graph converting figures to binary bytes 
rather than decimal


Hi Claudio,

I have entered the map entry below based on your example and I am still seeing 
the results on the graph show as a decimal version of the Bytes value.

/perfdata:(.*)=(\d+)MB;(\d+);(\d+);(\d+);(\d+)/
and push @s, [$1,
        ['data', GAUGE, $2*1024*1024 ],
        ['warn', GAUGE, $3*1024*1024 ],
        ['crit', GAUGE, $4*1024*1024 ],
        ['min', GAUGE, $5*1024*1024 ],
        ['max', GAUGE, $6*1024*1024 ] ];

You didn't follow my example, as you're again multiplying with 1024.

Take _another_ look at my example:

        ['used', GAUGE, $2*1000**2 ],
        ['total', GAUGE, $6*1000**2 ] ];

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net<mailto:Nagios-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue.
::: Messages without supporting info will risk being sent to /dev/null

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to