Comments (15)
hi @zhum ,
Hum... seems like a network issue. Do you mind running this in debug mode?
Also, you don't need to set the :timeout
, as there's already a 2 sec default.
from ruby-netsnmp.
Here is the output (repeated several times):
sending request...
pdu: 3041
snmp_version: 0201 ("1")
community: xxxx xxxx xxxx xxxx ("commuity name here")
request: a033
request_id: 0204 221e 8d1f ("572427551")
error: 0201 ("0")
error_index: 0201 ("0")
varbinds: 3025
Sequence: 3023
ObjectId: 061f 2b06 0104 01cf 2f01 0202 0101 1811 3365 6536 3030 3039 3130 3030 3531 3030 ("1.3.6.1.4.1.10159.1.2.2.1.1.24.17.51.101.101.54.48.48.48.57.49.48.48.48.53.49.48.48.49")
Null: 0500
3041 0201 0104 0770 616e 6c6f 6d32 a033
0204 221e 8d1f 0201 0002 0100 3025 3023
061f 2b06 0104 01cf 2f01 0202 0101 1811
3365 6536 3030 3039 3130 3030 3531 3030
3105
from ruby-netsnmp.
Here is tcpdump of console snmpget
:
14:19:03.546387 IP manage-02.52723 > 10.0.251.1.snmp: C=xxxxxxxx GetRequest(51) E:10159.1.2.2.1.1.24.17.51.101.101.54.48.48.48.57.49.48.48.48.53.49.48.48.49
0x0000: 4500 005f 943f 4000 4011 9e4a 0a00 f902
0x0010: 0a00 fb01 cdf3 00a1 004b 0861 3041 0201
0x0020: 0004 0770 616e 6c6f 6d32 a033 0204 32d3
0x0030: 9cb2 0201 0002 0100 3025 3023 061f 2b06
0x0040: 0104 01cf 2f01 0202 0101 1811 3365 6536
0x0050: 3030 3039 3130 3030 3531 3030 3105 00
May be last 00
byte in ruby code transmission is missing?
from ruby-netsnmp.
Could you also tcpdump
the packets for netsnmp
example? Just making sure that it's send packets to the right peer.
from ruby-netsnmp.
Here it is:
17:41:41.649167 IP manage-02.35647 > 10.0.251.1.snmp: C=xxxxxxxxx GetRequest(51) E:10159.1.2.2.1.1.24.17.51.101.101.54.48.48.48.57.49.48.48.48.53.49.48.48.49
0x0000: 4500 005f 94b3 4000 4011 9dd6 0a00 f902
0x0010: 0a00 fb01 8b3f 00a1 004b 0861 3041 0201
0x0020: 0104 0770 616e 6c6f 6d32 a033 0204 0e00
0x0030: a1ee 0201 0002 0100 3025 3023 061f 2b06
0x0040: 0104 01cf 2f01 0202 0101 1811 3365 6536
0x0050: 3030 3039 3130 3030 3531 3030 3105 00
from ruby-netsnmp.
Ok, so we confirmm that the packet is well-formed, and it's sent to the right peer. I guess the legacy device takes longer to reply? Try increasing the :timeout
to, let's say, 10.
from ruby-netsnmp.
Tried this, didn't help... Seems very strange, may be my legacy device has some peculiarity, but how can we detect it?
from ruby-netsnmp.
can you run run snmpget
in verbose mode (-DALL
, or perhaps lower verbosity, if it helps your case), and see if there's anything in the output that might help uncover what snmpget
does that netsnmp
doesn't?
from ruby-netsnmp.
Here is the log:
snmp-get.log
It seems strange, that answer for a request was received very fast, but in case ruby code there was no answer at all...
from ruby-netsnmp.
@zhum can you try theissue-54
branch to see if it fixes your issue?.
EDIT: Also forgot to ask: what's your environment, i.e. OS, ruby version, etc.
from ruby-netsnmp.
Did not help :(
I use Centos 7.8.2003, ruby 2.7 (via scl
). Gem is installed via gem install --local
), no bundler or rbenv yet. New version I've installed with git clone ...; cd ruby-netsnmp; git checkout issue-54; gem build; gem install --local netsnmp-0.4.2.gem
.
from ruby-netsnmp.
I'm out of ideas for remote troubleshooting 😞 I think I'd I'd require remote access to figure out what's going on, as that's a weird network behaviour: the request packet goes, but the response never arrives...
Do you know how to work with wireshark? Could you inspect all UDP, SNMP traffic during your script run, to see if things are workingn as expected network-wise? Maybe compare it with the snmpget
example of yours?
from ruby-netsnmp.
I can get you the remote ssh access, if you provide an open ssh key to me (serg at parallel.ru), also I can get you sudo access for tcpdump and wireshark.
from ruby-netsnmp.
@zhum I've found out what was going on. It was two things:
- your script declares the wrong version (1 instead of 0). I understand the confusion, given how the README is more focused on the v3 case, but the documentation declares that, if you're passing an integer, then you should be passing the correct PDU version code, which in the case of "v1", it's 0 (snmp can be a bit confusing). In order to spare you the confusion,
netsnmp
allows you to pass"v1"
, so I suggest you use if from now on. - Even with the above, the current version wasn't able to get the PDU from a different source port, so I patched it to use connectionless UDPs. This did the trick. I still have to do some tweaks, but feel free to use the
issue-54
branch, until I release a new version.
Thank you again for the collaboration.
from ruby-netsnmp.
Wow! Yes, it works with these notes. Thank you!
from ruby-netsnmp.
Related Issues (20)
- Counter32 and Counter64 Values Issue HOT 5
- Counter64 OID Values Are Returned as nil HOT 6
- Certain gauge / counter32 values are being encoded incorrectly HOT 11
- HMAC-SHA-2 Authentication Protocols in the User-based Security Model (USM) for SNMPv3 HOT 2
- SNMPSet two different OIDs in one request command? HOT 5
- MIB parser
- SNMPv3 with DES and MD5 fails: invalid message authentication salt HOT 31
- Different encoding of results HOT 2
- Bug AES decrypt when salt is empty HOT 1
- Cannot load MIB file HOT 10
- The gem does not recognize authentication failures HOT 2
- Occasional "Decryption error" with SNMPv3 HOT 14
- uninitialized constant Socket::MSG_NOSIGNAL HOT 4
- passkey calculation into c extension
- The gem does not recognize a missing OID HOT 7
- SNMPv3 not working with APC UPS HOT 11
- V3 cannot parse TROPIC-GLOBAL-MIB HOT 2
- Cisco Mibs Brake when using mib names HOT 19
- SNMPV3. Failing to load some legacy MIBs. HOT 6
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 ruby-netsnmp.