Re: Experimenta OIDs usage

"M.AMJAD" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
its work good now dear....

Thanks

M.AMJAD
+92-345-9208119


On Wednesday, 14 May 2014, 19:48, "Robson, Alan" <[email protected]> wrote:
  


 
And I should add – are you using SELinux ? what does the command sestatus tell you ? 
  
Alan 
  
From:Robson, Alan [mailto:[email protected]] 
Sent: Wednesday, May 14, 2014 7:44 AM
To: M.AMJAD; [email protected]
Subject: RE: Experimenta OIDs usage   
  
Two questions… 
  
1)      Did you add “Hello world this is testing” to the script ? It won’t work with net-snmp if you do because net-snmp is expecting a word like “counter” it is one of the basic snmp data types. 
2)      Did you add the configuration to the snmpd.conf file before you restarted the agent ?, there are two places to add the config… 
  
In the pass through section, the comment should already be in the file… 
  
  
  
  
# 
#  "Pass-through" MIB extension command 
# 
pass .1.3.6.1.3.55  /usr/local/bin/snmp_extender.py 
  
  
  
  
  
and farther up the file in the access control section, the comment should also already be in the snmpd.conf file (at least it was in mine) 
  
  
  
  
  
############################################################################### 
# 
#  ACCESS CONTROL 
# 
  
                                                 #  system + hrSystem groups only 
view   systemonly  included   .1.3.6.1.3.55 
  
  
  
  
  
  
Alan 
  
  
From:M.AMJAD [mailto:[email protected]] 
Sent: Tuesday, May 13, 2014 10:02 PM
To: Robson, Alan; [email protected]
Subject: Re: Experimenta OIDs usage   
  
Thanks Alan,  
                    it works with the -g switch, but when i restart the snmpd service and then tried snmpwalk, it produce the following out put (no data fetched ),,, can you help please.  
   
[root@localhost snmp]# /usr/local/bin/snmp_extender.py -g .1.3.6.1.3.55
.1.3.6.1.3.55.0
Hello world this is testing...
1234
[root@localhost snmp]# snmpwalk -v 1 -O n -c public localhost .1.3.6.1.3.55
End of MIB  
   
M.AMJAD
+92-345-9208119    
On Tuesday, 13 May 2014, 20:24, "Robson, Alan" <[email protected]> wrote:  
When you run the script from the command line it needs two arguments, like this…  
   
/usr/local/bin/snmp_extender.py -g .1.3.6.1.3.55  
   
When the snmp agent runs the script it will supply those arguments.  
   
Alan  
   
From:M.AMJAD [mailto:[email protected]] 
Sent: Monday, May 12, 2014 10:16 PM
To: Robson, Alan; [email protected]
Subject: Re: Experimenta OIDs usage    
   
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" <[email protected]> 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:[email protected]] 
Sent: Thursday, May 08, 2014 11:55 PM
To: mailto:[email protected]
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
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.