You can add an executable to your snmpd.conf file to execute your snmpget locally, receive the output and modify it to your heart's content. To run executables:<div><br></div><div>-- On your nagios server:</div><div><path_to_plugins>/check_snmp -H <HOSTADDRESS> -C <your_snmp_community_string>  -o enterprises.ucdavis.extTable.extEntry.extResult.<###>,enterprises.ucdavis.extTable.extEntry.extOutput.<###> -w 0 -c 1</div>
<div><br></div><div>The variables you'll need to supply are:</div><div><HOSTADDRESS>  - The IP of the remote host</div><div><snmp_community_string> - Self-explanatory</div><div><###> - The number of the "exec" in snmpd.conf (see below)</div>
<div><br></div><div>-- On your remote server</div><div>In /etc/snmp/snmpd.conf:</div><div><snip></div><div>exec GENERIC_NAME_OF_CHECK /usr/local/bin/modify_output.sh </div><div><br></div><div></snip></div><div>
## If the above line is the only 'exec' directive in your snmpd.conf, then the <###> above will be a 1, if it's the third exec directive, it will be a 3, and so on....</div><div><br></div><div>Now, in /usr/local/bin/modify_output.sh</div>
<div><snip></div><div>!#/bin/bash</div><div><br></div><div>## Execute your snmpget here and capture it in a variable</div><div>output=`<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">snmpget -v 1 -c public localhost .enterprises.6347.1.1.17 -O Qve`</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">## $output now should hold something akin to 20717 or whatever the actual output is</span></div><div>
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">## Check for zero</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">if [ "$output" = "0" ]</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">then </span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">## Some error here:</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">echo "OOPS! This is zero. Why?"</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">exit 1</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">fi</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">## Ok, it's not zero, divide by 100 or multiply by .01</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">modified_output=`expr $output \* .01` ## Note the backslash escaping the *</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">echo $modified_output</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "></snip></span></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Restart snmpd</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div>Now, from nagios, run the command above, which will call out to the snmpd server on the remote host, find the <###>th 'exec' entry in snmpd.conf, execute the shell script, and return whatever you echo out from within your shell script. </div>
<div><br></div><div>Remember that check_snmp only returns one line, so any line breaks, etc will be lost when it's run from the nagios server.</div><div><br></div><div>Hope this helps!</div><div>g.;</div><div><br></div>
<div><br><div class="gmail_quote">On Thu, Aug 12, 2010 at 3:48 PM, Hall, JC <span dir="ltr"><<a href="mailto:jhall@iodatacenters.com">jhall@iodatacenters.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I certainly wish I could do that.  I'm just a novice.<br>
<br>
I can basically accomplish what I want (in regards to multiplying the output) with snmpget.<br>
<br>
printf "scale=2;%d*0.01\n" $(snmpget -v 1 -c public 192.168.104.37 .enterprises.6347.1.1.17 -O Qve)|bc<br>
<br>
208.72<br>
<br>
Any thoughts surrounding how I could run this as an external command and pipe it back into nagios?<br>
<br>
-----Original Message-----<br>
From: Matthew J. Salerno [mailto:<a href="mailto:vagabond_king@yahoo.com">vagabond_king@yahoo.com</a>]<br>
Sent: Thursday, August 12, 2010 2:17 PM<br>
To: Nagios Users List<br>
Subject: Re: [Nagios-users] Applying a multiplier to check_snmp results<br>
<br>
I ran into the same thing, I ended up writing my own plugins.  Just look for a<br>
non binary plugin (perl/python etc) and then hack away.<br>
<br>
<br>
<br>
----- Original Message ----<br>
From: Jim Avery <<a href="mailto:jim@jimavery.me.uk">jim@jimavery.me.uk</a>><br>
To: Nagios Users List <<a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a>><br>
Sent: Thu, August 12, 2010 5:05:42 PM<br>
Subject: Re: [Nagios-users] Applying a multiplier to check_snmp results<br>
<br>
On 12 August 2010 21:27, Hall, JC <<a href="mailto:jhall@iodatacenters.com">jhall@iodatacenters.com</a>> wrote:<br>
> I have a situation where I would like to apply a multiplier to the results<br>
> of a check_snmp output.<br>
><br>
> The situation is this:<br>
><br>
> The value received from my check_snmp = 20717.  The integer multiplier for<br>
> this particular OID is 0.01.<br>
><br>
> The output I want reported to Nagios is 20717 x 0.01 = 207.17.<br>
><br>
> Looking through the options of the check_snmp plugin, I can’t determine how<br>
> I could accomplish this.<br>
><br>
><br>
><br>
> Any thoughts are appreciated.<br>
<br>
<br>
+1 to that!<br>
<br>
I was doing some monitoring on a UPS yesterday and found the current<br>
is given as an integer which is 10x the Amps, so it would be great to<br>
be able to divide by 10 (or multiply by whatever) in check_snmp.<br>
<br>
------------------------------------------------------------------------------<br>
This SF.net email is sponsored by<br>
<br>
Make an app they can't live without<br>
Enter the BlackBerry Developer Challenge<br>
<a href="http://p.sf.net/sfu/RIM-dev2dev" target="_blank">http://p.sf.net/sfu/RIM-dev2dev</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any<br>
issue.<br>
<br>
::: Messages without supporting info will risk being sent to /dev/null<br>
<br>
<br>
<br>
<br>
<br>
------------------------------------------------------------------------------<br>
This SF.net email is sponsored by<br>
<br>
Make an app they can't live without<br>
Enter the BlackBerry Developer Challenge<br>
<a href="http://p.sf.net/sfu/RIM-dev2dev" target="_blank">http://p.sf.net/sfu/RIM-dev2dev</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<br>
------------------------------------------------------------------------------<br>
This SF.net email is sponsored by<br>
<br>
Make an app they can't live without<br>
Enter the BlackBerry Developer Challenge<br>
<a href="http://p.sf.net/sfu/RIM-dev2dev" target="_blank">http://p.sf.net/sfu/RIM-dev2dev</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null</blockquote></div><br><br clear="all"><br>-- <br>Gary Every<br>"Pay it Forward!"<br><br>
</div>