Using SNMP OIDs with Hosts
Video Lecture
Description
I configure one of my hosts to use a more sophisticated SNMP template. There will be some problems since there will be many OIDs that my existing SNMPD won't allow. I will need to allow less restrictive SNMP OID prefixes in the SNMPD process, and then restart.
Zabbix SNMP Agent Item
In Zabbix, an SNMP agent item behaves similar to a passive check in the way that the Zabbix server will initiate the request for the data to the host. But it will also need an extra OID parameter.
E.g., 1.3.6.1.2.1.1.1.0
And this OID should return a string describing the operating system.
E.g.,
iso.3.6.1.2.1.1.1.0 = STRING: "Linux host-A 5.4.0-97-generic #110-Ubuntu SMP Thu Jan 13 18:22:13 UTC 2022 x86_64"
There are many OIDs providing access to specific values on a host that can be returned by an SNMPD agent running on that host, printer, router, etc.
We can test if a specific OID is returnable by requesting if from the command line first using the snmpget
tool.
snmpget -v2c -cmycommunity ###.###.###.### 1.3.6.1.2.1.1.1.0
If it doesn't work using the snmpget
tool, then it is unlikely to work when being requested by Zabbix.
Troubleshooting
If you see the error No Such Object available on this agent at this OID
. It may just be true. But if you are sure that it exists, then possibly the SNMPD is not allowing this OID to be returned. In the snmpd.conf
file you can set the OID roots to allow it to be returned.
E.g., if you wanted to query the Linux Free Memory OID 1.3.6.1.4.1.2021.4.6.0
snmpget -v2c -cmycommunity ###.###.###.### .1.3.6.1.4.1.2021.4.6.0
and you got the error
No Such Object available on this agent at this OID
You can check the SNMPD configuration to see which base OIDs it is allowing read access for.
E.g., by default, the read only settings are,
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
By default, .1.3.6.1.4.1.2021.4.6.0
is not allowed. Only the OIDs with those two prefixes listed above are allowed to be queried.
You could add an extra line to allow the .1.3.6.1.4.1
prefix,
1 2 3 |
|
Restart the SNMPD service
sudo service snmpd restart
And now the snmpget
query would work, and so now should Zabbix, also be able to query the OID from the host.
If you are not querying the SNMPD on a host, but a dedicated SNMPD service running on a printer, router, etc., then the configuration options for your proprietary SNMP device may have a manual that you can refer to make allow/disallow certain OID prefixes.