SNMP without MIBS?

522 views
Skip to first unread message

Raphael Konno

unread,
Nov 25, 2021, 2:58:39 PM11/25/21
to Prometheus Users
Hi, I have a question that might seem silly, but I think this is the best place to get it out, what happens if I try to capture information from a device via SNMP without the MIBS of that device?

I'm trying to monitor a Fortigate firewall, however there are some MIBS for these devices, however I still tried to monitor via SNMP and succeeded, but I suspect that the data is incorrect. I would like to know if it is possible to capture information without MIBS as this would make sure my information is incorrect.

Thanks in advance.

Brian Candler

unread,
Nov 26, 2021, 3:39:53 AM11/26/21
to Prometheus Users
[Note: this isn't really a question about prometheus]

You can capture information using SNMP without MIB files, just by querying a particular numeric OID.  But the data you get back may not make any sense to you.  You will be able to see the *type* of each datum - integer, string, IP Address etc - but will have a hard time ascribing a meaning to each one.

Using netsnmp, try:
snmpbulkwalk -On <device> 1.3.6.1.4.1
to walk the vendor-specific (enterprise) MIB for that device.  You may need to add authentication flags, e.g. "-v2c public", unless you have authentication configured in /etc/snmp/snmp.conf

Tristan Colgate

unread,
Nov 26, 2021, 4:17:05 AM11/26/21
to Brian Candler, Prometheus Users
You also won't get table indexes translated, which often contain useful context.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b9e1fd93-7b68-4940-9fff-942e97da98d0n%40googlegroups.com.

Adrian Popa

unread,
Nov 26, 2021, 4:54:59 AM11/26/21
to Tristan Colgate, Brian Candler, Prometheus Users
I'd like to extend the question to the following use case. I'm using NET-SNMP-EXTEND-MIB with snmpd to call some scripts and return some values via SNMP to our old SNMP monitoring system. Something like:
```
exec java_proc  /bin/bash       /home/java_mem_usage.sh
```
That I can query with:
```
[root@server ~]# snmpwalk -v2c -c secret_community localhost .1.3.6.1.4.1.2021.8.1.101.1
UCD-SNMP-MIB::extOutput.1 = STRING: 8829116416

What is the best way to have snmp_exporter scrape these manual OIDs for some servers? The generator won't add them because they're not part of its templates. I'm considering exposing the information via node_exporter's text file exporter, but it requires tweaking to bypass SNMP.

Thanks!

Ben Kochie

unread,
Nov 26, 2021, 5:04:56 AM11/26/21
to Prometheus Users
You might want to look at the https://github.com/bluecmd/fortigate_exporter, it uses the Fortigate REST API, rather than SNMP.

Brian Candler

unread,
Nov 26, 2021, 5:17:24 AM11/26/21
to Prometheus Users
On Friday, 26 November 2021 at 09:54:59 UTC adrian....@gmail.com wrote:
What is the best way to have snmp_exporter scrape these manual OIDs for some servers? The generator won't add them because they're not part of its templates.

By "templates" do you mean generator.yml?  This is what you're supposed to edit to add your new device types.  Hence the "right" way to do this is to get the Fortigate MIB, add the MIB sections you're interested in to generator.yml, and compile it using generator.

However, the generator *does* accept numeric OIDs, and indeed you can see some cases in generator.yml where it already does this because of ambiguities.  So if you want to specify just the numeric OID, that should work, at least for simple values.

(Aside: it looks like your Fortigate is doing something stupid by returning a number as a STRING.  I have a vague idea that there is a feature in snmp_exporter to deal with this.  Ah yes:

As for "for some servers" - do you mean for some and not others?  Then you create different entries in generator.yml.  Either for some devices you scrape module=A and others you scrape module=B; or for some devices you scrape module=A and for others you scrape module=A *and* module=B (in two separate scrapes, since snmp_exporter ignores repeated instances of the 'module' parameter)
 
I'm considering exposing the information via node_exporter's text file exporter, but it requires tweaking to bypass SNMP.


You wouldn't need to 'tweak' node_exporter itself, but you'd need to write a cronjob that does an SNMP poll and writes the data in metrics exposition format into a file in text file exporter directory.
I think it's worth the extra effort to use snmp_exporter directly for this, as there are fewer moving parts to monitor.

Adrian Popa

unread,
Nov 29, 2021, 3:05:10 AM11/29/21
to Brian Candler, Prometheus Users
Thank you for your advice, Brian!

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages