Hello,,,
            i tried the procedure u told, but it generates the following error, 
can anybody resolve, please.

[amjid@localhost ~]$ /usr/local/bin/snmp_extender.py 
Traceback (most recent call last):
  File "/usr/local/bin/snmp_extender.py", line 4, in <module>
    OID = sys.argv[2].strip()
IndexError: list index out of range



 
M.AMJAD
+92-345-9208119


On Friday, 9 May 2014, 21:45, "Robson, Alan" <alan.rob...@viasat.com> wrote:
 
This page: http://net-snmp.sourceforge.net/docs/man/snmpd.conf.html#lbAZ 
describes how the snmp agent can be extended with a simple script. 
 
Here is a very bad example of a script that I saved in the file 
/usr/local/bin/snmp_extender.py …
 
#! /usr/bin/python -u
import sys
 
# OID is passed with a -g command line switch
OID = sys.argv[2].strip()
 
if OID == ".1.3.6.1.3.55":
        print OID + ".0"
        print "counter"
        print 1234
 
The snmp agent will run the script whenever anything in the .1.3.6.1.3.55 
subtree is fetched. 
 
To tell the SNMP agent to run the script and to allow users to read that part 
of the MIB tree I added the following lines in snmpd.conf…
 
#
#  "Pass-through" MIB extension command
#
pass .1.3.6.1.3.55  /usr/local/bin/snmp_extender.py
 
and
 
###############################################################################
#
#  ACCESS CONTROL
#
 
                                                 #  system + hrSystem groups 
only
view   systemonly  included   .1.3.6.1.3.55
 
 
I tested my script by running it manually to simulate what the snmp agent will 
do when it gets a request…
 
alanr@pug:~$ /usr/local/bin/snmp_extender.py -g .1.3.6.1.3.55
.1.3.6.1.3.55.0
counter
1234
 
And then I restarted the snmp agent and tried it with snmpwalk…
 
alanr@pug:~$ snmpwalk -v 1 -O n -c public localhost .1.3.6.1.3.55
.1.3.6.1.3.55.0 = Counter32: 1234
End of MIB
 
And again without expressing the result numerically:
 
alanr@pug:~$ snmpwalk -v 1 -c public localhost .1.3.6.1.3.55
SNMPv2-SMI::experimental.55.0 = Counter32: 1234
End of MIB
 
Obviously the script is no good for anything other than an example. I hope it 
helps, I’m not sure you’re going in the right direction though.
 
Good luck
 
Alan
 
 
From:M.AMJAD [mailto:amji...@yahoo.com] 
Sent: Thursday, May 08, 2014 11:55 PM
To: Net-snmp-users@lists.sourceforge.net
Subject: Experimenta OIDs usage
 
Hi, 
    i am trying to use experimental , but how to use (add) a personal OID or 
another one, please..... 
for example i want to use 1.3.6.1.3.55 , so how to add & use 55 accessible,
 
output is as follows,
 
[root@localhost amjid]# snmpwalk -v 1 -c public localhost 1.3.6.1.3
End of MIB
[root@localhost amjid]# snmpget -v 1 -c public localhost 1.3.6.1.3.55
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: SNMPv2-SMI::experimental
 
 
M.AMJAD
+92-345-9208119
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to