observium

This commit is contained in:
WickedYoda committed 2025-03-07 19:29:26 -06:00
1 parent 8ecbdcf71e
commit d4727f7970
3 files changed
+195

No files matched your search

+20
View File
@@ -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=()
+136
View File
@@ -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 <<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
cat >/etc/xinetd.d/observium_agent <<EOL
service observium_agent
{
type = UNLISTED
port = 36602
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/observium_agent
# configure the IPv[4|6] address(es) of your Observium server here:
only_from = $OBSERVIUM_HOST
# Don't be too verbose. Don't log every check. This might be
# commented out for debugging. If this option is commented out
# the default options will be used for this service.
log_on_success =
disable = no
}
EOL
cp observium/scripts/observium_agent /usr/bin/observium_agent
mkdir -p /usr/lib/observium_agent/local
if [ -z "$MODULES" ] || [ ${#MODULES[@]} -eq 0 ]; then
echo "No modules specified skipping..."
else
for mod in ${MODULES[@]}; do
cp observium/scripts/agent-local/$mod /usr/lib/observium_agent/local/
done
fi
/etc/init.d/xinetd restart
/etc/init.d/snmpd restart
+39
View File
@@ -0,0 +1,39 @@
# Observium-Agent
This is an install script for both the Enterprise and Community Editions which will setup the Observium Agent with the provided configuration. Note that this script currently only works for Debian/Ubuntu and Redhat based systems.
### Installation
To run the script from GitHub create file in your current directory named agent.conf.sh with executable permissions.
`sudo wget https://raw.githubusercontent.com/tkrause/Observium-Agent/master/agent.conf.sh`
Now download and run the setup script
`sudo wget https://raw.githubusercontent.com/tkrause/Observium-Agent/master/observium-agent-install.sh`
Note: You will need to edit agent.conf.sh to fit your configuration.
`sudo chmod +x agent.conf.sh observium-agent-install.sh`
Run the installer
`sudo ./observium-agent-install.sh`
### Agent Conf Options
`$SYSCONTACT` This option should be set to an email address in the format `Person Name <email@example.com>`.
`$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.