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:
-- On your nagios server: <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 The variables you'll need to supply are: <HOSTADDRESS> - The IP of the remote host <snmp_community_string> - Self-explanatory <###> - The number of the "exec" in snmpd.conf (see below) -- On your remote server In /etc/snmp/snmpd.conf: <snip> exec GENERIC_NAME_OF_CHECK /usr/local/bin/modify_output.sh </snip> ## 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.... Now, in /usr/local/bin/modify_output.sh <snip> !#/bin/bash ## Execute your snmpget here and capture it in a variable output=`snmpget -v 1 -c public localhost .enterprises.6347.1.1.17 -O Qve` ## $output now should hold something akin to 20717 or whatever the actual output is ## Check for zero if [ "$output" = "0" ] then ## Some error here: echo "OOPS! This is zero. Why?" exit 1 fi ## Ok, it's not zero, divide by 100 or multiply by .01 modified_output=`expr $output \* .01` ## Note the backslash escaping the * echo $modified_output </snip> Restart snmpd 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. Remember that check_snmp only returns one line, so any line breaks, etc will be lost when it's run from the nagios server. Hope this helps! g.; On Thu, Aug 12, 2010 at 3:48 PM, Hall, JC <[email protected]> wrote: > I certainly wish I could do that. I'm just a novice. > > I can basically accomplish what I want (in regards to multiplying the > output) with snmpget. > > printf "scale=2;%d*0.01\n" $(snmpget -v 1 -c public 192.168.104.37 > .enterprises.6347.1.1.17 -O Qve)|bc > > 208.72 > > Any thoughts surrounding how I could run this as an external command and > pipe it back into nagios? > > -----Original Message----- > From: Matthew J. Salerno [mailto:[email protected]] > Sent: Thursday, August 12, 2010 2:17 PM > To: Nagios Users List > Subject: Re: [Nagios-users] Applying a multiplier to check_snmp results > > I ran into the same thing, I ended up writing my own plugins. Just look > for a > non binary plugin (perl/python etc) and then hack away. > > > > ----- Original Message ---- > From: Jim Avery <[email protected]> > To: Nagios Users List <[email protected]> > Sent: Thu, August 12, 2010 5:05:42 PM > Subject: Re: [Nagios-users] Applying a multiplier to check_snmp results > > On 12 August 2010 21:27, Hall, JC <[email protected]> wrote: > > I have a situation where I would like to apply a multiplier to the > results > > of a check_snmp output. > > > > The situation is this: > > > > The value received from my check_snmp = 20717. The integer multiplier > for > > this particular OID is 0.01. > > > > The output I want reported to Nagios is 20717 x 0.01 = 207.17. > > > > Looking through the options of the check_snmp plugin, I can’t determine > how > > I could accomplish this. > > > > > > > > Any thoughts are appreciated. > > > +1 to that! > > I was doing some monitoring on a UPS yesterday and found the current > is given as an integer which is 10x the Amps, so it would be great to > be able to divide by 10 (or multiply by whatever) in check_snmp. > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Nagios-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nagios-users > ::: Please include Nagios version, plugin version (-v) and OS when > reporting any > issue. > > ::: Messages without supporting info will risk being sent to /dev/null > > > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Nagios-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nagios-users > ::: Please include Nagios version, plugin version (-v) and OS when > reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Nagios-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nagios-users > ::: Please include Nagios version, plugin version (-v) and OS when > reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null -- Gary Every "Pay it Forward!"
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ Nagios-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
