⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 ucd-snmp源代码
💻
📖 第 1 页 / 共 3 页
字号:
                   as defined by <non-repeaters>. For remaining Varbinds,                   the m lexico instances are retrieved each of the remaining                   Varbinds, where m is <max-repeaters>. bulkwalk(<non-repeaters>, <max-repeaters>, <vars> [, <callback>])                 - do an "SNMP bulkwalk" on the given variables.  Bulkwalk is                   implemented by sending an SNMP GETBULK request to fetch the                   variables.  Objects are copied to the return list until the                   sub-tree is exited.  If the request is not completed at the                   end of a packet, a new request is created, starting where                   the previous packet left off.  This implementation is able                   to handle multiple repeated vars, as well as non-repeaters.                   Returns a list (or, in scalar context, a reference to a                   list) of arrays of VarBinds.  The VarBinds consist of the                   responses for each requested variable.  bulkwalk() leaves                   the original Varbinds list intact to facilitate querying                   of multiple devices.SNMP::TrapSession - supports all applicable fields from SNMP::Session                    (see above)methods: new(<fields>)   - Constructs a new SNMP::TrapSession object. The fields are                   passed to the constructor as a hash list                   (e.g., $trapsess = new SNMP::Session(DestHost => 'foo',                   Community => 'private');), returns an object reference                   or undef in case of error. trap(enterprise, agent, generic, specific, uptime, <vars>)    $sess->trap(enterprise=>'.1.3.6.1.4.1.2021', # or 'ucdavis' [default]                agent => '127.0.0.1', # or 'localhost',[dflt 1st intf on host]                generic => specific,  # can be omitted if 'specific' supplied                specific => 5,        # can be omitted if 'generic' supplied                uptime => 1234,       # dflt to localhost uptime (0 on win32)                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars                                                             # always last or v2 format trap(oid, uptime, <vars>)    $sess->trap(oid => 'snmpRisingAlarm',                uptime => 1234,                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars                                                             # always lastAcceptable variable formats:<vars> may be one of the following forms: SNMP::VarList:  - represents an array of MIB objects to get or set,                   implemented as a blessed reference to an array of                   SNMP::Varbinds, (e.g., [<varbind1>, <varbind2>, ...]) SNMP::Varbind:  - represents a single MIB object to get or set, implemented as                   a blessed reference to a 4 element array;                   [<obj>, <iid>, <val>, <type>].                   <obj>  - one of the following forms:                          1) leaf identifier (e.g., 'sysDescr') assumed to be                             unique for practical purposes                          2) fully qualified identifier (e.g.,			     '.iso.org.dod.internet.mgmt.mib-2.system.sysDescr')                          3) fully qualified, dotted-decimal, numeric OID (e.g.,                             '.1.3.6.1.2.1.1.1')                   <iid>  - the dotted-decimal, instance identifier. for                            scalar MIB objects use '0'		   <val>  - the SNMP data value retrieved from or being set                            to the agents MIB. for (f)get(next) operations                            <val> may have a variety of formats as determined by                            session and package settings. However for set                            operations the <val> format must be canonical to                            ensure unambiguous translation. The canonical forms                            are as follows:	                    OBJECTID => dotted-decimal (e.g., .1.3.6.1.2.1.1.1)			    OCTETSTR => perl scalar containing octets,		            INTEGER => decimal signed integer (or enum),			    NETADDR => dotted-decimal,			    IPADDR => dotted-decimal,			    COUNTER => decimal unsigned integer,			    COUNTER64  => decimal unsigned integer,			    GAUGE,  => decimal unsigned integer,			    UINTEGER,  => decimal unsigned integer,                            TICKS,  => decimal unsigned integer,                            OPAQUE => perl scalar containing octets,       			    NULL,  => perl scalar containing nothing,                   <type> - SNMP data type (see list above), this field is                            populated by 'get' and 'getnext' operations. In                            some cases the programmer needs to populate this                            field when passing to a 'set' operation. this                            field need not be supplied when the attribute                            indicated by <tag> is already described by loaded                            Mib modules. for 'set's, if a numeric OID is used                            and the object is not currently in the loaded Mib,                            the <type> field must be supplied simple string   - light weight form of <var> used to 'set' or 'get' a                   single attribute without constructing an SNMP::Varbind.                   stored in a perl scalar, has the form '<tag>.<iid>',                   (e.g., 'sysDescr.0'). for 'set' operations the value                   is passed as a second arg. Note: This argument form is                   not updated in get[next] operations as are the other forms.Acceptable callback formats:<callback> may be one of the following forms: without arguments:    \&subname    sub { ... } or with arguments:    [ \&subname, $arg1, ... ]    [ sub { ... }, $arg1, ... ]    [ "method", $obj, $arg1, ... ]callback will be called when response is received or timeoutoccurs. the last argument passed to callback will be aSNMP::VarList reference. In case of timeout the last argumentwill be undef.SNMP package variables and functions: $SNMP::VERSION       - the current version specifier (e.g., 3.1.0) $SNMP::auto_init_mib - default '1', set to 0 to disable automatic reading                        of the MIB upon session creation. set to non-zero                        to call initMib at session creation which will result                        in MIB loading according to Net-SNMP env. variables			(see man mib_api) $SNMP::verbose       - default '0', controls warning/info output of                        SNMP module, 0 => no output, 1 => enables warning/info                        output from SNMP module itself (is also controlled                        by SNMP::debugging - see below) $SNMP::use_long_names - default '0', set to non-zero to enable the use of                        longer Mib identifiers. see translateObj. will also                        influence the formatting of <tag> in varbinds returned                        from 'getnext' operations. Can be set on a per session                        basis (UseLongNames) $SNMP::use_sprint_value - default '0', set to non-zero to enable formatting of                        response values using the snmp libraries sprint_value                        function. can also be set on a per session basis (see                        UseSprintValue) Note: returned values may not be                        suitable for 'set' operations $SNMP::use_enums     - default '0',set non-zero to return values as enums and                        allow sets using enums where appropriate. integer data                        will still be accepted for set operations. can also be                        set on a per session basis (see UseEnums) $SNMP::use_numeric   - default '0', set to non-zero to return tags as numeric                        OID's, instead of translating them.  Also setting                        $SNMP::use_long_names to non-zero is highly recommended. $SNMP::timestamp_vars - default '0', set to non-zero to add an additional			time(2)-style timestamp element to each returned			Varbind (as array element 4).  Do not modify a			timestamp value -- it is shared between all variables			that were received at the same time. $SNMP::save_descriptions - default '0',set non-zero to have mib parser save                        attribute descriptions. must be set prior to mib                        initialization $SNMP::debugging     - default '0', controls debugging output level                        within SNMP module and libsnmp                        1 => enables 'SNMP::verbose' (see above)                        2 => level 1 plus snmp_set_do_debugging(1),                        3 => level 2 plus snmp_set_dump_packet(1) $SNMP::dump_packet   - default '0', set [non-]zero to independently set                        snmp_set_dump_packet() %SNMP::MIB           - a tied hash to access parsed MIB information. After                        the MIB has been loaded this hash allows access to                        to the parsed in MIB meta-data(the structure of the                        MIB (i.e., schema)). The hash returns blessed                        references to SNMP::MIB::NODE objects which represent                        a single MIB attribute. The nodes can be fetched with                        multiple 'key' formats - the leaf name (e.g.,sysDescr)                        or fully/partially qualified name (e.g.,                        system.sysDescr) or fully qualified numeric OID. The                        returned node object supports the following fields:        objectID      - dotted decimal fully qualified OID        label         - leaf textual identifier (e.g., 'sysDescr')        subID         - leaf numeric OID component of objectID (e.g., '1')        moduleID      - textual identifier for module (e.g., 'RFC1213-MIB')        parent        - parent node        children      - array reference of children nodes        nextNode      - next lexico node (BUG!does not return in lexico order)        type          - returns application type (see getType for values)        access        - returns ACCESS (ReadOnly, ReadWrite, WriteOnly,                        NoAccess, Notify, Create)        status        - returns STATUS (Mandatory, Optional, Obsolete,                        Deprecated, Current)        syntax        - returns 'textualConvention' if defined else 'type'        textualConvention - returns TEXTUAL-CONVENTION        units         - returns UNITS        hint          - returns HINT        enums         - returns hash ref {tag => num, ...}        ranges        - returns array ref of hash ref [{low=>num, high=>num}]        defaultValue  - returns default value        description   - returns DESCRIPTION ($SNMP::save_descriptions must                        be set prior to MIB initialization/parsing) &SNMP::setMib(<file>) - allows dynamic parsing of the mib and explicit                         specification of mib file independent of environment                         variables. called with no args acts like initMib,                         loading MIBs indicated by environment variables (see                         Net-SNMP mib_api docs). passing non-zero second arg                         forces previous mib to be freed and replaced                         (Note: second arg not working since freeing previous                          Mib is more involved than before). &SNMP::initMib()     - calls library init_mib function if Mib not already                        loaded - does nothing if Mib already loaded. will                        parse directories and load modules according to                        environment variables described in Net-SNMP                        documentations.                        (see man mib_api, MIBDIRS, MIBS, MIBFILE(S), etc.) &SNMP::addMibDirs(<dir>,...) - calls library add_mibdir for each directory                        supplied. will cause directory(s) to be added to                        internal list and made available for searching in                        subsequent loadModules calls &SNMP::addMibFiles(<file>,...) - calls library read_mib function. The file(s)                       supplied will be read and all Mib module definitions                       contained therein will be added to internal mib tree                       structure &SNMP::loadModules(<mod>,...) - calls library read_module function. The                       module(s) supplied will be searched for in the                       current mibdirs and and added to internal mib tree                       structure. Passing special <mod>, 'ALL', will cause                       all known modules to be loaded. &SNMP::unloadModules(<mod>,...) - *Not Implemented* &SNMP::translateObj(<var>[,arg]) - will convert a text obj tag to an OID and                            vice-versa. any iid suffix is retained numerically.                            default behaviour when converting a numeric OID                            to text form is to return leaf identifier only                            (e.g.,'sysDescr') but when $SNMP::use_long_names                            is non-zero or a non-zero second arg is supplied                            will return longer textual identifier. If no Mib                            is loaded when called and $SNMP::auto_init_mib is                            enabled then the Mib will be loaded. Will return                            'undef' upon failure. &SNMP::getType(<var>) - return SNMP data type for given textual identifier                        OBJECTID, OCTETSTR, INTEGER, NETADDR, IPADDR, COUNTER                        GAUGE, TIMETICKS, OPAQUE, or undef &SNMP::mapEnum(<var>) - converts integer value to enumeration tag defined                         in Mib or converts tag to integer depending on                         input. the function will return the corresponding                         integer value *or* tag for a given MIB attribute                         and value. The function will sense which direction                         to perform the conversion. Various arg formats are                         supported

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -