Linux Device Configuration
Example Net-SNMP Configuration
This can be placed in /etc/snmp/snmpd.conf
and will provide the required parameters for Observium. This example uses version 2c
snmp auth.
Community string
Remember to replace community_string
with your unique community string.
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
# Full view access
view all included .1
# Default access to full view
rocommunity community_string default -V all
# System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>
# Disk Monitoring
includeAllDisks 10%
# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro
# This lines allows Observium to detect hardware, vendor and serial
# Common Linux:
extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /sys/devices/virtual/dmi/id/product_name
extend .1.3.6.1.4.1.2021.7890.3 vendor /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /sys/devices/virtual/dmi/id/product_serial
# Raspberry Pi:
#extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /proc/device-tree/model
#extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /proc/device-tree/serial
# This line allows Observium to collect an accurate uptime
extend uptime /bin/cat /proc/uptime
# This line enables Observium's ifAlias description injection
pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias_persist
Accurate Uptime
The pre-existing uptime values available via Net-SNMP are either inaccurate or will wrap after 1.5 years. To work around this we check for an entry in net-snmp's extend table for a custom uptime value.
Add this to /etc/snmp/snmpd.conf
of the device being monitored and restart snmpd.
extend uptime /bin/cat /proc/uptime
This is not required when using the Unix Agent.
Distribution Detection
Linux/Unix distribution detection is remarkably simple.
-
Put the
scripts/distro
file from your Observium installation into/usr/local/bin/distro
on the device to be monitored. -
You can fetch the latest version of the distro script with one of the following commands:
sudo curl -o /usr/local/bin/distro https://www.observium.org/files/distro sudo wget -O /usr/local/bin/distro https://www.observium.org/files/distro
-
Make the script executable:
sudo chmod +x /usr/local/bin/distro
-
Add this to the
/etc/snmp/snmpd.conf
file of the device to be monitored. This is already in the example configuration file above.extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro
-
If your snmpd does not like the
extend
line (this problem was observed on a particular version), you can also add this to the snmpd.conf file of the device to be monitored:exec .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro
-
Restart the SNMP daemon!
sudo service snmpd restart
Testing
You can test the script by walking the OID on the system:
snmpwalk -v2c -c <community> <hostname> .1.3.6.1.4.1.2021.7890.1
You should see output similar to the below :
UCD-SNMP-MIB::ucdavis.7890.1.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.7890.1.2.1.2.6.100.105.115.116.114.111 = STRING: "/usr/bin/distro"
UCD-SNMP-MIB::ucdavis.7890.1.2.1.3.6.100.105.115.116.114.111 = ""
UCD-SNMP-MIB::ucdavis.7890.1.2.1.4.6.100.105.115.116.114.111 = ""
UCD-SNMP-MIB::ucdavis.7890.1.2.1.5.6.100.105.115.116.114.111 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.7890.1.2.1.6.6.100.105.115.116.114.111 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.7890.1.2.1.7.6.100.105.115.116.114.111 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.7890.1.2.1.20.6.100.105.115.116.114.111 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.7890.1.2.1.21.6.100.105.115.116.114.111 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.7890.1.3.1.1.6.100.105.115.116.114.111 = STRING: "Linux|4.10.0-20-generic|amd64|Ubuntu|17.04|none"
UCD-SNMP-MIB::ucdavis.7890.1.3.1.2.6.100.105.115.116.114.111 = STRING: "Linux|4.10.0-20-generic|amd64|Ubuntu|17.04|none"
UCD-SNMP-MIB::ucdavis.7890.1.3.1.3.6.100.105.115.116.114.111 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.7890.1.3.1.4.6.100.105.115.116.114.111 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.7890.1.4.1.2.6.100.105.115.116.114.111.1 = STRING: "Linux|4.10.0-20-generic|amd64|Ubuntu|17.04|none"
Hardware/Vendor Detection
Minimum version
This feature is available beginning version 19.2.9717
Many Linux/distributions expose system hardware, vendor and serial in /sys
virtual filesystem.
-
Add these lines to the
/etc/snmp/snmpd.conf
to enable detection: -
Linux (common):
extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /sys/devices/virtual/dmi/id/product_name extend .1.3.6.1.4.1.2021.7890.3 vendor /bin/cat /sys/devices/virtual/dmi/id/sys_vendor extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /sys/devices/virtual/dmi/id/product_serial
-
Raspberry Pi (only):
extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /proc/device-tree/model #extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /proc/device-tree/serial
-
Restart the SNMP daemon!
sudo service snmpd restart
ifAlias Support
If you would like to put descriptions on your interfaces on Linux distributive, you can use the script provided in scripts/ifAlias.py
-
Install additional (python) package:
sudo pip install snmp_passpersist
-
Save it somewhere on the systems you want to return ifAliases (i.e.
/usr/local/bin/ifAlias.py
), then add this into yoursnmpd.conf
:pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias.py
-
Restart the SNMP daemon!
sudo service snmpd restart
-
Set interface alias.
-
Common Linux systems support
ip link set alias
command:
ip link set eth0 alias "Transit: YourISP Inc. Leased Line"
-
Generic Debian/Ubuntu:
You can put the descriptions into /etc/network/interfaces
# eth0: Transit: YourISP Inc. Leased Line
iface eth0 inet static
....
- FRR installs (https://frrouting.org/)
for access script to /etc/frr/frr.conf
you need add Debian-snmp
user to frr
and frrvty
groups:
```
sudo usermod -a -G frr,frrvty Debian-snmp
```
On the next poll, Observium should then pick up your descriptions. (Don't forget to restart snmpd after changing the configuration!)