Page 1 of 3

Bandwidth Graphs

Posted: Tue Jul 26, 2011 3:15 pm
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.

Re: Bandwidth Graphs

Posted: Tue Jul 26, 2011 5:14 pm
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.

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 4:13 am
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?

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 8:17 am
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?

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 8:35 am
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

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 8:53 am
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.

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 1:00 pm
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.

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 2:15 pm
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.

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 3:10 pm
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.

Re: Bandwidth Graphs

Posted: Wed Jul 27, 2011 3:26 pm
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 :(