Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

SNMP incoming events

If you have a question or need help, this is the place to be.
Post Reply
Baps
Posts: 2
Joined: Sat Aug 16, 2014 7:54 am

SNMP incoming events

Post by Baps »

hi I am in the process of developing a home automation system using snmp relay boards and eventghost. I currently use snmp command line commands to send command to the relay board. Now the problem is the snmp board sends information back to eventghost to acknowledge the command. These messages show in the command prompt window and not in the eventghost events log. I would like to somehow convert these messages into events for use in eventghost.

So far i have tried command line option:
/c "for /f "usebackq delims=" %s in (`snmpget -v1 -c private 192.168.1.73 .1.3.6.1.4.1.358.1.1.2.1`) do c:\program files (x86)\eventghost\eventghost.exe -e SNMPGET %s"

In the events window the execute code but i do not get an SNMPGET event.

PS
I am using net-snmp library

Any assistance will be appreciated
Baps
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: SNMP incoming events

Post by krambriw »

You have to 'pipe' the response back to EG. Try something similar like

Code: Select all

#!/usr/bin/python
import subprocess
p = subprocess.Popen("date", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
print "Command output : ", output
Baps
Posts: 2
Joined: Sat Aug 16, 2014 7:54 am

Re: SNMP incoming events

Post by Baps »

hey guys i got it sorted

/c "for /f "usebackq delims=" %s in (`snmpget -v1 -c private 192.168.1.73 .1.3.6.1.4.1.358.1.1.2.1`) do cd c:\program files (x86)\eventghost\ & eventghost.exe -e SNMPGET %s"

i will try the subprocess code as well thanks
Post Reply