Comments (7)
This is expected. Because UDP is a connectionless protocol, there's no actual connection created. The Connect()
method simply creates and opens the socket. Until something is sent across it, you don't know that the remote host is there and responding.
Even if you were able to detect that the remote host is there on Connect()
, it could go away by the time you sent something. And it could also come back again at any time.
from gosnmp.
I'm overseas at the moment, can I
look it later?
On 15 June 2016 at 20:10, Toni Moreno [email protected] wrote:
Hi @soniah https://github.com/soniah . I'm building some improvements
in mi snmpcollector, I would like detect when snmp device is offline to try
do periodic re-connections.When doing the first connection it returns non nil value , but my snmpd
daemon is stoppedhttps://github.com/toni-moreno/snmpcollector/blob/master/pkg/snmp.go#L172
After when trying to do a bulkwalk the client detects errors.
INFO[0000] First SNMP connection to host hostsnmpv3b stablished <--here first gosnmp.Connect()
INFO[0000] Filter not found for measurement:i linux_cpu
INFO[0000] Loading Indexed values in : linux_ports
FATA[0000] SNMP bulkwalk error Error reading from UDP: read udp 127.0.0.1:55412->127.0.0.1:161: read: connection refusedCan you review if I'm doing something wrong ?
Thank you very much
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#65, or mute the thread
https://github.com/notifications/unsubscribe/AADbJmx1pBjrn4cy6SE8e_1NHVGxhkEqks5qMIZZgaJpZM4I24d5
.
from gosnmp.
yes of course! thank you !!
from gosnmp.
@phemmer is correct. UDP is stateless, so unless you build your own 'connection' construct on top of it, all you get when you 'Connect()' is a listening socket where you can send data and where you can try and receive data.
What I suspect you would want to do is attempt to poll the device; if it returns an error or a value, then you can consider it online.
I'd suggest this issue is closed.
from gosnmp.
Closed - see comments about UDP being stateless. Thank you @toni-moreno @phemmer @schotlandzegtja for your request and comments :-)
from gosnmp.
Hi @phemmer and @soniah IMHO if we are working only with a connectionless protocol the gonsmp.Connect() is not a good API Method name, could be better something like gosnmp.PrepareProtocol()
When I did the first Connect() I expect the method can do something in the server side to give me an idea that server side is ok.
IMHO the documentation also give us an erroneous idea on what this method does.
https://godoc.org/github.com/soniah/gosnmp#GoSNMP.Connect
What do you think about?
from gosnmp.
Thank you Toni. I've updated the documentation:
Connect creates and opens a socket. Because UDP is a connectionless protocol, you won't know if the remote host is responding until you send packets. And if the host is regularly disappearing and reappearing, you won't know if you've only done a Connect().
For historical reasons (ie this is part of the public API), the method won't be renamed.
from gosnmp.
Related Issues (20)
- 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`
- Using SnmpDecodePacket for Encrypted/Authenticated Packets in GoSNMP HOT 5
- Retry netConnect() on resolution failure HOT 2
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.