NMS MRTG

MRTG setup for WISP network elements.

All examples use "public" as placeholder for corresponding SMNP community string.

crontab

# RRD data archiver
#55 23 * * * /usr/local/bin/rrd-archive.pl >/dev/null 2>&1

# MRTG data collection routines
*/5 * * * * /usr/bin/perl /usr/local/mrtg-2/bin/mrtg /Library/WebServer/mrtg/cfg/wisp.cfg --logging /var/log/mrtg.log >/dev/null 2>&1

Master Config File (wisp.cfg)

###############################################################################
# System:      NMS
# Description: WISP Broadband MRTG master config file 
# Contact:     Nigel Bruin
# Location: 
###############################################################################

###############################################################################
#
# Global Defaults
#
HtmlDir:       /Library/WebServer/mrtg/logs
ImageDir:      /Library/WebServer/mrtg/images
IconDir:       /mrtg/images/
LogDir:        /Library/WebServer/mrtg/logs

LogFormat:     rrdtool
RRDRowCount[_]: 5000
PathAdd:       /usr/local/rrdtool-1.2.12/bin/

ConversionCode: /usr/local/mrtg-2/bin/MyConversions.pl

#timeout                   => $default_timeout,
#retries                   => $default_retries,
#backoff                   => $default_backoff,
#default_max_repetitions   => $max_repetitions,
#use_16bit_request_ids     => 1,
#lenient_source_port_matching => 0,
#lenient_source_address_matching => 1
SnmpOptions:   timeout => 2, retries => 1

Options[_]:    bits, growright
Kilo[_]:       1024
XSize[_]:      600
NoMib2:        Yes
#SingleRequest: Yes

Include: Cisco.cfg
Include: Cyclone.cfg
Include: Baystack.cfg
Include: Gemini.cfg
Include: Trango.cfg
Include: WRN1WRM2.cfg
Include: AP-WRN1.cfg
Include: AP-WRN2.cfg
Include: AP-WRM1.cfg
Include: AP-WRM2.cfg
Include: AP-ICK1.cfg
Include: AP-ICK2.cfg
Include: NMS.cfg
Include: UPS1.cfg
Include: UPS2.cfg
Include: UPS3.cfg
Include: UPS4.cfg
Include: UPS5.cfg
Include: SB.cfg

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Conversions Script (/usr/local/mrtg-2/bin/MyConversions.pl)

#########################################################################
#
# WISP mrtg SNMP conversions routines
#
# Nigel Bruin, 2006
#

#########################################################################
#
# Convert APC UPS RunTime (Timeticks) to INTEGER in minutes
#
# Input string is of the form "1:02:00.00" or "1:02:00"
# i.e.  hh:mm:ss.nn
#
sub Runtime2Int {
  my $value = shift;
  if (defined($value)) 
    {
    $value =~ s/(\d*):(\d*):\d*.\d*/int(($1 * 60)+$2)/e;
    $value =~ s/(\d*):(\d*):\d*/int(($1 * 60)+$2)/e;
    };
  return $value;
}

#########################################################################
#
# Scale Trango RSSI (add 100)
#
# Trango returns powers as negative dBm in teh range -99 to -40 or so.
# Add 100 to shift scale into the positive.
#
sub TrangoScaleRSSI {
  my $value = shift;
  if (defined($value)) { $value += 100 };
  return $value;
}

#########################################################################
#
# Scale APC UPS voltage (subtract 180)
#
sub APCscaleVolts {
  my $value = shift;
  if (defined($value)) { $value -= 180 };
  return $value;
}

#########################################################################
#
# Scale APC UPS frequency (subtract 45)
#
sub APCscaleHertz {
  my $value = shift;
  if (defined($value)) { $value -= 45 };
  return $value;
}

#########################################################################
#
# Scale APC UPS Output load (percentage -> Watts) for 1000kVA rating
#
sub APCscaleLoad1000 {
  my $value = shift;
  if (defined($value)) { $value *= 10 };
  return $value;
}

#########################################################################
#
# Scale APC UPS Output load (percentage -> Watts) for 1400kVA rating
#
sub APCscaleLoad1400 {
  my $value = shift;
  if (defined($value)) { $value *= 14 };
  return $value;
}

#########################################################################

RRDtool

Setup is straight-forward, e.g. key changes in routers2.conf:

dbpath = /Library/WebServer/mrtg/logs

graphpath = /Library/WebServer/mrtg/stats

graphurl = /mrtg/stats

confpath = /Library/WebServer/mrtg/cfg

cfgfiles = *.cfg

iconurl = /mrtg/rrdicons/

defaulttarget = interface

graphstyle = big

usebigk = no

sorder = t n n2 l l2 x x2

archive = yes

showfindbox = yes