SNMP Client Configuration for Observvium

This can be placed in /etc/snmp/snmpd.conf and will provide the required parameters for Observium. This example use version 2c snmp auth.

Community string: 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

# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1

# Default access to full view
rocommunity community_string default -V all

# Default access to basic system info
#rocommunity public default -V systemonly

# System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>

# Disk Monitoring
disk / 10000
disk /var 5%
includeAllDisks 10%

# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5

# 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
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

# 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 latest version of distro script by:

sudo curl -o /usr/local/bin/distro https://gitlab.com/observium/distroscript/raw/master/distro

or

sudo wget -O /usr/local/bin/distro https://gitlab.com/observium/distroscript/raw/master/distro

make 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

Hardware/Vendor Detection- Minimum version

This feature available since version 19.2.9717
Mostly Linux/distributions already store system hardware, vendor and serial in /sys virtual filesystem.

Add this lines to the /etc/snmp/snmpd.conf for enable detection it:

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

Serial permissions

In some environments snmpd not have permission for read file /sys/devices/virtual/dmi/id/product_serial. Need to change file permission at boot by adding this command to /etc/rc.local: chmod 444 /sys/devices/virtual/dmi/id/product_serial
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"

Using ifAlias Support¶
If you would like to put descriptions on your interfaces on Debian GNU/Linux or one of its derivatives, you can use the script provided in scripts/snmp-extend/ifAlias_persist

Install additional package (for Debian/Ubuntu):

sudo apt-get install libsnmp-extension-passpersist-perl

Save it somewhere on the systems you want to return ifAliases (i.e. /usr/local/bin/ifAlias_persist), then add this into your snmpd.conf:

pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias_persist

Restart the SNMP daemon!

sudo service snmpd restart

Now you can put the descriptions into /etc/network/interfaces:

# eth0: Transit: YourISP Inc. Leased Line
iface eth0 inet static
# ....

On the next poll, Observium should then pick up your descriptions. (Don’t forget to restart snmpd after changing the configuration!)

Src: https://docs.observium.org/device_linux/

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.