[mrtg] Want to run snmpget from cli of mrtg server

Daniel J McDonald dan.mcdonald at austinenergy.com
Thu Mar 8 19:59:04 CET 2007


On Thu, 2007-03-08 at 12:35 -0600, Mersberger, Robert wrote:
>  Looks like Snmp_util is loaded. Can you tell me how I would evoke this
> from the command line?

        perldoc Net_SNMP_util tells me:
          snmpwalk() - walk OBJECT IDENTIFIER tree(s) on the remote
        agent
        
                   @result = snmpwalk(
        
        [community@]host[:port[:timeout[:retries[:backoff[:version]]]]],
                               [\%param_hash],
                               @oids
                           );
        
               This function performs a sequence of SNMP
        get-next-request or get-bulk-request (if the SNMP version is 2
        or higher) queries to gather data from the remote agent on the
        host specified.  The initial message is built using the list of
        OBJECT IDENTIFIERs passed as an array.  Each OBJECT IDENTIFIER
        is placed into a single SNMP GetNextRequest-PDU in    the same
        order that it held in the original list.  Queries continue until
        all the returned OBJECT IDENTIFIERs are no longer a child of the
        base OBJECT IDENTIFIERs.
        
               The requested values are returned in an array in the same
        order as they were requested.  The OBJECT IDENTIFIER number is
        added as a prefix to each value using a colon as a separator,
        like '1.3.6.1.2.1.2.2.1.2.1:ethernet'.  If only one OBJECT
        IDENTIFIER is requested, just the "instance" part of the OBJECT
        IDENTIFIER is added as a prefix, like '1:ethernet',
        '2:ethernet', '3:fddi'.

The only difference with SNMP_util is that there is no \%param_hash to
pass Net::SNMP extensions like snmp v3 authentication parameters.

Get familiar with the perl debugger (perldoc perldebug) and it should be
fairly simple.


> 
> I would like to do and snmpwalk -c dogface 172.24.6.25 
> 
> Thanks
> 
> 
> -----Original Message-----
> From: mrtg-bounces at lists.oetiker.ch
> [mailto:mrtg-bounces at lists.oetiker.ch] On Behalf Of Daniel J McDonald
> Sent: Thursday, March 08, 2007 12:02 PM
> To: mrtg at lists.oetiker.ch
> Subject: Re: [mrtg] Want to run snmpget from cli of mrtg server
> 
> On Thu, 2007-03-08 at 11:13 -0600, Mersberger, Robert wrote:
> > Is there a way to run snmpget or snmpwalk that mrtg uses from the 
> > command line of the server that mrtg is installed on?
> 
> mrtg uses one of two perl modules to perform that work.  Which module is
> loaded depends on whether you are using snmp V3 or V1/V2c
> 
> If you were to run cfgmaker or mrtg with perl -d, you could stop the
> script after the snmp credentials are parsed and either SNMP_util.pm or
> Net_SNMP_util.pm is loaded.  Then you could do snmpwalk or snmpget in
> the perl debugger.
> 
> Full details on the module are available using `perldoc Net_SNMP_util`.
> The syntax is mostly the same for both modules, but SNMP_util does not
> have any pod associated with it. 
> 
> --
> Daniel J McDonald, CCIE # 2495, CISSP # 78281, CNX Austin Energy
> http://www.austinenergy.com
> 
> _______________________________________________
> mrtg mailing list
> mrtg at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
> 
> 
> CONFIDENTIAL NOTICE:
> This e-mail message and any attachment(s) (collectively, this 'Email') are intended
> only for the confidential use of the recipient(s) named above. If the reader of this
> message is not the intended recipient named above or an agent responsible for
> delivering it to the intended recipient named above, you have received this Email in error.
> Please notify the sender immediately and permanently delete this Email and any copies thereof.
-- 
Daniel J McDonald, CCIE # 2495, CISSP # 78281, CNX
Austin Energy
http://www.austinenergy.com



More information about the mrtg mailing list