Get values from OID add create own alarm in EMC

  • 1
  • 1
  • Question
  • Updated 7 months ago
  • Answered
Hello,

is there a way to do an snmp get for arbitrary OIDs (for other vendors,too) and create an alarm if needed via a script (python, TCL, ...).

As I can see netsnmp for python is not installed. Can I install netsnmp and use it with the GUI scripting section on EMC (not the legacy tool)?

I will check some MIB values with a program logic and create an alarm or an syslog entry (with these syslog entry I can use the alarm manager in a second step).


Best regards
Stephan
Photo of SH

SH

  • 3,600 Points 3k badge 2x thumb

Posted 7 months ago

  • 1
  • 1
Photo of SH

SH

  • 3,600 Points 3k badge 2x thumb
Hello,

with the help of the GTAC if  found a solution for my problem. There are two tools in /usr/bin.

First "snmpget" and second "logger" both are well documented linux tools. I can call both tools via a python script and get with snmpget the needed OID and after some program lines I can wrote an Syslog entry with logger.

Thank you very much to GTAC!

Best regards
Stephan
Photo of Drew C.

Drew C., Community Manager

  • 38,358 Points 20k badge 2x thumb
Thanks for coming back to share the answer :)
Photo of Kurt Semba

Kurt Semba, Employee

  • 1,364 Points 1k badge 2x thumb
do you want to share the final script with us? would be great
Photo of SH

SH

  • 3,600 Points 3k badge 2x thumb
Hello Kurt,

here is my short python testscript. Runs in the bash and in the EMC gui out of the box.

------
import commands

#snmpget command line for system contact
command = "/usr/bin/snmpget -v3 -l authPriv -u admin -a MD5 -A passwd -x DES -X passwd 192.168.1.1 1.3.6.1.2.1.1.4.0"

#snmpget
systemcontact = commands.getoutput(command)

#cut unnecessary parts in snmpget answer
start  = systemcontact.find(":")
start  = start+2
systemcontact = systemcontact[start:]

#create syslog entry
alarm = commands.getoutput("logger" + " " + systemcontact)

---

Now you will see a new syslog entry.

Best regards
Stephan
Photo of M.Nees

M.Nees, Embassador

  • 9,262 Points 5k badge 2x thumb
Thanks for sharing this!
Photo of Kurt Semba

Kurt Semba, Employee

  • 1,364 Points 1k badge 2x thumb
yes, thanks for sharing!