-
Notifications
You must be signed in to change notification settings - Fork 75
Installing Adagios from source on Debian
This document describes how to install adagios from source on debian based systems.
Note: The preferred way is to install adagios via debian packages. only use this guide if you know what you are doing !
Install nagios3 and mk-livestatus if you don't already have it:
apt-get install nagios3 check-mk-livestatusInstall Dependencies:
apt-get install git apache2 libapache2-mod-wsgi python-django python-simplejson pnp4nagios libgmp-dev python-dev python-paramikoPynag package is only available on Debian Sid at the moment. For Debian Squeeze, Wheezy and Jessie, you need install pynag with pip. Install python-pip if needed :
apt-get install python-pipAnd install pynag
pip install pynagGet latest bleeding-edge source from github:
cd /opt/
git clone https://github.com/opinkerfi/adagios.gitCreate a configuration directory for adagios and edit paths:
cp -r /opt/adagios/adagios/etc/adagios /etc/
chown -R nagios /etc/adagios/
cd /etc/adagios
sed -i 's|/etc/nagios/nagios.cfg|/etc/nagios3/nagios.cfg|;' adagios.conf
sed -i 's|sudo /etc/init.d/nagios|sudo /etc/init.d/nagios3|;' adagios.conf
sed -i 's|nagios_url = "/nagios"|nagios_url = "/nagios3"|;' adagios.confEnable mk-livestatus broker_module and restart nagios to load new configuration:
pynag config --append "broker_module=/usr/lib/check_mk/livestatus.o /var/lib/nagios3/rw/livestatus"
pynag config --append cfg_dir=/etc/adagios
service nagios3 reloadConfigure Apache to load Adagios in wsgi:
cat << EOF > /etc/apache2/conf.d/adagios.conf
WSGISocketPrefix /var/run/apache2/wsgi
WSGIDaemonProcess adagios user=nagios group=nagios processes=1 threads=25 python-path=/opt/adagios:/opt/adagios/adagios
WSGIProcessGroup adagios
WSGIScriptAlias /adagios /opt/adagios/adagios/apache/adagios.wsgi
Alias /adagios/media /opt/adagios/adagios/media
<Location /adagios>
AuthName "Adagios Access"
AuthType Basic
AuthUserFile /etc/nagios3/htpasswd.users
Require valid-user
</Location>
EOFCreate your user, replace adagios with your username and securepassword with a randomly generated, secure password:
htpasswd -b /etc/nagios3/htpasswd.users adagios securepasswordRestart Apache:
service apache2 restartOpen your browser and go to http://127.0.0.1/adagios
The okconfig plugin, which is required if you want to use adagios' REST API is installed as follows:
cd /opt
git clone git://github.com/opinkerfi/okconfig.git
cd okconfig
sudo python setup.py install
okconfig init
# Use this to verify installation
okconfig verify
Once installed restart Apache in order to load all the new modules:
service apache2 restart
Open your browser and go to http://127.0.0.1/adagios, you should see a new item named "Okconfig" in the top toolbar.
Once you've opened your Adagios site, make sure that the binaries and configurations are correct as well. To go about this, head to the top-right area of your Adagios site, next to your Adagios username a white gear will appear, click said gear and then click Settings.
Once inside the Settings pane, replace the following fields for the provided values:
Destination directory: /etc/nagios3/adagios/
Nagios binary: /usr/sbin/nagios3
Pnp filepath: /usr/share/pnp4nagios/html/index.php
Once completed, click save and proceed to create the adagios folder for objects
mkdir /etc/nagios3/adagios
pynag config --append cfg_dir=/etc/nagios3/adagios
And to conclude, restart the Apache server as well as Nagios
service apache2 restart
service nagios3 restart
This documentation is based off the ones given on the official Adagios github page and another documentation for debian based systems. Both of them can be found here: https://github.com/opinkerfi/adagios/wiki/Install-guide http://webcache.googleusercontent.com/search?q=cache:r1scUd1hjC8J:blog.benjaminperrin.fr/index.php/2013/07/09/installer-nagios3-et-adagios-sur-debian-7-wheezy/&lr=lang_en|lang_fr&hl=en&tbs=lr:lang_1en|lang_1fr&strip=1
warning
Please note that the okconfig team will not officially support this installation method.
Install the opensource.is repositories put a line like this into your apt sources If you do not have the file /etc/lsb-release on your system you have to know the codename for your distribution so you can add the right repositories
For example: Ubuntu 12.04 is "precise" and Debian 7 is "wheezy":
source /etc/lsb-release
echo "deb http://opensource.is/repo/debian $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/opensource.is.list
apt-get updateInstall pre-requisits:
apt-get install git libapache2-mod-wsgi pynagAlso, make sure you have installed the following packages from the
Debian repos (don't forget the dependencies). You can find them
here. After
downloading them (wget) you can install them with
dpkg -i <package1> <package2>...:
shinken
shinken-module-broker-livestatus
shinken-module-broker-livestatus-sqlite
Install adagios:
apt-get install adagiosAdd the Shinken config file location in Pynag. If you wanted to modify the reference to Nagios and change it to a reference to Shinken, is should also work.:
sed -i "s#'/usr/local/icinga/etc/icinga.cfg',#'/usr/local/icinga/etc/icinga.cfg',\n '/etc/shinken/shinken.cfg',#g" /usr/local/lib/python2.7/dist-packages/pynag/Parsers/__init__.pyFix Pynag's reference to mk-livestatus: Shinken has its own livestatus module, no need for mk_livestatus:
sed -i 's#v.find("livestatus.o")#v.find("live")#gw /dev/stdout' /usr/local/lib/python2.7/dist-packages/pynag/Parsers/__init__.pyIf you plan on using the built-in status view in Adagios you need these. Shinken does not have two livestatus broker modules and Pynag expects two arguments. (Hackish fix but it works):
pynag config --append "broker_module=/dev/null /var/lib/shinken/rw/live"warning
Only do the few following instructions if the previous call failed and you have received errors configuration errors : that you believe could be fixed by these commands.
If this failed fix the errors... I was hitting two (these are probably just typos in the configs used in the packages). Fix retention-picklefile.cfg if needed:
echo "}" >> /etc/shinken/shinken-specific/retention-picklefile.cfgFix templates.cfg if needed:
sed -i '60s/{/}/w /dev/stdout' /etc/shinken/templates.cfgThen rerun:
pynag config --append "broker_module=/dev/null /var/lib/shinken/rw/live"New objects created with Adagios go here, make sure Shinken is reading that directory:
mkdir -p /etc/shinken/adagios
pynag config --append cfg_dir=/etc/shinken/adagiosCreate git repo which adagios uses for version control:
cd /etc/shinken/
git init
git add .
git commit -a -m "Initial commit"Make sure nagios group will always have write access to the configuration files:
chown -R shinken /etc/shinken /etc/shinkenFix the sudoers file:
cp /opt/adagios/adagios/etc/sudoers.d/adagios /etc/sudoers.d/adagios
sed -e "s#nagios3#shinken#g" -e "s#nagios#shinken#g" -i /etc/sudoers.d/adagiosAdd a Django Secret Key (Don't use this one):
sed -i '141s/""/"SOUP3rS3cre7keyBr0"/w /dev/stdout' /usr/lib/python2.7/dist-packages/adagios/settings.pywarning
Make sure you haven't used the same key... you have been warned!
Fix some references:
sed -i 's/\/etc\/nagios\/nagios\.cfg/\/etc\/shinken\/shinken\.cfg/' /etc/adagios/adagios.conf
sed -i 's/\/etc\/nagios\/adagios\//\/etc\/shinken\/adagios\//' /etc/adagios/adagios.conf
sed -i 's/\/etc\/init.d\/nagios/\/etc\/init.d\/shinken-arbiter/' /etc/adagios/adagios.conf
sed -i 's/\/usr\/sbin\/nagios/\/usr\/bin\/shinken-arbiter/' /etc/adagios/adagios.confFix Apache2 wsgi config:
sed -e 's/nagios/shinken/g' -e 's/Nagios/Shinken/g' -i /etc/apache2/conf.d/adagios.confCreate htpasswd:
cd /etc/shinken
htpasswd -s -b -c htpasswd.users admin adminAdagios uses mk_livestatus qhich uses a socket for communications.
Shinken by default uses TCP port 50000. The
shinken/broker-livestatus.cfg offers the option to change this
default.
Use socket instead of TCP port:
sed -i '11s/host/# host/w /dev/stdout' /etc/shinken/shinken-specific/broker-livestatus.cfg
sed -i '12s/port/# port/w /dev/stdout' /etc/shinken/shinken-specific/broker-livestatus.cfg
sed -i '13s/#[\s]*socket/socket/w /dev/stdout' /etc/shinken/shinken-specific/broker-livestatus.cfgLoad Livestatus module:
sed -i '40s/\s*$/, Livestatus/w /dev/stdout' /etc/shinken/shinken-specific/broker.cfgConfigure Adagios' verify command to work with Shinken (Commands to the
Shinken arbiter take an extra -c switch):
sed -i "s#\"%s -v '%s'\" % (nagios_binary, nagios_config)#\"%s -v -c '%s'\" % (nagios_binary, nagios_config)#gw /dev/stdout" /usr/share/pyshared/adagios/misc/forms.pyRestart the services:
service apache2 restart && service shinken restartInstall the prerequisites: :
apt-get install python-paramikoGet the sources: :
cd /opt
git clone git://github.com/opinkerfi/okconfig.git
cd okconfigConfigure OkConfig to work with Shinken:
echo 'PYTHONPATH=$PYTHONPATH:/opt/okconfig' > /etc/profile.d/okconfig.sh
source /etc/profile
mkdir /etc/shinken/okconfig
pynag config --append cfg_dir=/etc/shinken/okconfig
pynag config --append cfg_dir=/usr/share/okconfig/templatesEdit /opt/okconfig/etc/okconfig.conf and replace the Nagios paths by
Shinken paths: :
sed -i 's#^nagios_config.*$#nagios_config /etc/shinken/shinken.cfg#w /dev/stdout' /opt/okconfig/etc/okconfig.conf
sed -i 's#^destination_directory.*$#destination_directory /etc/shinken/okconfig/#w /dev/stdout' /opt/okconfig/etc/okconfig.conf
sed -i 's#^examples_directory_local.*$#destination_directory_local /etc/shinken/okconfig/#w /dev/stdout' /opt/okconfig/etc/okconfig.confCopy configuration file in /etc :
cp /opt/okconfig/etc/okconfig.conf /etc/okconfig.confRun the setup: :
python setup.py install
okconfig init
okconfig verifyFix the access rights: :
chown -R shinken:shinken /etc/shinken /etc/okconfig.confRestart the services:
service apache2 restart && service shinken restart