Comments (11)
👍 Thanks MrSpock. Yes it's a feature I'd like to add, I'll keep this issue open. We're all pretty busy (you, me, others on the gosnmp project). Perhaps you'd like to submit a pull request? Otherwise I'll get onto this when I next have a holiday :-)
from gosnmp.
PS Would you mind sending a couple of packet captures of doing some SNMP string sets? That would help for developing the code (TDD - Test Driven Development).
How to do packet captures is detailed in the readme.
Thanks, Sonia.
from gosnmp.
Sonia,
I have few days of holiday and I'm already sitting with wireshark pcap files from my SNMP session and maybe I will submit push request before your next holidays :)
from gosnmp.
Sonia,
Since I needed this really hard after ~1.5h with tcpdump and wireshark I made it :)
I've made code for SNMP Set OctetString and String (they are the same on PDU layer since string is sent as bytes).
It works for me and you can set either Octet String (not always printable chars you have to send) or strings.
Example when creating SnmpPDU:
// set string
pdu := []gosnmp.SnmpPDU{gosnmp.SnmpPDU{oid, gosnmp.OctetString, "foo"}}
// set bytes (not necessary readable string. Any 0x0-0xff is ok in SNMP OctetString)
pdu := []gosnmp.SnmpPDU{gosnmp.SnmpPDU{oid, gosnmp.OctetString, []byte{0x62, 0x61, 0x72}}}
I made pull request.
from gosnmp.
Thanks Marcin, I'm working on the patch at the moment. The pcap file - would you mind emailing it to me ([email protected]) or putting it somewhere I can download it?
I like to use TDD for gosnmp - catch all those corner cases. I'll use the pcap file to write a test.
from gosnmp.
Sonia,
First pcap is from native Linux snmputils snmpset and it sends 4 sets -two integers and two OctetStrings:
https://dl.dropboxusercontent.com/u/7660386/github/snmpset_native.pcap
Second is from my code (example used http://pastebin.com/WBW02b5F )
Here is pcap file:
https://dl.dropboxusercontent.com/u/7660386/github/snmpset_go.pcap
from gosnmp.
Thanks!
from gosnmp.
See also #30
from gosnmp.
Hi Marcin, would you mind doing the following, to make writing the tests easier:
- do the snmpset as one command (ie set 4 values at once), rather than 4 separate sets
- tell me what the snmpset commandline is, so I can see what types and what expected values are being used. For example see [1], but use v2c, numeric options rather than ascii for OIDs, and not the equals format. For example
snmpset -c private -v 1 test-hub system.sysContact.0 s [email protected] gers.edu ip.ipforwarding.0 = 2
- send me a URL to the pcap for that
Thanks very much for your help :-)
[1] http://www.linuxcommand.org/man_pages/snmpset1.html
from gosnmp.
Sonia,
Here is command:
snmpset -c private -v2c 10.80.0.14 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.2.2 i 5001 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.3.2 i 5001 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.4.2 i 2 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.5.2 i 1
Here is resulted file.
https://dl.dropboxusercontent.com/u/7660386/github/snmp_multiset.pcap
I don't know why snmpset repeates queries. Device which receives them respond slow so maybe this is somehow related to timeout. However packet content is ok and this is nice example of multiple varbinds in one packet.
from gosnmp.
Thanks very much! Tests written, merged. Would you mind sending a pcap for a couple of ipaddress sets and and the snmpset command line, so I can write the tests :-)
(I've rebased your set_ipaddress branch)
from gosnmp.
Related Issues (20)
- The Get method is unable to collect data, if we provide multiple OIDs, which includes an invalid OID. HOT 1
- Query on gosnmp feature as snmp agent HOT 2
- multiple device concurrent polling fails unless you create your own snmp object HOT 2
- Question: Use on Windows HOT 1
- VULNERABILITY [CWE-347] CVE-2020-9283] golang.org/x/crypto Improper Signature Verification HOT 1
- Sometimes a previous privacy passphrase is reused instead of the specified one
- usmStatsUnknownUserNames as terminating error? HOT 3
- Chinese coding is garbled HOT 2
- How to configure read/write community? HOT 1
- marshal: marshalPDU: unable to marshal varbind list: unable to marshal OID: Value out of range HOT 2
- Should cancelling a context interrupt an ongoing operation?
- out of bounds error when parsing AuthNoPriv packet HOT 4
- msgMaxSize to be supported in SNMP v3 bulkwalk requests
- V3 feat needed: Load keys manually if the passphrases are not allowed be saved locally HOT 1
- Connect function in gosnmp always returns nil even if the credentials are not valid HOT 1
- Panic in unmarshalV3Header
- Compatibility with GoSNMPServer HOT 7
- `net-snmp` based validation testing HOT 5
- Request ID size too large
- Not handling `0` values correctly for `OpaqueDouble` or `OpaqueFloat`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosnmp.