SNMP Reports How-To

标签: integer interface graph command properties file
1396人阅读 评论(0) 收藏 举报


From OpenNMS

This guide asumes that you know how to play with RRDTOOL and that you are somewhat familiar with OpenNMS. All the examples presented here were tested on Redhat Linux 7.3, version 1.0 of OpenNMS with Net-SNMP 4.2.3 agents running on the managed stations.

I tried to be as accurate as possible, so read this material at your own risk.


Jose Vicente Nunez Zuleta (
Newbreak LLC System Administrator
Newbreak LLC



Capture the appropiate data using SNMP (edit datacollection-config.xml)

You will need to define the OIDs you want to capture in the file datacollection-config.xml file. In our example we want to capture the following Net-SNMP OIDs (memory, host uptime and interface traffic):

 <!-- Net-SNMP memory stats, --> 
 <group name="ucd-memory" ifType="ignore">
 <!-- Total Swap Size configured for the host. -->
 <mibObj oid="." instance="0" alias="memTotalSwap" type="integer" />   
 <!-- Available Swap Space on the host. --> 
 <mibObj oid="." instance="0" alias="memAvailSwap" type="integer" />   
 <!-- Total Real/Physical Memory Size on the host. -->
 <mibObj oid="." instance="0" alias="memTotalReal" type="integer" />  
 <!-- Available Real/Physical Memory Space on the host. -->
 <mibObj oid="." instance="0" alias="memAvailReal" type="integer" />  
 <!-- Error flag.  1 indicates very little swap space left -->
 <mibObj oid="." instance="0" alias="memSwapError" type="integer" />

 <!-- Net-SNMP system stats, -->
 <group name="ucd-systemStats" ifType="ignore">
 <!-- Amount of memory swapped to disk (kB/s). -->
 <mibObj oid="." instance="0" alias="ssSwapOut" type="integer" />  
 <!-- percentages of user CPU time. -->
 <mibObj oid="." instance="0" alias="ssCpuUser" type="integer" />  
 <!-- percentages of user CPU system. -->
 <mibObj oid="." instance="0" alias="ssCpuSystem" type="integer" / 
 > <!-- percentages of user CPU idle. -->
 <mibObj oid="." instance="0" alias="ssCpuIdle" type="integer" /> 

 <group  name = "mib2-interfaces-net-snmp" ifType = "all">
 <mibObj oid="." instance="ifIndex" alias="ifInOctets"    type="counter"/ >
 <mibObj oid="." instance="ifIndex" alias="ifInUcastPkts" type="counter"/ >
 <mibObj oid="." instance="ifIndex" alias="ifInNUcastPkts" type="counter"/>
 <mibObj oid="." instance="ifIndex" alias="ifInErrors"    type="counter"/>
 <mibObj oid="." instance="ifIndex" alias="ifOutOctets"   type="counter"/>
 <mibObj oid="." instance="ifIndex" alias="ifOutDiscards" type="counter"/>
 <mibObj oid="." instance="ifIndex" alias="ifOutErrors"   type="counter"/>

Then make sure your OIDs make it into the "systemDef" tag:

 <systemDef name = "Net-SNMP">
 <!-- <sysoidMask>.</sysoidMask> -->

Please note than if a given OID cannot be retrieved (for example the SNMP agent doesn't support it) then the RRDtool file is not created (normally stored in /var/opennms/rrd/snmp/)

Additional notes
Make sure <sysoidMask> matches your systems oid or else it will not find it.

$ snmpget -v2c -On -c <community> <host> sysObjectID.0
. = OID: .

would give you:


Edit the snmp graphic properties (file

Check your RRDTOOL files

You need to define your custom graphics as follow:

choose the name you will use for the "reports" property
which rrdtool files you will use in your graphic
use 'interface' if the stat is related with each network interface, use 'node' if affects the whole node.

NOTE: Beginning with version 1.3.2 the types are interfaceSnmp and nodeSnmp instead of interface and node.

database values, currently only ifSpeed
This is the command line you pass to rrdtool. Actualy rrdtool is called by a servlet, so you can test your graphics before adding them to this file.

One way to know wich datasources exist on your rddtool file (used in the DEF part of the rrdtool command line) is to get the information from the rrdtool file like this:

[root@lnxdev0001 16]# rrdtool info hrSystemUptime.rrd
filename = "hrSystemUptime.rrd"
rrd_version = "0001"
step = 300
last_update = 1026942859
ds[hrSystemUptime].type = "GAUGE"
ds[hrSystemUptime].minimal_heartbeat = 600
ds[hrSystemUptime].min = NaN
ds[hrSystemUptime].max = NaN
ds[hrSystemUptime].last_ds = "UNKN"
ds[hrSystemUptime].value = 2.0296406018e+10
ds[hrSystemUptime].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 8928
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 8784
rra[1].pdp_per_row = 12
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 7.8203629928e+08
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "MIN"
rra[2].rows = 8784
rra[2].pdp_per_row = 12
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 7.8068611333e+07
rra[2].cdp_prep[0].unknown_datapoints = 0
rra[3].cf = "MAX"
rra[3].rows = 8784
rra[3].pdp_per_row = 12
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = 7.8338616000e+07
rra[3].cdp_prep[0].unknown_datapoints = 0

As you can see, the ds is 'hrSystemUptime'

If for some reason one of the rrdtool files that are part of a graphic definition is missing, then the graphic doesn't show up at all in the web console.

Remember than you can always check the contents of a rrdtool file typing:

rrdtool dump hrSystemUptime.rrd (shows a huge amount of data).

Add your graphic definitions

You can always check if the graphics you want to plot are accurate by running the rrdtool command line; Here is an example to graph the host uptime by hand:

 rrdtool graph uptime.png --title "Host uptime" --vertical-label /
 Days "DEF:timeticks=hrSystemUptime.rrd:hrSystemUptime:AVERAGE" /
 "CDEF:days=timeticks,8640000,/" AREA:days#FF0000:"Days" /
 GPRINT:days:AVERAGE:"Avg  //: %8.1lf %s" GPRINT:days:MIN:"Min  //: %8.1lf %s" /
 GPRINT:days:MAX:"Max  //: %8.1lf %s"

As you can see in the next lines, you will "copy and paste" part of this line in the graphic definition.

Here is the graphic configuration to caputure the host uptime, memory ussage and link accuracy, file

#### Newbreak LLC Custom reports. Jose Vicente Nunez Zuleta ( #####
# Be very carefull with trailing spaces, otherwise you can get problems with the graphics!!!

# Get the Uptime if the host uses Net-SNMP ( To get the graphic manually:
report.netsnmp.uptime.command=--title "Host uptime" /
  --vertical-label Days /
  DEF:timeticks={rrd1}:hrSystemUptime:AVERAGE /
  CDEF:days=timeticks,8640000,/ /
  AREA:days#FF0000:"Days" /
  GPRINT:days:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:days:MIN:"Min  //: %8.1lf %s" /
  GPRINT:days:MAX:"Max  //: %8.1lf %s" /

# Get the Memory statistics if the host uses Net-SNMP (
report.netsnmp.memory.command=--title "Host memory usage" /
  --vertical-label bytes /
  DEF:mtotalSwap={rrd1}:memTotalSwap:AVERAGE /
  DEF:mavailSwap={rrd2}:memAvailSwap:AVERAGE /
  DEF:mtotalReal={rrd3}:memTotalReal:AVERAGE /
  DEF:mavailReal={rrd4}:memAvailReal:AVERAGE /
  CDEF:totalSwap=mtotalSwap,1024,* /
  CDEF:availSwap=mavailSwap,1024,* /
  CDEF:totalReal=mtotalReal,1024,* /
  CDEF:availReal=mavailReal,1024,* /
  LINE3:totalSwap#FF0000:"Total swap" /
  LINE1:availSwap#00FF00:"Available swap" /
  LINE3:totalReal#0000FF:"Total real" /
  LINE1:availReal#000000:"Available real" /
  GPRINT:totalSwap:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:totalSwap:MIN:"Min  //: %8.1lf %s" /
  GPRINT:totalSwap:MAX:"Max  //: %8.1lf %s" /
  GPRINT:availSwap:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:availSwap:MIN:"Min  //: %8.1lf %s" /
  GPRINT:availSwap:MAX:"Max  //: %8.1lf %s" /
  GPRINT:totalReal:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:totalReal:MIN:"Min  //: %8.1lf %s" /
  GPRINT:totalReal:MAX:"Max  //: %8.1lf %s" /
  GPRINT:availReal:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:availReal:MIN:"Min  //: %8.1lf %s" /
  GPRINT:availReal:MAX:"Max  //: %8.1lf %s" /

# Calculate the network accuracy using SNMP (
# Check the following man pages for more info on rrdtool graph:
# - rrdgraph_graph
# - rrdgraph
# - rrdgraph_examples
# Also if you forgot anbout the RPN notation (like me :) ) then go to:
# -
# Use CDEF to calculate this expression:
# accuracy = 100 - ( (DifInErr*100) / (DifInUcast + DifInNUcast) )
# In my case, Net-SNMP doesn't show up the ifInNUcastPkts OID on Linux (Solaris works fine)
# but the ammount of traffic is very low, so even taking out that value the estimate is good.
report.netsnmp.accuracy.command=--title "Link accuracy" /
  DEF:error={rrd1}:ifInErrors:AVERAGE /
  DEF:ucast={rrd2}:ifInUcastPkts:AVERAGE /
  CDEF:accuracy=100,error,100,*,ucast,/,- /
  LINE2:accuracy#FF0000:"% Accuracy" /
  GPRINT:accuracy:AVERAGE:"Avg  //: %8.1lf %s" /
  GPRINT:accuracy:MIN:"Min  //: %8.1lf %s" /
  GPRINT:accuracy:MAX:"Max  //: %8.1lf %s" /

# If you are sure than all your machines have information about multicast traffic, then:
# DEF:nucast={rrd3}:ifInNUcastPkts:AVERAGE /
# CDEF:accuracy=100,error,100,*,ucast,nucast,+,/,- /

Add New Reports to the reports Property

Finally, don't forget to add the reports into the value of the reports property.

#report keys, list ALL prefab reports here!
reports=traffic, octets, errors, discards, avgbusy5, freemem, /
  bufferfails, kerneltasks, kernelmem, /
  cpuPercentBusy, /
  novell.numberOfNLMsLoaded, novell.openFiles, novell.licensedConnections, /
  memory, /
  novell.codeDataMemory, novell.cacheBuffers, /
  novell.diskSpaceSys, novell.diskSpaceVol2, /
  winnt2k.diskSpaceC, winnt2k.diskSpaceD, /
  checkpoint.pktsAccepted, checkpoint.pktsRejected, /
  checkpoint.pktsDropped, checkpoint.pktsLogged, /
  loadavg, netsnmp.uptime, netsnmp.memory, netsnmp.accuracy /

Our reports are netsnmp.uptime, netsnmp.memory, netsnmp.accuracy on the last line. If you miss this step, you will get web exceptions when attempting to run performance reports. The exceptions will look something like the following:

Missing Parameter

The request you made was incomplete. It was missing the  report parameter.

The following parameters are required:

Restart OpenNMS

/etc/init.d/opennms restart
/etc/init.d/tomcat4 restart

Probably you will have to wait a couple of minutes before you get useful data to display.


Tutorial on how to use the RPN notation:

Check the following man pages for more info on rrdtool graph:


SNMP Informant How-To

转自 OpenNMSPeople using OpenNMS often wonde...
  • cnhome
  • cnhome
  • 2007年09月19日 18:53
  • 3231

Tomcat 5.5-Manager App HOW-TO(翻译了部份,努力中...)

  • fenglibing
  • fenglibing
  • 2007年02月07日 12:55
  • 8996

Linux 串口编程 中英文简体对照 1.0 版 Serial Programming HOWTO

Serial Programming HOWTO Linux 串口编程   中英文简体对照 1.0 版   翻译: Carol Li 原作:Gary Frerking        gary@...
  • CyberLabs
  • CyberLabs
  • 2011年10月31日 08:19
  • 2074

[转]Crystal Reports basic for Visual Studio 2008部署

本文转自: 原作者:红着眼的狼近日帮朋友写了一个基于Web的小程序,其中...
  • babyt
  • babyt
  • 2008年02月19日 15:03
  • 3000

Crystal Reports 产品家族

目录:一、Crystal Reports 9二、Crystal Analysis Professional三、Crystal Enterprise 9四、Crystal Enterprise For ...
  • haibodotnet
  • haibodotnet
  • 2004年01月02日 19:44
  • 4312

Crystal Reports Runtime Packages----businessobjects

Crystal Reports Runtime Packages 转至:
  • lJean
  • lJean
  • 2011年06月03日 13:34
  • 7354

Eclipse出现updating error reports database Sleeping问题

Eclipse出现updating error reports database Sleeping问题
  • qq_33547950
  • qq_33547950
  • 2017年05月12日 17:14
  • 2259

Crystal Reports for Eclipse(1)

Crystal Reports for Eclipse(1) Crystal Reports for Eclipse(1)1、介绍Crystal Reports for Eclipse用于和数据库共同...
  • chszs
  • chszs
  • 2007年02月14日 17:42
  • 3974

Crystal Reports basic for Visual Studio 2008部署包

  vs2008自带的水晶报表是10.5版的,部署包位置 在C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bootstrapper/Packages 目录...
  • xiaoK
  • xiaoK
  • 2008年09月10日 10:09
  • 6282


key: B6W60-01CS200-000G970-0YA1
  • lubosun
  • lubosun
  • 2006年03月30日 11:32
  • 1210
    访问量: 79万+
    积分: 1万+
    排名: 2077