-
Notifications
You must be signed in to change notification settings - Fork 630
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
exporter crash upon using module #855
Comments
Hey I believe the error is the data type as mentioned in the logs :
From https://www.rfc-editor.org/rfc/rfc3416
My take would be, this type cannot be looked up to do mapping ? @PrestonTaylor Do you have any error when generating the snmp file btw ? On my side when using the snipped provided I have the following warning : So far I have:
NB: I had to download https://www.circitor.fr/Mibs/Html/T/TIMETRA-GLOBAL-MIB.php to be able to generate the snmp.yaml with this Other option would be to provide the snmp.yaml snippet used. Last thing, do you have a snmprec file to feed my snmpsim locally so I'll be able to test further ? |
Thanks for taking the time on this one. generator log , I get the same warning but the number of "errors" remains the same if I include the lookup or not.
Example of generator output (sorry, you can ignore the extra lookups, they make no difference if they are there or not)
snmprec: All Nokia/ALU/Timetra MIBs for this hardware: |
Hi there, I gave a try and yes I can reproduce on the main branch, which was expected. I would like to confirm first what is your intent here, you would like to have extra label in the prometheus output ?
If so then the issue we have is how to format it. A smpwalk (from the snmprec given) return something like We can see in the code link that if
We could set
@SuperQ @beorn7 Any advice on the last part on how to convert this ? I could make a PR out of that, it's a relative simple fix |
Hmmm, doing a lookup on Bits is interesting. Yea, I'm not sure what the intended use case is here. Handling Bits as a |
tmnxWlanGwUeQryWhereState Is just another column in the same table, it actually maps to a value in the MIB like this
Whether it returns as Either way isn't a huge deal to me, obviously the string makes for simpler transition to the presentation layer if the functionality already exists (I believe this is already in NetSNMP?), otherwise probably not worth the effort and simple output as hex is perfectly fine. I recognize I'm using some pretty exotic OIDs and this isn't a an absolute must have for me to use the exporter as I can modify the names of tmnxWlanGwUeQryName to be descriptive enough cover the need so if this is a big lift it may not be worth the effort for you guys or may be more productive to just fix the service crashing. Let me know your thoughts. |
I don't have enough context about SNMP to make a call about the best way. But definitely we don't want the exporter to crash under these circumstances. :) |
I did some test and I changed :
snmp.yaml is the following (replace
Without the
with the
As you can see, based on the snmprec you gave me, not all values are mapped. So I am not sure if it is normal / expected. If this is what we expect then there is a fix to do in the generator to add enum in lookup and to treat If that's not we can still stick to the |
Wow I just noticed that, that's bizarre. An plain old snmpwalk gets this,
However if I reference the mib explicitly and ask it to perform lookups (snmpwalk -m TIMETRA-WLAN-GW-MIB) I get this
somehow netsnmp is figuring that out from the MIB, but as to how 128==0 and 64==1.... no idea. |
I just figured it out, it's a list of items and it matches on the n bit specified by the MIB for example C2=11000010 This complicates things even from my side, I didn't plan to use it like this and even if I did I don't know how it should look. This does appear to be a standard but I totally understand any hesitance to implement it. LMK what you guys think. I will probably opt to not put this in a lookup. |
The implementation is pretty strange, because the way you interpret the value depend on the value size, and the maximum size is 12 bits. The value is a stack to "unpack", I would have expect a fixed size value and do bit masking. This also mean that the bDataTriggered flag is always true when the value is not 0. Since we start reading at the first non null bit. Unless we only consider the last flag in the value ? If that's not clear, here is a golang playground illustrating it. Coming back to the fix, I agree it might be better to consider OctetString for now as I am not sure this transformation is accurate. Always better return a "raw" but correct value (what's on the wire) than something incorrectly transformed. |
I think this is fixed now. |
Host operating system: output of
uname -a
Linux someserver 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
snmp_exporter version: output of
snmp_exporter -version
I'm using #624
What device/snmpwalk OID are you using?
1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.200
with
however a lookup of tmnxWlanGwUeQryName (1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.27) works fine
If this is a new device, please link to the MIB(s).
Not sure where to find publicly, it's quite rare I can share via this https://drive.google.com/file/d/1MkizXzWaEokQTLpQSGFKQsBJMv-6UbY_/view?usp=share_link
What did you do that produced an error?
error ocurrs only when I include the lookup
What did you expect to see?
minimum: no crash, ideally: no error and valid data returned. using snmpwalk and manageengine MIBBrowser I can walk this table without issue
What did you see instead?
Mar 20 18:56:04 myexporterserver snmp_exporter: ts=2023-03-20T22:56:04.339Z caller=main.go:98 level=debug module=mymodule target=someserver msg="Starting scrape"
Mar 20 18:56:04 myexporterserver snmp_exporter: ts=2023-03-20T22:56:04.358Z caller=collector.go:243 level=debug module=mymodule target=someserver msg="Walking subtree" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.200
Mar 20 18:56:05 myexporterserver snmp_exporter: ts=2023-03-20T22:56:05.413Z caller=collector.go:256 level=debug module=mymodule target=someserver msg="Walk of subtree completed" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.200 duration_seconds=1.055329302s
Mar 20 18:56:05 myexporterserver snmp_exporter: ts=2023-03-20T22:56:05.413Z caller=collector.go:243 level=debug module=mymodule target=someserver msg="Walking subtree" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.27
Mar 20 18:56:06 myexporterserver snmp_exporter: ts=2023-03-20T22:56:06.253Z caller=collector.go:256 level=debug module=mymodule target=someserver msg="Walk of subtree completed" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.27 duration_seconds=839.801075ms
Mar 20 18:56:06 myexporterserver snmp_exporter: ts=2023-03-20T22:56:06.253Z caller=collector.go:243 level=debug module=mymodule target=someserver msg="Walking subtree" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.3
Mar 20 18:56:07 myexporterserver snmp_exporter: ts=2023-03-20T22:56:07.093Z caller=collector.go:256 level=debug module=mymodule target=someserver msg="Walk of subtree completed" oid=1.3.6.1.4.1.6527.3.1.2.81.1.11.3.1.3 duration_seconds=839.986217ms
Mar 20 18:56:07 myexporterserver snmp_exporter: panic: Unknown index type Bits
Mar 20 18:56:07 myexporterserver snmp_exporter: goroutine 32 [running]:
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/snmp_exporter/collector.indexOidsAsString({0xc0002b2870, 0x2, 0x2}, {0xc00025b2d8, 0xe5ce00}, 0x0, 0x0, 0xc000147478)
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/snmp_exporter/collector/collector.go:845 +0xd39
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/snmp_exporter/collector.pduValueAsString(0xc0001475b8, {0xc00025b2d8, 0xc0000b0000})
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/snmp_exporter/collector/collector.go:734 +0x477
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/snmp_exporter/collector.indexesToLabels({0xc000258380, 0x1, 0x10}, 0xc000263d80, 0x0)
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/snmp_exporter/collector/collector.go:876 +0x505
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/snmp_exporter/collector.pduToSamples({0xc000258380, 0x1, 0x10}, 0xc000147be8, 0xc000263d80, 0x0, {0xa8c120, 0xc000080550})
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/snmp_exporter/collector/collector.go:501 +0x74
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/snmp_exporter/collector.collector.Collect({{0xa9ab10, 0xc0000a2240}, {0xc0000aa086, 0x2a}, 0xc000115c20, {0xa8c120, 0xc000080550}}, 0xc000082840)
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/snmp_exporter/collector/collector.go:419 +0x817
Mar 20 18:56:07 myexporterserver snmp_exporter: github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:446 +0x102
Mar 20 18:56:07 myexporterserver snmp_exporter: created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
Mar 20 18:56:07 myexporterserver snmp_exporter: /home/centos/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:457 +0x4e8
Mar 20 18:56:07 myexporterserver systemd: snmp_exporter.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 20 18:56:07 myexporterserver systemd: Unit snmp_exporter.service entered failed state.
Mar 20 18:56:07 myexporterserver systemd: snmp_exporter.service failed.
The text was updated successfully, but these errors were encountered: