Bandwidth graphs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Bandwidth graphs

Post by ajwusv »

We are currently evaluating NagiosXI for our 700+ store network and are trying to gather bandwidth graphs from Cisco routers.

In Service detail under Status information, it displays the current bandwidth in Kbps, which is what we are looking for, but in the actual graph, the numbers are a little off and it displays in b/s. How can we change it so that the graph actually displays the Kbps as well?

Are there different processes that display the Status Information and the actual graph? Is there a way to configure MRTG to display that using the cfgmaker?

Any help would be greatly appreciated.
You do not have the required permissions to view the files attached to this post.
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Bandwidth graphs

Post by nscott »

ajwusv,

This has come up from time to time, and is a bit of phantom. The fix that works for most is to replace all the text in /usr/local/nagios/share/pnp/templates/check_xi_service_mrtgtraf.php with this code:

Code: Select all

<?php
#
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
# Plugin: check_snmp_int.pl (COUNTER)
# $Id: check_xi_service_mrtgtraf.php 59 2010-03-08 22:56:21Z egalstad $
#
#
$opt[1] = " --vertical-label \"Traffic $UNIT[1]\" -E --title \"Interface Traffic for $hostname / $servicedesc\" ";
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
$def[1] .= "CDEF:real1=var1,1000,* " ;
$def[1] .= "CDEF:real2=var2,1000,* " ;
$def[1] .= "LINE1:real1#003300:\"in  \" " ;
$def[1] .= "GPRINT:real1:LAST:\"%7.2lf %S$UNIT[1] last\" " ;
$def[1] .= "GPRINT:real1:AVERAGE:\"%7.2lf %S$UNIT[1] avg\" " ;
$def[1] .= "GPRINT:real1:MAX:\"%7.2lf %S$UNIT[1] max\\n\" " ;
$def[1] .= "LINE1:real2#00ff00:\"out \" " ;
$def[1] .= "GPRINT:real2:LAST:\"%7.2lf %S$UNIT[1] last\" " ;
$def[1] .= "GPRINT:real2:AVERAGE:\"%7.2lf %S$UNIT[1] avg\" " ;
$def[1] .= "GPRINT:real2:MAX:\"%7.2lf %S$UNIT[1] max\\n\" ";
if($NAGIOS_TIMET != ""){
    $def[1] .= "VRULE:".$NAGIOS_TIMET."#000000:\"Last Service Check \\n\" ";
}
if($NAGIOS_LASTHOSTDOWN != ""){
    $def[1] .= "VRULE:".$NAGIOS_LASTHOSTDOWN."#FF0000:\"Last Host Down\\n\" ";
}
?>
If that doesn't work there is one more possible fix. Give that a try and let me know.
Nicholas Scott
Former Nagios employee
Malcz86
Posts: 27
Joined: Thu Mar 17, 2011 11:17 am

Re: Bandwidth graphs

Post by Malcz86 »

Hi Nick,

I've got a simmilar issue apart from my graphs show as b/s intead of MB/S. How do I adjust the above to show MB's?
NagiosXI 2011R1.9
CentOs 5.4
32bit
VMWare Image
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Bandwidth graphs

Post by ajwusv »

nscott wrote:ajwusv,

This has come up from time to time, and is a bit of phantom. The fix that works for most is to replace all the text in /usr/local/nagios/share/pnp/templates/check_xi_service_mrtgtraf.php with this code:

Code: Select all

<?php
#
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
# Plugin: check_snmp_int.pl (COUNTER)
# $Id: check_xi_service_mrtgtraf.php 59 2010-03-08 22:56:21Z egalstad $
#
#
$opt[1] = " --vertical-label \"Traffic $UNIT[1]\" -E --title \"Interface Traffic for $hostname / $servicedesc\" ";
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "DEF:var2=$rrdfile:$DS[2]:AVERAGE " ;
$def[1] .= "CDEF:real1=var1,1000,* " ;
$def[1] .= "CDEF:real2=var2,1000,* " ;
$def[1] .= "LINE1:real1#003300:\"in  \" " ;
$def[1] .= "GPRINT:real1:LAST:\"%7.2lf %S$UNIT[1] last\" " ;
$def[1] .= "GPRINT:real1:AVERAGE:\"%7.2lf %S$UNIT[1] avg\" " ;
$def[1] .= "GPRINT:real1:MAX:\"%7.2lf %S$UNIT[1] max\\n\" " ;
$def[1] .= "LINE1:real2#00ff00:\"out \" " ;
$def[1] .= "GPRINT:real2:LAST:\"%7.2lf %S$UNIT[1] last\" " ;
$def[1] .= "GPRINT:real2:AVERAGE:\"%7.2lf %S$UNIT[1] avg\" " ;
$def[1] .= "GPRINT:real2:MAX:\"%7.2lf %S$UNIT[1] max\\n\" ";
if($NAGIOS_TIMET != ""){
    $def[1] .= "VRULE:".$NAGIOS_TIMET."#000000:\"Last Service Check \\n\" ";
}
if($NAGIOS_LASTHOSTDOWN != ""){
    $def[1] .= "VRULE:".$NAGIOS_LASTHOSTDOWN."#FF0000:\"Last Host Down\\n\" ";
}
?>
If that doesn't work there is one more possible fix. Give that a try and let me know.
Thanks. I will give this a try today and see how it goes. Could you provide the other possible fix just in case this one does not work?

Malcz,
Do you have ARG4 set as M in the service?
Nagios XI
32 bit VM Image - 2011 R2.2
Malcz86
Posts: 27
Joined: Thu Mar 17, 2011 11:17 am

Re: Bandwidth graphs

Post by Malcz86 »

Yes, see attached screenshot. The first three should be showing MB/S and the last one should be KB/S. The first three have "M" set in ARG4 and I changed the 4th one to "K"
bwgraphs.jpg
You do not have the required permissions to view the files attached to this post.
NagiosXI 2011R1.9
CentOs 5.4
32bit
VMWare Image
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Bandwidth graphs

Post by ajwusv »

Nicholas,

I just commented out all of the old code for that file and then entered the new code. Now the bandwidth graphs arent even showing up and I just get the red X for an image not found.
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Bandwidth graphs

Post by nscott »

Ok,

Backup your /usr/local/nagios/libexec/process_perfdata.pl to /usr/local/nagios/libexec/process_perfdata.pl.bkp and replace the original with the attached file. Also go through and restore the php file had you edit earlier to its original state. Then restart Nagios.
You do not have the required permissions to view the files attached to this post.
Nicholas Scott
Former Nagios employee
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Bandwidth graphs

Post by ajwusv »

Nicholas,

The bandwidth graph is still missing. I made a backup of the check_xi_service_mrtgtraf.php file before I editted it. I will rename the current one and use the backup I made to see if that resolves it. Not sure what broke it.
Nagios XI
32 bit VM Image - 2011 R2.2
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Bandwidth graphs

Post by nscott »

Weird, yeah were you using the correct quote items? I get it confused all the time between # in sh and // in php. Either way, let me know how it comes out.
Nicholas Scott
Former Nagios employee
ajwusv
Posts: 28
Joined: Tue Jul 05, 2011 10:13 am

Re: Bandwidth graphs

Post by ajwusv »

i used # to comment out the lines based on the lines at the beginning of the php file.

I wonder if I have to change the owner and permissions on the new process_perfdata file since they do not match. I reverted back to the backup of the check_xi_service_mrtgtraf file that I had and the graphs came back but they are still reading in b/s :(
Nagios XI
32 bit VM Image - 2011 R2.2