Skip to content

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.

Text Only
#  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 distro /usr/local/bin/distro

# These lines allow Observium to detect hardware, vendor and serial
# Common Linux:
extend hardware /bin/cat /sys/devices/virtual/dmi/id/product_name
extend vendor   /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
extend serial   /bin/cat /sys/devices/virtual/dmi/id/product_serial

# Raspberry Pi:
#extend hardware /bin/cat /proc/device-tree/model
#extend 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
# Require install python package: snmp_passpersist
pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias.py

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.

Text Only
extend uptime /bin/cat /proc/uptime

This is not required when using the Unix Agent.

Distribution Detection

Install the latest distro script on the device to be monitored:

Bash
sudo curl -fLo /usr/local/bin/distro https://www.observium.org/files/distro
sudo chmod +x /usr/local/bin/distro

Alternatively, use wget:

Bash
sudo wget -O /usr/local/bin/distro https://www.observium.org/files/distro
sudo chmod +x /usr/local/bin/distro

Add the following line to /etc/snmp/snmpd.conf:

Text Only
extend distro /usr/local/bin/distro

This exposes the result through the standard NET-SNMP-EXTEND-MIB. Restart the SNMP daemon after changing the configuration:

Bash
sudo service snmpd restart

Testing

Walk the standard Net-SNMP extend tree from the Observium server:

Bash
snmpwalk -v2c -c <community> <hostname> .1.3.6.1.4.1.8072.1.3.2

The output should include the distro value in NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."distro":

Text Only
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."distro" = STRING: Linux|5.15.0-91-generic|amd64|Ubuntu|22.04.5||

Testing legacy configurations

Older installations using the prefixed extend configuration remain supported:

Text Only
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro

Check its exact output OID with:

Bash
snmpget -v2c -c <community> <hostname> .1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111

For a legacy exec configuration, use:

Text Only
exec .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro
Bash
snmpget -v2c -c <community> <hostname> .1.3.6.1.4.1.2021.7890.1.101.1

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.

  1. Add these lines to the /etc/snmp/snmpd.conf to enable detection:

  2. Linux (common):

    Text Only
    1
    2
    3
    extend hardware /bin/cat /sys/devices/virtual/dmi/id/product_name
    extend vendor   /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
    extend serial   /bin/cat /sys/devices/virtual/dmi/id/product_serial
    
  3. Raspberry Pi / Orange Pi (only):

    Text Only
    extend hardware /bin/cat /proc/device-tree/model
    #extend serial   /bin/cat /proc/device-tree/serial
    
  4. Restart the SNMP daemon!

    Text Only
    sudo service snmpd restart
    

Existing installations using the legacy .1.3.6.1.4.1.2021.7890.2 through .1.3.6.1.4.1.2021.7890.4 prefixes continue to be supported.

Warning

In some environments snmpd won't have permissions to read /sys/devices/virtual/dmi/id/product_serial. Permissions need to be changed at boot by adding this command to /etc/rc.local

chmod 444 /sys/devices/virtual/dmi/id/product_serial

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

  1. Install additional (python) package:

    Text Only
    1
    sudo pip install snmp_passpersist
    
  2. Save it somewhere on the systems you want to return ifAliases (i.e. /usr/local/bin/ifAlias.py), then add this into your snmpd.conf:

    Text Only
    1
    pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias.py
    
  3. Restart the SNMP daemon!

    Text Only
    1
    sudo service snmpd restart
    
  4. Set interface alias.

  5. Common Linux systems support ip link set alias command:

Text Only
ip link set eth0 alias "Transit: YourISP Inc. Leased Line"
  • Generic Debian/Ubuntu:

    You can put the descriptions into /etc/network/interfaces

Text Only
1
2
3
# eth0: Transit: YourISP Inc. Leased Line
iface eth0 inet static
  ....

for access script to /etc/frr/frr.conf you need add Debian-snmp user to frr and frrvty groups:

Text Only
1
2
3
```
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!)