Skip to content

Instantly share code, notes, and snippets.

@arckosfr
Forked from ScuttleSE/observium_agent_setup.sh
Last active December 2, 2015 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arckosfr/5a9d6ace2fe0bfd4ecde to your computer and use it in GitHub Desktop.
Save arckosfr/5a9d6ace2fe0bfd4ecde to your computer and use it in GitHub Desktop.
# CONFIG
SNMP_COMMUNITY=public
SYSCONTACT=bschwartz
SYSLOCATION=Paris, France
# get packages
apt-get install snmpd xinetd nano
mkdir -p /opt/observium && cd /opt
wget http://www.observium.org/observium-community-latest.tar.gz
tar zxvf observium-community-latest.tar.gz
sed -e "/SNMPDOPTS=/ s/^#*/SNMPDOPTS='-Lsd -Lf \/dev\/null -u snmp -p \/var\/run\/snmpd.pid'\n#/" -i /etc/default/snmpd
cp observium/scripts/distro /usr/bin/distro
chmod 755 /usr/bin/distro
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
cat >/etc/snmp/snmpd.conf <<EOL
com2sec readonly default $SNMP_COMMUNITY
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none
syslocation $SYSLOCATION
syscontact $SYSCONTACT
#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/bin/distro
EOL
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/
cp /opt/observium/scripts/agent-local/dpkg /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