<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'>I have accomplished this by using Mr. Shipway's cfgmaker template 'generic-host.htp'.&nbsp; That has given me the OIDs of basically everything I need for vital system resources...even for my network printer!&nbsp; I would highly recommend that method for anyone that doesn't know much about OIDs/SNMP/MIBs or anyone that is getting errors with SNMP strings and would like to go straight to the OIDs.<br><br>----- Original Message -----<br>From: "Steve Shipway" &lt;s.shipway@auckland.ac.nz&gt;<br>To: "mrtg" &lt;mrtg@lists.oetiker.ch&gt;<br>Sent: Sunday, September 27, 2009 4:36:09 PM GMT -06:00 US/Canada Central<br>Subject: [mrtg] FW: &nbsp;Monitoring Load<br><br>




<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>



<div class="Section1">

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Three ways to do the same thing, with 3
solutions!&nbsp; (1) is if the problem is the string conversion, (2) is for if
the problem is the MIB symbolic name, and (3) is if the problem is it not being
an integer.&nbsp; To be honest though I think (2) or possible (2)+(3) is the
way to go, but I had to include (1) as it is so pretty </span></font><font color="navy" face="Wingdings" size="2"><span style="font-size: 10pt; font-family: Wingdings; color: navy;">J</span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">1. Your device is outputting the laLoad
variable as a string rather than as an integer.&nbsp; You may need to set up a
Conversion Code definition with the fromstring() function to convert it to a
real number.</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">In the cfg file, put a line:</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="black" face="Courier New" size="3"><span style="font-size: 12pt; font-family: &quot;Courier New&quot;; color: black;">ConversionCode:
/usr/local/mrtg/etc/conversoincode.pl</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">(you might need to put a different path
for your script, of course).&nbsp; Then, in the conversioncode.pl file, put the
text:</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="black" face="Courier New" size="3"><span style="font-size: 12pt; font-family: &quot;Courier New&quot;; color: black;">sub fromstring()
{my $v = shift; if($v =~ /(\d+\.?\d*)/) { return $1; } else { return 0; } }</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Finally, your Target definition should add
‘|fromstring’</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="black" face="Courier New" size="3"><span style="font-size: 12pt; font-family: &quot;Courier New&quot;; color: black;">Target[server.wherever_load]:
&nbsp;laLoad.3&amp;laLoad.3:public@server.wherever|fromstring</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Having said all of this, though, I would
have expected Perl to Do The Right Thing when confronted with a string
containing just a number.&nbsp; I don’t see why this bit should be
necessary.</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">2. Another possibility is that MRTG simply
doesn’t know about the symbolic laLoad name whereas snmpwalk does.&nbsp;
In this case you’ll need ot tell MRTG about the MIB.</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="black" face="Courier New" size="3"><span style="font-size: 12pt; font-family: &quot;Courier New&quot;; color: black;">LoadMIBs:
/usr/share/snmp/mibs/UCD-SNMP-MIB.txt</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">3. A third possibility is to try using
laLoadInt instead.&nbsp; This is definitely a number, but multipled by
100.&nbsp; You need to divide it in the Target definition:</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="black" face="Courier New" size="3"><span style="font-size: 12pt; font-family: &quot;Courier New&quot;; color: black;">Target[server.wherever_load]:
&nbsp;laLoadInt.3&amp;laLoadInt.3:public@server.wherever / 100</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Note that the spaces are significant in
this definition.&nbsp; </span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Steve</span></font></p>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 4pt;">

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-US">

<hr align="center" size="2" width="100%">

</span></font></div>

<p class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;" lang="EN-US">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;" lang="EN-US">
mrtg-bounces@lists.oetiker.ch
[mailto:mrtg-bounces@lists.oetiker.ch]
<b><span style="font-weight: bold;">On Behalf Of </span></b>Matt Baer<br>
<b><span style="font-weight: bold;">Sent:</span></b> Monday, 28 September 2009
6:21 a.m.<br>
<b><span style="font-weight: bold;">To:</span></b> mrtg<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [mrtg] Monitoring Load</span></font><span lang="EN-US"></span></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p class="MsoNormal"><font color="black" face="Arial" size="3"><span style="font-size: 12pt; font-family: Arial; color: black;">Direct copy and paste output of that
command:<br>
<br>
UCD-SNMP-MIB::laIndex.1 = INTEGER: 1<br>
UCD-SNMP-MIB::laIndex.2 = INTEGER: 2<br>
UCD-SNMP-MIB::laIndex.3 = INTEGER: 3<br>
UCD-SNMP-MIB::laNames.1 = STRING: Load-1<br>
UCD-SNMP-MIB::laNames.2 = STRING: Load-5<br>
UCD-SNMP-MIB::laNames.3 = STRING: Load-15<br>
UCD-SNMP-MIB::laLoad.1 = STRING: 0.57<br>
UCD-SNMP-MIB::laLoad.2 = STRING: 0.42<br>
UCD-SNMP-MIB::laLoad.3 = STRING: 0.36<br>
UCD-SNMP-MIB::laConfig.1 = STRING: 12.00<br>
UCD-SNMP-MIB::laConfig.2 = STRING: 12.00<br>
UCD-SNMP-MIB::laConfig.3 = STRING: 12.00<br>
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 56<br>
UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 41<br>
UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 35<br>
UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.570000<br>
UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.420000<br>
UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.360000<br>
UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: noError(0)<br>
UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: noError(0)<br>
UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: noError(0)<br>
UCD-SNMP-MIB::laErrMessage.1 = STRING: <br>
UCD-SNMP-MIB::laErrMessage.2 = STRING: <br>
UCD-SNMP-MIB::laErrMessage.3 = STRING:<br>
<br>
<br>
</span></font></p>

</div>

</div>

</div>

<br>_______________________________________________
mrtg mailing list
mrtg@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
</div></body></html>