prometheus / snmp_exporter

SNMP Exporter for Prometheus
Apache License 2.0
1.67k stars 617 forks source link

Makefile for generator does not download PDU-MIB.txt #675

Closed str8edgedave closed 1 year ago

str8edgedave commented 3 years ago

Using snmp-exporter 0.20.0, on Fedora 34, x86_64. The snmp-exporter is working. I needed to generate a new snmp.yml for a couple of extra MIBs (QNAP NAS, a TP-Link managed switch and an HP LaserJet). I had no difficulty compiling the generator, or running make mibs. However running ./generator generate fails:

[david@example generator]$ export MIBDIRS=mibs
[david@example generator]$ ./generator generate
level=info ts=2021-07-11T04:54:26.829Z caller=net_snmp.go:144 msg="Loading MIBs" from=mibs
level=info ts=2021-07-11T04:54:27.058Z caller=main.go:52 msg="Generating config for module" module=apcups
level=info ts=2021-07-11T04:54:27.081Z caller=main.go:67 msg="Generated metrics" module=apcups metrics=264
level=info ts=2021-07-11T04:54:27.081Z caller=main.go:52 msg="Generating config for module" module=arista_sw
level=info ts=2021-07-11T04:54:27.111Z caller=main.go:67 msg="Generated metrics" module=arista_sw metrics=91
level=info ts=2021-07-11T04:54:27.111Z caller=main.go:52 msg="Generating config for module" module=infrapower_pdu
level=info ts=2021-07-11T04:54:27.139Z caller=main.go:67 msg="Generated metrics" module=infrapower_pdu metrics=4
level=info ts=2021-07-11T04:54:27.139Z caller=main.go:52 msg="Generating config for module" module=raritan
level=warn ts=2021-07-11T04:54:27.156Z caller=tree.go:268 msg="Could not find node to override type" node=outletOperationalState
level=error ts=2021-07-11T04:54:27.156Z caller=main.go:130 msg="Error generating config netsnmp" err="cannot find oid '1.3.6.1.4.1.13742.4.1.2.2.1.3' to walk"

The Makefile for the SNMP generator does not pull down the MIB file for the Raritan PDU, as the file location has changed.

The location in the makefile is http://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt. This returns a 301 error:

[david@example generator]$ curl  http://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>

The updated url is https://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt:

[david@example generator]$ wget http://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt
--2021-07-10 22:57:48--  http://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt
Resolving cdn.raritan.com (cdn.raritan.com)... 52.84.169.80, 52.84.169.72, 52.84.169.73, ...
Connecting to cdn.raritan.com (cdn.raritan.com)|52.84.169.80|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt [following]
--2021-07-10 22:57:49--  https://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt
Connecting to cdn.raritan.com (cdn.raritan.com)|52.84.169.80|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 285986 (279K) [text/plain]
Saving to: ‘PDU-MIB.txt’

I downloaded the MIB file, copied it to the mibs directory and ran

