Skip to content

Instantly share code, notes, and snippets.

@flamingsnowflake
Forked from d-a-n/observium_agent_setup.sh
Last active August 31, 2021 14:07
Show Gist options
  • Save flamingsnowflake/ab2a1460d293d8504c3cc381a04706e3 to your computer and use it in GitHub Desktop.
Save flamingsnowflake/ab2a1460d293d8504c3cc381a04706e3 to your computer and use it in GitHub Desktop.
Observium Agent Setup Guide
#credits: https://docs.observium.org/device_linux/
# 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
# the very basic SNMP config
rocommunity public 192.168.1.0/24
# Default access to full view
#rocommunity public 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
# 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
# get packages
apt-get install snmpd xinetd
mkdir -p /opt/observium && cd /opt
# not going to download all of observium every time - files are on public share
wget http://www.observium.org/observium-community-latest.tar.gz
tar zxvf observium-community-latest.tar.gz
# change /etc/default/snmpd
sed -e "/SNMPDOPTS=/ s/^#*/SNMPDOPTS='-Lsd -Lf \/dev\/null -u snmp -p \/var\/run\/snmpd.pid'\n#/" -i /etc/default/snmpd
# download distro script and move into place
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
mv distro /usr/bin/distro
chmod 755 /usr/bin/distro
# TEST
snmpwalk -v2c -c <community> <hostname> .1.3.6.1.4.1.2021.7890.1
# Now intall the agent:
cp observium/scripts/observium_agent_xinetd /etc/xinetd.d/observium_agent
# change "only_from" to match your observium server ip
nano /etc/xinetd.d/observium_agent
cp observium/scripts/observium_agent /usr/bin/observium_agent
mkdir -p /usr/lib/observium_agent/local
# copy all agent helper scripts that you want (bind, dpkg, freeradius, ksm, munin, mysql.cnf, ntpd, postfix_qshape, powerdns, rpm, shoutcast.conf, unbound, apache, crashplan, drbd, hddtemp, lmsensors, munin-scripts, nfs, nvidia-smi, postgresql.conf, powerdns-recursor, sabnzbd-qstatus, shoutcast.default.conf, vmwaretools, asterisk, dmi, exim-mailqueue.sh, ipmitool-sensor, memcached, mysql, nginx, postfix_mailgraph, postgresql.pl, raspberrypi, shoutcast, temperature)
# to make this work you have to enable the unix-agent module on your device's settings or globally in config.php ($config['poller_modules']['unix-agent'] = 1;)
cp observium/scripts/agent-local/AGENTHELPER /usr/lib/observium_agent/local/
/etc/init.d/xinetd restart
/etc/init.d/snmpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment