SNMP device not reachable : "Request timeout"
Opened this issue ยท 4 comments
Hello ๐
I am trying to set up a device-snmp with EdgeX to acquire some data. Everything is done using version 1.3.1
. I'm still at the PoC stage, so I am mocking a device using snmpsim.
The issue
The device-snmp is so far failing to acquire any data from the mocked device. Here are the logs:
dgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:31:59.288215646Z app=device-snmp-go_snmp-test source=executor.go:55 msg="AutoEvent - executing {\"frequency\":\"1s\",\"resource\":\"HelloWorld\"}"
edgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:31:59.288330539Z app=device-snmp-go_snmp-test source=command.go:138 msg="Handler - execReadCmd: deviceResource: HelloWorld"
edgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:31:59.288410389Z app=device-snmp-go_snmp-test source=snmpdriver.go:65 1024= msg="Port %s"
edgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:31:59.288454111Z app=device-snmp-go_snmp-test source=snmpdriver.go:66 172.17.0.1= msg=Address
edgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:31:59.288499128Z app=device-snmp-go_snmp-test source=snmpdriver.go:71 msg="SNMPDriver.HandleReadCommand: device: test-snmp-device operation: HelloWorld attributes: map[community:sample oid:1.3.6.1.2.1.1.1.0]"
edgex-device-snmp-test | level=ERROR ts=2021-07-19T13:32:29.289741645Z app=device-snmp-go_snmp-test source=snmpdriver.go:91 msg="SNMPDriver.HandleReadCommands; Request timeout (after 3 retries)"
edgex-device-snmp-test | level=DEBUG ts=2021-07-19T13:32:29.290076447Z app=device-snmp-go_snmp-test source=utils.go:295 msg="Update of last connected times is disabled for: test-snmp-device"
My configuration
Attached to this issue are all the config files device-snmp-config.zip Here are the highlights:
snmpsim
exposes an OID1.3.6.1.2.1.1.1.0
which returns the stringHello world
.snmpsim
runs natively on my Ubuntu machine and the Edgex microservices run with Docker, using abridge
network.- I started
snmpsim
with endpoint172.17.0.1:1024
. I gave the same IP address and port to the device provisioned in the DeviceList:
[[DeviceList]]
Name = 'test-snmp-device'
Profile = 'test-snmp-profile'
Description = 'device snmp de test'
Labels = [ '' ]
[DeviceList.Protocols]
[DeviceList.Protocols.TCP]
Address = '172.17.0.1'
Port = '1024'
[[DeviceList.AutoEvents]]
Frequency = '1s'
OnChange = false
Resource = 'HelloWorld'
- The mocked snmp device uses community name "sample", which is the same as in the device profile:
name: "test-snmp-profile"
manufacturer: ""
model: "NHL-FB2"
labels:
- "snmp"
description: "profil test snmp"
deviceResources:
-
name: HelloWorld
description: "get Hello world"
attributes:
{ oid: "1.3.6.1.2.1.1.1.0", community: "sample" }
properties:
valueType: "String"
readWrite: "R"
The debugging I tried
At first I thought the problem was related to some networking misconfiguration. However, I entered in the device-snmp running container and was able to acquire the data from my mocked device using snmpwalk command:
snmpwalk -v2c -c sample 172.17.0.1:1024 1.3.6.1.2.1.1.1.0
which yielded the correct payload: SNMPv2-MIB::sysDescr.0 = STRING: Hello world
I suspect my problem is either my Edgex configuration is wrong, or that there is a bug inside device-snmp. Am I missing something?
Thank you,
Sam
@stlaperriere - try setting your ServiceBindAddress to '0.0.0.0' in the configuration toml.
This is the interface on which the service's REST server should listen. By default the server is to listen on the interface to which the Host option resolves (leaving it blank). A value of 0.0.0.0 means listen on all available interfaces.
I have the same issue.
What I found out is that the constant COMMUNITY_ACCESS in const.go is defined as "private". It get's applied directly without considering the community attribute defined in the device profile. See for example snmpclient.go - GetValues.
As a result currently only attributes with the default community "private" seem to work.
In my case, changing the constant to "public" (as this is used in my device profile) resolved the issue.
hey guys, Im having a similar problem like this issue. I
m on Napa version and trying to read some public addresses on a snmp client and some time it works and others don`t, but this post kind of explains why i was having this problem, the client support both private and public requests.
this is the log i got from the terminal?
edgex-ui-go | /core-command/api/v3/device/name/ATS03/Output voltage edgex-device-snmp | level=DEBUG ts=2024-09-08T22:06:46.055733011Z app=device-snmp source=snmpdriver.go:77 161= msg="Port %s" edgex-device-snmp | level=DEBUG ts=2024-09-08T22:06:46.055907052Z app=device-snmp source=snmpdriver.go:78 192.168.9.251= msg=Address edgex-device-snmp | level=DEBUG ts=2024-09-08T22:06:46.056251801Z app=device-snmp source=snmpdriver.go:86 msg="SNMPDriver.HandleReadCommand: device: ATS03 operation: OutputVoltage attributes: map[community:private oid:1.3.6.1.4.1.534.10.2.2.3.1.0 size:4]" edgex-ui-go | 2024/09/08 22:06:51 http: proxy error: context deadline exceeded edgex-core-command | level=ERROR ts=2024-09-08T22:06:51.058293176Z app=core-command source=http.go:47 X-Correlation-ID=fb8c231e-66cc-409c-b904-3531dd93171e msg="request failed, status code: 503, err: <html><head><title>Timeout</title></head><body><h1>Timeout</h1></body></html>" edgex-core-command | level=DEBUG ts=2024-09-08T22:06:51.058522884Z app=core-command source=http.go:49 X-Correlation-ID=fb8c231e-66cc-409c-b904-3531dd93171e msg="[github.com/edgexfoundry/edgex-go/internal/core/command/application/command.go]-github.com/edgexfoundry/edgex-go/internal/core/command/application.IssueGetCommandByName(line 223): -> [github.com/edgexfoundry/go-mod-core-contracts/v3@v3.1.0/clients/http/deviceservicecommand.go]-github.com/edgexfoundry/go-mod-core-contracts/v3/clients/http.(*deviceServiceCommandClient).GetCommand(line 47): -> [github.com/edgexfoundry/go-mod-core-contracts/v3@v3.1.0/clients/http/utils/request.go]-github.com/edgexfoundry/go-mod-core-contracts/v3/clients/http/utils.GetRequestAndReturnBinaryRes(line 67): request failed, status code: 503, err: <html><head><title>Timeout</title></head><body><h1>Timeout</h1></body></html>" edgex-core-command | level=ERROR ts=2024-09-08T22:06:51.058740217Z app=core-command source=encoding.go:37 msg="Error encoding the data: context canceled" edgex-device-snmp | level=DEBUG ts=2024-09-08T22:07:01.439847194Z app=device-snmp source=reporter.go:195 msg="Publish 0 metrics to the
from what i understand the code is sending a request( and i see the ethernet led blinking) and receiving , but it can decode it .
I would like to know if this problem is solved in the odessa version?
this issue is marked help wanted
to seek if there is any contributor can help fix this.