[david@example generator]$./generator generate
level=info ts=2021-07-11T05:04:01.407Z caller=net_snmp.go:144 msg="Loading MIBs" from=mibs
level=info ts=2021-07-11T05:04:01.642Z caller=main.go:52 msg="Generating config for module" module=servertech_sentry4
level=info ts=2021-07-11T05:04:01.667Z caller=main.go:67 msg="Generated metrics" module=servertech_sentry4 metrics=50
level=info ts=2021-07-11T05:04:01.667Z caller=main.go:52 msg="Generating config for module" module=ubiquiti_unifi
level=info ts=2021-07-11T05:04:01.692Z caller=main.go:67 msg="Generated metrics" module=ubiquiti_unifi metrics=97
level=info ts=2021-07-11T05:04:01.692Z caller=main.go:52 msg="Generating config for module" module=kemp_loadmaster
level=info ts=2021-07-11T05:04:01.717Z caller=main.go:67 msg="Generated metrics" module=kemp_loadmaster metrics=141
level=info ts=2021-07-11T05:04:01.717Z caller=main.go:52 msg="Generating config for module" module=mikrotik
level=info ts=2021-07-11T05:04:01.736Z caller=main.go:67 msg="Generated metrics" module=mikrotik metrics=443
level=info ts=2021-07-11T05:04:01.736Z caller=main.go:52 msg="Generating config for module" module=cisco_wlc
level=info ts=2021-07-11T05:04:01.761Z caller=main.go:67 msg="Generated metrics" module=cisco_wlc metrics=62
level=info ts=2021-07-11T05:04:01.761Z caller=main.go:52 msg="Generating config for module" module=apcups
level=info ts=2021-07-11T05:04:01.786Z caller=main.go:67 msg="Generated metrics" module=apcups metrics=264
level=info ts=2021-07-11T05:04:01.786Z caller=main.go:52 msg="Generating config for module" module=arista_sw
level=info ts=2021-07-11T05:04:01.803Z caller=main.go:67 msg="Generated metrics" module=arista_sw metrics=91
level=info ts=2021-07-11T05:04:01.803Z caller=main.go:52 msg="Generating config for module" module=ubiquiti_airfiber
level=info ts=2021-07-11T05:04:01.827Z caller=main.go:67 msg="Generated metrics" module=ubiquiti_airfiber metrics=193
level=info ts=2021-07-11T05:04:01.827Z caller=main.go:52 msg="Generating config for module" module=printer_mib
level=info ts=2021-07-11T05:04:01.849Z caller=main.go:67 msg="Generated metrics" module=printer_mib metrics=13
level=info ts=2021-07-11T05:04:01.849Z caller=main.go:52 msg="Generating config for module" module=infrapower_pdu
level=info ts=2021-07-11T05:04:01.863Z caller=main.go:67 msg="Generated metrics" module=infrapower_pdu metrics=4
level=info ts=2021-07-11T05:04:01.863Z caller=main.go:52 msg="Generating config for module" module=servertech_sentry3
level=info ts=2021-07-11T05:04:01.885Z caller=main.go:67 msg="Generated metrics" module=servertech_sentry3 metrics=44
level=info ts=2021-07-11T05:04:01.885Z caller=main.go:52 msg="Generating config for module" module=ubiquiti_airmax
level=info ts=2021-07-11T05:04:01.909Z caller=main.go:67 msg="Generated metrics" module=ubiquiti_airmax metrics=122
level=info ts=2021-07-11T05:04:01.909Z caller=main.go:52 msg="Generating config for module" module=nec_ix
level=info ts=2021-07-11T05:04:01.934Z caller=main.go:67 msg="Generated metrics" module=nec_ix metrics=261
level=info ts=2021-07-11T05:04:01.934Z caller=main.go:52 msg="Generating config for module" module=raritan
level=info ts=2021-07-11T05:04:01.958Z caller=main.go:67 msg="Generated metrics" module=raritan metrics=11
level=info ts=2021-07-11T05:04:01.958Z caller=main.go:52 msg="Generating config for module" module=wiener_mpod
level=info ts=2021-07-11T05:04:01.971Z caller=main.go:67 msg="Generated metrics" module=wiener_mpod metrics=20
level=info ts=2021-07-11T05:04:01.971Z caller=main.go:52 msg="Generating config for module" module=liebert_pdu
level=info ts=2021-07-11T05:04:01.995Z caller=main.go:67 msg="Generated metrics" module=liebert_pdu metrics=117
level=info ts=2021-07-11T05:04:01.996Z caller=main.go:52 msg="Generating config for module" module=if_mib
level=info ts=2021-07-11T05:04:02.019Z caller=main.go:67 msg="Generated metrics" module=if_mib metrics=40
level=info ts=2021-07-11T05:04:02.019Z caller=main.go:52 msg="Generating config for module" module=paloalto_fw
level=info ts=2021-07-11T05:04:02.042Z caller=main.go:67 msg="Generated metrics" module=paloalto_fw metrics=228
level=info ts=2021-07-11T05:04:02.042Z caller=main.go:52 msg="Generating config for module" module=synology
level=info ts=2021-07-11T05:04:02.066Z caller=main.go:67 msg="Generated metrics" module=synology metrics=292
level=info ts=2021-07-11T05:04:02.066Z caller=main.go:52 msg="Generating config for module" module=ddwrt
level=info ts=2021-07-11T05:04:02.086Z caller=main.go:67 msg="Generated metrics" module=ddwrt metrics=111
level=info ts=2021-07-11T05:04:02.086Z caller=main.go:52 msg="Generating config for module" module=keepalived
level=info ts=2021-07-11T05:04:02.110Z caller=main.go:67 msg="Generated metrics" module=keepalived metrics=157
level=info ts=2021-07-11T05:04:02.476Z caller=main.go:92 msg="Config written" file=/home/dyaffe/go/pkg/mod/github.com/prometheus/snmp_exporter@v0.20.0/generator/snmp.yml
[dyaffe@ipa-02 generator]$ 

which completed successfully.

candlerb commented 3 years ago

This was fixed in commit 4307bbaf. Until the next release, you can take generator/Makefile from git.

jvillal-amp commented 1 year ago

Should this issue be closed? I think there has been a release since this was fixed.