Show index.html syntax highlighted
<!--#set var="section" value="tutorial" -->
<!--#include virtual="/page-top.html" -->
<!-- CONTENT START -->
<center><h1>NET-SNMP Tutorial -- MRTG</h1></center>
<hr>
<p>
This page will present a few ideas of what you can monitor on your
hosts with the net-snmp using the <a href="http://www.mrtg.org">mrtg</a>
utility.
<p>
This is <i>not</i> an MRTG tutorial, and it is <i>not</i>
going to talk about monitoring network traffic.
<p>
Note, that these examples uses values that are only available from
net-snmp-4.2 or above and that the LoadMIBs mrtg directive requires mrtg-2.8.0.
<p>
<h2>Monitoring CPU load</h2>
<p>
There are several ways to try to monitor CPU usage, because the system
maintains several CPU counters: Idle, System, User, Nice.
As MRTG does not allow you to graph more than two values at a time,
it is possible to select any two values ang graoh aginst each other,
but it it also possible to compute a combined value.
<a name="cpu.html">
<h3>User vs Idle CPU usage</h3>
An example of such a graph is <a href="kontor.cpu.html">here</a>.
<p>
The corresponding MRTG configuration is
<pre>
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[kontor.cpu]:ssCpuRawUser.0&ssCpuRawIdle.0:public@10.10.11.2
RouterUptime[kontor.cpu]: public@10.10.11.2
MaxBytes[kontor.cpu]: 100
Title[kontor.cpu]: CPU LOAD
PageTop[kontor.cpu]: <H1>User CPU Load %</H1>
Unscaled[kontor.cpu]: ymwd
ShortLegend[kontor.cpu]: %
YLegend[kontor.cpu]: CPU Utilization
Legend1[kontor.cpu]: User CPU in % (Load)
Legend2[kontor.cpu]: Idle CPU in % (Load)
Legend3[kontor.cpu]:
Legend4[kontor.cpu]:
LegendI[kontor.cpu]: User
LegendO[kontor.cpu]: Idle
Options[kontor.cpu]: growright,nopercent
</pre>
<a name="usrsys.html">
<h3>User vs System CPU usage</h3>
An example of such a graph is <a href="kontor.usrsys.html">here</a>.
<p>
The corresponding MRTG configuration is
<pre>
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[kontor.usrsys]:ssCpuRawUser.0&ssCpuRawSystem.0:public@10.10.11.2
RouterUptime[kontor.usrsys]: public@10.10.11.2
MaxBytes[kontor.usrsys]: 100
Title[kontor.usrsys]: CPU LOAD
PageTop[kontor.usrsys]: <H1>CPU (user and system) Load %</H1>
Unscaled[kontor.usrsys]: ymwd
ShortLegend[kontor.usrsys]: %
YLegend[kontor.usrsys]: CPU Utilization
Legend1[kontor.usrsys]: User CPU in % (Load)
Legend2[kontor.usrsys]: System CPU in % (Load)
Legend3[kontor.usrsys]:
Legend4[kontor.usrsys]:
LegendI[kontor.usrsys]: User
LegendO[kontor.usrsys]: System
Options[kontor.usrsys]: growright,nopercent
</pre>
<a name="cpusum.html">
<h3>Active CPU usage</h3>
An example of such a graph is <a href="kontor.cpusum.html">here</a>.
This example sums User, System and Nice and plots it as a single value.
<p>
The corresponding MRTG configuration is
<pre>
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[kontor.cpusum]:ssCpuRawUser.0&ssCpuRawUser.0:public@10.10.11.2 + ssCpuRawSystem.0&ssCpuRawSystem.0:public@10.10.11.2 + ssCpuRawNice.0&ssCpuRawNice.0:public@10.10.11.2
RouterUptime[kontor.cpusum]: public@10.10.11.2
MaxBytes[kontor.cpusum]: 100
Title[kontor.cpusum]: CPU LOAD
PageTop[kontor.cpusum]: <H1>Active CPU Load %</H1>
Unscaled[kontor.cpusum]: ymwd
ShortLegend[kontor.cpusum]: %
YLegend[kontor.cpusum]: CPU Utilization
Legend1[kontor.cpusum]: Active CPU in % (Load)
Legend2[kontor.cpusum]:
Legend3[kontor.cpusum]:
Legend4[kontor.cpusum]:
LegendI[kontor.cpusum]: Active
LegendO[kontor.cpusum]:
Options[kontor.cpusum]: growright,nopercent
</pre>
<h2>Monitoring DISK space</h2>
<p>
There are two tables that can be used when monitoring disk space,
UCD-SNMP-MIB:dskTable and HOST-RESOURCES-MIB:hrStorageTable.
There are two noticeable differences bwtween these tables:
UCD-SNMP-MIB:dskTable requires a configuration directive in snmpd.conf,
but it also gives a direct measure of the percentage of free space
<p>
On the system I used for these examples, I have the following disks:
<pre>
$ df
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 289M 56M 218M 21% /
/dev/hda1 7.3G 3.2G 4.1G 44% /mnt/windows
/dev/hda7 1.7G 1.2G 429M 74% /usr
/dev/hdc1 19G 6.7G 11G 37% /space
</pre>
and I have put the following lines into snmpd.conf:
<pre>
disk / 100000
disk /usr 100000
disk /space 100000
</pre>
<a name="root.html">
<h3>Monitoring from dskTable</h3>
I used the direct percentage of disk full for the root and /usr
partitions in <a href="kontor.root.html">this example</a>
It plot the usage of the root and the /usr partitions in one graph.
<pre>
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[kontor.root]:dskPercent.1&dskPercent.2:public@10.10.11.2
RouterUptime[kontor.root]: public@10.10.11.2
MaxBytes[kontor.root]: 100
Title[kontor.root]: DISK USAGE
PageTop[kontor.root]: <H1>DISK / and /usr Usage %</H1>
Unscaled[kontor.root]: ymwd
ShortLegend[kontor.root]: %
YLegend[kontor.root]: DISK Utilization
Legend1[kontor.root]: Root disk
Legend2[kontor.root]: /usr disk
Legend3[kontor.root]:
Legend4[kontor.root]:
LegendI[kontor.root]: Root disk
LegendO[kontor.root]: /usr disk
Options[kontor.root]: growright,gauge,nopercent
</pre>
<a name="kontor.hrroot">
<h3>Monitoring from hrStorageTable</h3>
Use of hrStorageTable requires no preceding configuration, as in
<a href="kontor.hrroot.html">this example</a>
It plot the partition size as one value, and the used space as another.
<b>Note:</b>the values returned here are in units of hrStorageUnits, which,
dependent on the file system type, may or may not be 1K.
<pre>
LoadMIBs: /usr/local/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[kontor.hrroot]:hrStorageSize.1&hrStorageUsed.1:public@10.10.11.2
RouterUptime[kontor.hrroot]: public@10.10.11.2
MaxBytes[kontor.hrroot]: 300000
Title[kontor.hrroot]: DISK / USAGE
PageTop[kontor.hrroot]: <H1>DISK / Usage</H1>
ShortLegend[kontor.hrroot]: B
kMG[kontor.hrroot]: k,M,G,T,P
kilo[kontor.hrroot]: 1024
YLegend[kontor.hrroot]: DISK / Utilization
Legend1[kontor.hrroot]: Root disk size
Legend2[kontor.hrroot]: Root disk usage
Legend3[kontor.hrroot]:
Legend4[kontor.hrroot]:
LegendI[kontor.hrroot]: Root disk size
LegendO[kontor.hrroot]: Root disk usage
Options[kontor.hrroot]: growright,gauge,nopercent
</pre>
<p>
Two further examples that have been offered:
<h3>Monitoring TCP connections</h3>
<p>
<pre>
Target[tcpopen]:
.1.3.6.1.2.1.6.9.0&.1.3.6.1.2.1.6.9.0:public@localhost
Options[tcpopen]: nopercent,growright,gauge,noinfo
Title[tcpopen]: Open TCP connections
PageTop[tcpopen]: Open TCP connections
MaxBytes[tcpopen]: 1000000
YLegend[tcpopen]: # conns
ShortLegend[tcpopen]: connections
LegendI[tcpopen]: Connections:
LegendO[tcpopen]:
Legend1[tcpopen]: Open TCP connections
</pre>
<p>
and
<h3>Monitoring Free Memory</h3>
<p>
<pre>
Target[freemem]:
.1.3.6.1.4.1.2021.4.11.0&.1.3.6.1.4.1.2021.4.11.0:public@localhost
Options[freemem]: nopercent,growright,gauge,noinfo
Title[freemem]: Free Memory
PageTop[freemem]: Free Memory
MaxBytes[freemem]: 1000000
kMG[freemem]: k,M,G,T,P,X
YLegend[freemem]: bytes
ShortLegend[freemem]: bytes
LegendI[freemem]: Free Memory:
LegendO[freemem]:
Legend1[freemem]: Free memory, not including swap, in bytes
</pre>
<a href="mrtgindex.html">The complete picture</a>
<!-- CONTENT END -->
<!--#include virtual="/page-bottom.html" -->
See more files for this project here
net-snmp provides tools and libraries relating to the Simple Network\r\nManagement Protocol including: An extensible agent, An SNMP library,\r\ntools to request or set information from SNMP agents, tools to\r\ngenerate and handle SNMP traps, etc.\r\n
Project homepage:
http://sourceforge.net/projects/net-snmp
Programming language(s): C,Perl,Shell Script
License: other
index.html
kontor.cpu-day.png
kontor.cpu-month.png
kontor.cpu-week.png
kontor.cpu-year.png
kontor.cpu.html
kontor.cpusum-day.png
kontor.cpusum-month.png
kontor.cpusum-week.png
kontor.cpusum-year.png
kontor.cpusum.html
kontor.hrroot-day.png
kontor.hrroot-month.png
kontor.hrroot-week.png
kontor.hrroot-year.png
kontor.hrroot.html
kontor.root-day.png
kontor.root-month.png
kontor.root-week.png
kontor.root-year.png
kontor.root.html
kontor.usrsys-day.png
kontor.usrsys-month.png
kontor.usrsys-week.png
kontor.usrsys-year.png
kontor.usrsys.html
mrtg-l.png
mrtg-m.png
mrtg-r.png
mrtgindex.html