[mrtg] Re: snmpget in a perl script

tony bourke tony at vegan.net
Thu Apr 25 17:33:50 MEST 2002


Hi Cliff,

#!/usr/local/bin/perl
#
$value = `snmpget -Ov localhost public .1.3.6.1.4.1.2021.10.1.5.1`;
chomp ($value);
print "$value\n";


The key there is to use -Ov, which sets the output to be terse.
Otherwise, $value will be:

enterprises.ucdavis.laTable.laEntry.laLoadInt.1 = 0

instead of just zero.

Hope that helps.

Tony



On Thu,
25 Apr 2002, Cliff wrote:

>
> Hi folks.
>
> I'm graphing an APC UPS.
> There are several things that I would like to have
> in the web page. Such as:
>
> Last battery replacment date.
> Total time the UPS has spent on the batteries.
>
> Since this info is available via snmp I would
> have to do an snmpget and then include that data
> in the web page as an SSI. I can make the HTML
> changes and configure apache to do CGI/SSI no problem.
>
> I need an example of a stand-alone perl script
> with an snmpget in it that would be suitable for
> inclusion as an SSI. For example purposes anything
> would do. I can change the snmpget line to make
> it fetch whatever information I might want.
>
> Could somebody spare me a perl snippet?
>
> Thanks gurus.
>
>
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>

-- 
-------------- -- ---- ---- --- - - - -  -  -- -  -  -  -   -     -
Tony Bourke				tony at vegan.net



--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list