Use net-snmp pass to dynamically manage nodes

Source: Internet
Author: User
Tags snmpget

Previously, only exec and extend can be configured in snmpd. conf to manage MIB nodes elastically using scripts (or executable files. It is also constantly suffering from the troubles they bring, that is, when the values required by get or walk, many results will be returned through the appended leaf node, the consequence is that it is not compatible with many standard SNMP management software.

Now we have a perfect solution. Let's look at man snmpd. in the pass-through control section of conf, it indicates that the node value can be dynamically managed using the pass miboid exec syntax. miboid is passed to the script as a parameter, and the output of the script is in the specified format, print the miboid, type, and value in the three rows respectively.

What's more, set! This is not what exec and extend can do.

Attached example:
Add a sentence to snmpd. conf,
Pass. 1.3.6.1.4.1.2021.255/root/passtest

/Root/Write a bash script passtest,
#! /Bin/bash
Echo $2 # Because snmpd uses Exec-G miboid to call the script, miboid is the second parameter.
Echo integer
Echo 13

Snmpd can be restarted to directly snmpget it.
[Root @ localhost ~] # Snmpget-V 2C-C public localhost. 1.3.6.1.4.1.2021.255
UCD-SNMP-MIB: ucdavis.255 = integer: 13

I don't know how I missed such a strong feature, or I didn't have it yet...

Additionally, pass_persist is another form of pass (replacing scripts with a daemon). The output of the daemon must strictly follow the protocol format. For more information, see man snmpd. conf.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.