From d4727f79705285f5e28c5da361ad828ad120e0cb Mon Sep 17 00:00:00 2001 From: WickedYoda <68271168+wickedyoda@users.noreply.github.com> Date: Fri, 7 Mar 2025 19:29:26 -0600 Subject: [PATCH] observium --- observium/agent.config.sh | 20 ++++ observium/observium-agent-install.sh | 136 +++++++++++++++++++++++++++ observium/readme.md | 39 ++++++++ 3 files changed, 195 insertions(+) create mode 100644 observium/agent.config.sh create mode 100644 observium/observium-agent-install.sh create mode 100644 observium/readme.md diff --git a/observium/agent.config.sh b/observium/agent.config.sh new file mode 100644 index 0000000..93b7d7c --- /dev/null +++ b/observium/agent.config.sh @@ -0,0 +1,20 @@ +#!/bin/bash +SNMP_COMMUNITY="" +SYSCONTACT="" +SYSLOCATION="" + +SVN_USER="" +SVN_PASS="" + +OBSERVIUM_HOST="" + +# Fill with a list of modules you would like to use from /opt/observium/scripts/agent-local +# at the time of writing available options are: +# +# apache areca-hw asterisk bind crashplan dmi +# dpkg drbd edac exim-mailqueue.sh freeradius hdarray hddtemp ipmitool-sensor jvm-over-jmx ksm +# lmsensors memcached munin munin-scripts mysql mysql.cnf nfs nfsd nginx ntpd nvidia-smi +# postfix_mailgraph postfix_qshape postgresql.conf postgresql.pl powerdns powerdns-recursor +# raspberrypi README rpm sabnzbd-qstatus shoutcast shoutcast.conf shoutcast.default.conf +# temperature unbound varnish vmwaretools zimbra +MODULES=() \ No newline at end of file diff --git a/observium/observium-agent-install.sh b/observium/observium-agent-install.sh new file mode 100644 index 0000000..c8ca21d --- /dev/null +++ b/observium/observium-agent-install.sh @@ -0,0 +1,136 @@ +#!/bin/bash + +CONFIG="agent.conf.sh" +ENTERPRISE=true +PKG_MANAGERS=(apt-get zypper yum) + +if [ ! -f $CONFIG ]; then + echo "agent.conf.sh not found or not readable" + exit 1 +fi + +source $CONFIG + +# Which Distro are we running on... +if [ -z "$PKG_MANAGERS" ] || [ ${#PKG_MANAGERS[@]} -eq 0 ]; then + echo "Error! No package managers specified" + exit 1 +else + for pkg in ${PKG_MANAGERS[@]}; do + TEST=`which $pkg` + if [ $? -eq 0 ]; then + PKG_MAN=$pkg + break + fi + done +fi + +if [ -z "$PKG_MAN" ]; then + echo "No package manager found on this system!" + exit 1 +fi + +if [ -z "$SYSCONTACT" ]; then + echo "No system contact specified" + exit 1 +fi + +if [ -z "$SYSLOCATION" ]; then + echo "No system location specified" + exit 1 +fi + +if [ -z "$SNMP_COMMUNITY" ]; then + echo "No SNMP Community specified" + exit 1 +fi + +if [ -z "$OBSERVIUM_HOST" ]; then + echo "No Observium Server IP or hostname specified" + exit 1 +fi + +if [ -z "$SVN_USER" ] || [ -z "$SVN_PASS" ]; then + $ENTERPRISE = false +fi + +if [ "$ENTERPRISE" = true ]; then + echo "Installing Enterprise Agent..." + echo + $PKG_MAN install subversion snmpd xinetd +else + echo "Installing Community Agent..." + echo + $PKG_MAN install snmpd xinetd +fi + +cd /opt + +if [ "$ENTERPRISE" = true ]; then + svn --username $SVN_USER --password $SVN_PASS co http://svn.observium.org/svn/observium/branches/stable observium +else + mkdir -p /opt/observium && cd /opt + + wget http://www.observium.org/observium-community-latest.tar.gz + tar zxvf observium-community-latest.tar.gz +fi + +if [ -f "/etc/defaults/snmpd" ]; then + sed -e "/SNMPDOPTS=/ s/^#*/SNMPDOPTS='-Lsd -Lf \/dev\/null -u snmp -p \/var\/run\/snmpd.pid'\n#/" -i /etc/default/snmpd +fi + +if [ -f "/etc/sysconfig/snmpd.options" ]; then + sed -e "/SNMPDOPTS=/ s/^#*/SNMPDOPTS='-Lsd -Lf \/dev\/null -u snmp -p \/var\/run\/snmpd.pid'\n#/" -i /etc/sysconfig/snmpd.options +fi + +mv /opt/observium/scripts/distro /usr/bin/distro +chmod 755 /usr/bin/distro + +mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak +cat >/etc/snmp/snmpd.conf </etc/xinetd.d/observium_agent <`. + +`$SYSLOCATION` For best results, set to a street address or geolocation that can be found on Google Maps. + +`$SNMP_COMMUNITY` Set to the SNMP Community you would like to use to access this system from Observium. + +`$OBSERVIUM_HOST` Set to the IP Address or Hostname of your Observium Server. This will be used to limit connection to be only from this host. + +`$MODULES` (optional, array) Set to a space delimited list of modules you would like to install. These are simply the file names from `observium/scripts/agent-local/`. Excluding this option from the config will result in no extra modules being installed. A list is provided in agent.conf.sh however you can retrieve an updated list by running `ls -l /opt/observium/scripts/agent-local/ | tr -s ' ' | cut -d ' ' -f9` on your Observium Server + +`$SVN_USER` (optional) Set to the username provided by Observium when you purchased your Enterprise License. Excluding this option from the config will result in using the Community Edition. + +`$SVN_PASS` (optional) Set to the password provided by Observium when you purchased your Enterprise License. Excluding this from the config will result in using the Community Edition. + +### FAQ +1. I'm prompted "Attention! Your password for authentication realm:" what do I do? + +You can safely say "no" to allow it to encrypt your SVN password for future use. \ No newline at end of file