Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmp set support #1

Closed
eill opened this issue Jun 30, 2014 · 2 comments
Closed

snmp set support #1

eill opened this issue Jun 30, 2014 · 2 comments

Comments

@eill
Copy link
Contributor

eill commented Jun 30, 2014

Hi, are there plans for snmp set support?

Maybe I can code this for you? If so, could you provide some guidelines about realization?

Thanks in advance.

@trehn
Copy link
Owner

trehn commented Jun 30, 2014

I have never used SNMP for anything but monitoring, so I don't have any experience with snmpset.

Here is an idea for an API:

from hnmp import SNMP
snmp = SNMP(...)
snmp.set("1.3.6.1.2.1.1.9.1.3.1", "foo")

Note that an implementation will have to guess the type of "foo" (if it's a Python string it should probably end up as an OctetString for pysnmp). I guess there would have to be a way of forcing a particular type:

snmp.set("1.3.6.1.2.1.1.9.1.3.1", "foo", value_type='hex_string')

The snmpset utility understands these types:

    i: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS
    o: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING, b: BITS
    U: unsigned int64, I: signed int64, F: float, D: double

TimeTicks is the easiest, that's just a datetime.timedelta. One would have to figure out what the best default mapping for a Python integer, float, etc. would be.

Please feel free to contribute :)

@trehn
Copy link
Owner

trehn commented Oct 10, 2014

merged in #2, thanks again!

@trehn trehn closed this as completed Oct 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants