https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:MRTG&feed=atom&action=historyTUT:MRTG - Revision history2024-03-29T11:51:57ZRevision history for this page on the wikiMediaWiki 1.26.3https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:MRTG&diff=4204&oldid=prevC.chapman: /* Monitoring CPU load */2010-03-08T16:22:43Z<p><span dir="auto"><span class="autocomment">Monitoring CPU load</span></span></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 16:22, 8 March 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l16" >Line 16:</td>
<td colspan="2" class="diff-lineno">Line 16:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Monitoring CPU load ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Monitoring CPU load ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>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 <del class="diffchange diffchange-inline">ang graoh aginst </del>each other<del class="diffchange diffchange-inline">, but it it </del>also possible to compute a combined value.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>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 <ins class="diffchange diffchange-inline">and graph against </ins>each other<ins class="diffchange diffchange-inline">.  It is </ins>also possible to compute a combined value.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== User vs Idle CPU usage ===</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== User vs Idle CPU usage ===</div></td></tr>
</table>C.chapmanhttps://net-snmp.sourceforge.io/wiki/index.php?title=TUT:MRTG&diff=3169&oldid=prevDts12: Wikification of HTML Tutorial page2007-10-31T15:44:30Z<p>Wikification of HTML Tutorial page</p>
<p><b>New page</b></p><div>Broadly speaking, there are two basic techniques for monitoring a system using SNMP.<br />
Either the agent can be configured to watch for certain values or events, and report<br />
to a management station when something significant happens.<br />
Alternatively, some external application can be set up that will poll the agent<br />
regularly, and collect the information of interest.<br />
<br />
The [[TUT:DisMan Monitoring|DisMan Monitoring]] page describes the first approach -<br />
this tutorial will concentrate on the second, using the [http://www.mrtg.org Multi Router Traffic Grapher]<br />
tool.<br />
<br />
Note that this does not attempt to be a complete tutorial on the use of MRTG,<br />
or even cover monitoring network traffic. Such topics are comprehensively<br />
covered on the MRTG site already. This page is specifically concerned with<br />
discussing other values that can be monitored using MRTG.<br />
<br />
== Monitoring CPU load ==<br />
<br />
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.<br />
<br />
=== User vs Idle CPU usage ===<br />
<br />
The MRTG configuration would look something like<br />
<br />
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt<br />
<br />
Target[kontor.cpu]:ssCpuRawUser.0&ssCpuRawIdle.0:public@10.10.11.2<br />
RouterUptime[kontor.cpu]: public@10.10.11.2<br />
MaxBytes[kontor.cpu]: 100<br />
Title[kontor.cpu]: CPU LOAD<br />
PageTop[kontor.cpu]: &lt;H1&gt;User CPU Load %&lt;/H1&gt;<br />
Unscaled[kontor.cpu]: ymwd<br />
ShortLegend[kontor.cpu]: %<br />
YLegend[kontor.cpu]: CPU Utilization<br />
Legend1[kontor.cpu]: User CPU in % (Load)<br />
Legend2[kontor.cpu]: Idle CPU in % (Load)<br />
Legend3[kontor.cpu]:<br />
Legend4[kontor.cpu]:<br />
LegendI[kontor.cpu]: User<br />
LegendO[kontor.cpu]: Idle<br />
Options[kontor.cpu]: growright,nopercent<br />
<br />
=== User vs System CPU usage ===<br />
<br />
The MRTG configuration would look something like<br />
<br />
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt<br />
<br />
Target[kontor.usrsys]:ssCpuRawUser.0&ssCpuRawSystem.0:public@10.10.11.2<br />
RouterUptime[kontor.usrsys]: public@10.10.11.2<br />
MaxBytes[kontor.usrsys]: 100<br />
Title[kontor.usrsys]: CPU LOAD<br />
PageTop[kontor.usrsys]: &lt;H1&gt;CPU (user and system) Load %&lt;/H1&gt;<br />
Unscaled[kontor.usrsys]: ymwd<br />
ShortLegend[kontor.usrsys]: %<br />
YLegend[kontor.usrsys]: CPU Utilization<br />
Legend1[kontor.usrsys]: User CPU in % (Load)<br />
Legend2[kontor.usrsys]: System CPU in % (Load)<br />
Legend3[kontor.usrsys]:<br />
Legend4[kontor.usrsys]:<br />
LegendI[kontor.usrsys]: User<br />
LegendO[kontor.usrsys]: System<br />
Options[kontor.usrsys]: growright,nopercent<br />
<br />
=== Active CPU usage ===<br />
<br />
This example sums User, System and Nice and plots it as a single value.<br />
<br />
The corresponding MRTG configuration is<br />
<br />
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt<br />
<br />
Target[kontor.cpusum]:ssCpuRawUser.0&ssCpuRawUser.0:public@10.10.11.2 + \<br />
ssCpuRawSystem.0&ssCpuRawSystem.0:public@10.10.11.2 + \<br />
ssCpuRawNice.0&ssCpuRawNice.0:public@10.10.11.2<br />
RouterUptime[kontor.cpusum]: public@10.10.11.2<br />
MaxBytes[kontor.cpusum]: 100<br />
Title[kontor.cpusum]: CPU LOAD<br />
PageTop[kontor.cpusum]: &lt;H1&gt;Active CPU Load %&lt;/H1&gt;<br />
Unscaled[kontor.cpusum]: ymwd<br />
ShortLegend[kontor.cpusum]: %<br />
YLegend[kontor.cpusum]: CPU Utilization<br />
Legend1[kontor.cpusum]: Active CPU in % (Load)<br />
Legend2[kontor.cpusum]:<br />
Legend3[kontor.cpusum]:<br />
Legend4[kontor.cpusum]:<br />
LegendI[kontor.cpusum]: Active<br />
LegendO[kontor.cpusum]:<br />
Options[kontor.cpusum]: growright,nopercent<br />
<br />
== Monitoring Disk space ==<br />
<br />
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<br />
<br />
On the system I used for these examples, I have the following disks: <br />
<br />
$ df<br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/hda6 289M 56M 218M 21% /<br />
/dev/hda1 7.3G 3.2G 4.1G 44% /mnt/windows<br />
/dev/hda7 1.7G 1.2G 429M 74% /usr<br />
/dev/hdc1 19G 6.7G 11G 37% /space<br />
<br />
<br />
and I have put the following lines into snmpd.conf:<br />
<br />
disk / 100000<br />
disk /usr 100000<br />
disk /space 100000<br />
<br />
=== Monitoring dskTable ===<br />
<br />
This plots the usage of the root and /usr partitions in one graph<br />
<br />
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt<br />
<br />
Target[kontor.root]:dskPercent.1&dskPercent.2:public@10.10.11.2<br />
RouterUptime[kontor.root]: public@10.10.11.2<br />
MaxBytes[kontor.root]: 100<br />
Title[kontor.root]: DISK USAGE<br />
PageTop[kontor.root]: &lt;H1&gt;DISK / and /usr Usage %&lt;/H1&gt;<br />
Unscaled[kontor.root]: ymwd<br />
ShortLegend[kontor.root]: %<br />
YLegend[kontor.root]: DISK Utilization<br />
Legend1[kontor.root]: Root disk<br />
Legend2[kontor.root]: /usr disk<br />
Legend3[kontor.root]:<br />
Legend4[kontor.root]:<br />
LegendI[kontor.root]: Root disk<br />
LegendO[kontor.root]: /usr disk<br />
Options[kontor.root]: growright,gauge,nopercent<br />
<br />
=== Monitoring hrStorageTable ===<br />
<br />
This plots the partition size as one value, and the used space as another.<br />
<br />
Note: the values returned here are in units of hrStorageUnits, which, dependent on the file system type, may or may not be 1K.<br />
<br />
LoadMIBs: /usr/local/share/snmp/mibs/HOST-RESOURCES-MIB.txt<br />
<br />
Target[kontor.hrroot]:hrStorageSize.1&hrStorageUsed.1:public@10.10.11.2<br />
RouterUptime[kontor.hrroot]: public@10.10.11.2<br />
MaxBytes[kontor.hrroot]: 300000<br />
Title[kontor.hrroot]: DISK / USAGE<br />
PageTop[kontor.hrroot]: &lt;H1&gt;DISK / Usage&lt;/H1&gt;<br />
ShortLegend[kontor.hrroot]: B<br />
kMG[kontor.hrroot]: k,M,G,T,P<br />
kilo[kontor.hrroot]: 1024<br />
YLegend[kontor.hrroot]: DISK / Utilization<br />
Legend1[kontor.hrroot]: Root disk size<br />
Legend2[kontor.hrroot]: Root disk usage<br />
Legend3[kontor.hrroot]:<br />
Legend4[kontor.hrroot]:<br />
LegendI[kontor.hrroot]: Root disk size<br />
LegendO[kontor.hrroot]: Root disk usage<br />
Options[kontor.hrroot]: growright,gauge,nopercent<br />
<br />
== Other Monitoring Examples ==<br />
<br />
Two further examples that have been offered:<br />
<br />
=== Monitoring TCP connections ===<br />
<br />
Target[tcpopen]: <br />
.1.3.6.1.2.1.6.9.0&.1.3.6.1.2.1.6.9.0:public@localhost <br />
Options[tcpopen]: nopercent,growright,gauge,noinfo <br />
Title[tcpopen]: Open TCP connections <br />
PageTop[tcpopen]: Open TCP connections<br />
MaxBytes[tcpopen]: 1000000 <br />
YLegend[tcpopen]: # conns <br />
ShortLegend[tcpopen]: connections <br />
LegendI[tcpopen]: Connections: <br />
LegendO[tcpopen]: <br />
Legend1[tcpopen]: Open TCP connections <br />
<br />
=== Monitoring Free Memory ===<br />
<br />
Target[freemem]: <br />
.1.3.6.1.4.1.2021.4.11.0&.1.3.6.1.4.1.2021.4.11.0:public@localhost <br />
Options[freemem]: nopercent,growright,gauge,noinfo <br />
Title[freemem]: Free Memory <br />
PageTop[freemem]: Free Memory<br />
MaxBytes[freemem]: 1000000 <br />
kMG[freemem]: k,M,G,T,P,X <br />
YLegend[freemem]: bytes <br />
ShortLegend[freemem]: bytes <br />
LegendI[freemem]: Free Memory: <br />
LegendO[freemem]: <br />
Legend1[freemem]: Free memory, not including swap, in bytes<br />
<br />
<hr><br />
<br />
{{TUT:LIST}}</div>Dts12