Install guide

Garðar Þorsteinsson edited this page Jun 1, 2018 · 50 revisions

This document explains how to install Adagios on different platforms. We recommend using redhat based platform because that is what the adagios developers use, so that one is tested the most.

The documentation assumes you want to use nagios as a monitoring engine. Adagios supports icinga and naemon equally well, but the documentation assumes nagios because that one is currently packaged by all the major distributions.

If you find any errors in these docs, please be so kind to either update the wiki or file an issue in the issue tracker.

Install Adagios and Naemon with Docker

If you want to try out Adagios we have 2 docker images available for testing. Feel free to send in feature request and issues. Images hosted on Docker Hub.

Install Adagios and Nagios 4 on redhat based systems - RHEL7

# If you don't know how to configure SElinux, put it in permissive mode:
sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/selinux/config
setenforce 0

# First install the opensource.is and consol labs repositories
rpm -ihv http://opensource.is/repo/ok-release.rpm
rpm -Uvh https://labs.consol.de/repo/stable/rhel7/x86_64/labs-consol-stable.rhel7.noarch.rpm
yum update -y ok-release

# Centos users need to install the epel repositories (fedora users skip this step)
yum install -y epel-release
# Redhat users:
subscription-manager repos --enable=rhel-7-server-optional-rpms
subscription-manager repos --enable=rhel-7-server-extras-rpms
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

#
# Install Deps          
#
yum install -y git acl libstdc++-static python-setuptools pnp4nagios

#
# Install Nagios 4
#
yum install -y nagios nagios-plugins-all

#
# Install Livestatus    
#
yum install -y check-mk-livestatus

#
# Install Adagios and OKconfig 
#
yum --enablerepo=ok install -y adagios pynag
yum --enablerepo=ok-testing install -y okconfig
mkdir -p /etc/nagios/commands

#
# Configure Adagios     
#

# Lets make sure adagios can write to nagios configuration files, and that
# it is a valid git repo so we have audit trail
cd /etc/nagios/
git init
git config user.name "yourname"
git config user.email "yourname@yourdomain.com"
git add *
git commit -m "Initial commit"

# By default objects created by adagios will go to /etc/nagios/adagios so make sure that this directory exists and nagios.cfg contains a reference to this directory.
mkdir -p /etc/nagios/adagios
pynag config --append cfg_dir=/etc/nagios/adagios
pynag config --append cfg_dir=/etc/nagios/commands

# Make sure nagios group will always have write access to the configuration files:
chown -R nagios:nagios /etc/nagios/* /etc/nagios/.git

# Add check_mk livestatus broker module to nagios config
pynag config --append "broker_module=/usr/lib64/check_mk/livestatus.o /var/spool/nagios/cmd/livestatus"

echo "ALLOWED_HOSTS = ['*']" >> /etc/adagios/adagios.conf

#
# Configure PNP4Nagios  
#
pynag config --set "process_performance_data=1"

# Add nagios to apache group so it has permissions to pnp4nagios's session files
usermod -G apache nagios

# service performance data
pynag config --set 'service_perfdata_file=/var/log/pnp4nagios/service-perfdata'
pynag config --set 'service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$'
pynag config --set 'service_perfdata_file_mode=a'
pynag config --set 'service_perfdata_file_processing_interval=15'
pynag config --set 'service_perfdata_file_processing_command=process-service-perfdata-file'

# host performance data
pynag config --set 'host_perfdata_file=/var/log/pnp4nagios/host-perfdata'
pynag config --set 'host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$'
pynag config --set 'host_perfdata_file_mode=a'
pynag config --set 'host_perfdata_file_processing_interval=15'
pynag config --set 'host_perfdata_file_processing_command=process-host-perfdata-file'

# Add process perfdata commands
pynag add command command_name=process-service-perfdata-file command_line='/bin/mv /var/log/pnp4nagios/service-perfdata /var/spool/pnp4nagios/service-perfdata.$TIMET$'
pynag add command command_name=process-host-perfdata-file command_line='/bin/mv /var/log/pnp4nagios/host-perfdata /var/spool/pnp4nagios/host-perfdata.$TIMET$'

#
# Optional - Install Thruk         
#
yum install -y thruk
# Disable OMD thruk service
systemctl disable thruk.service

# Set Apache basic auth password for Nagios/Thruk/Adagios
#
htpasswd /etc/nagios/passwd <username>

#
# Clean up
#

# Disable check_mk templates
mkdir -p /etc/nagios/disabled
mv /etc/nagios/conf.d/check_mk_templates.cfg /etc/nagios/disabled

#
# Configure firewall
#
firewall-cmd --add-service=https --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload

#
# Enable and start services 
#
systemctl restart nagios; systemctl enable nagios
systemctl restart npcd; systemctl enable npcd
systemctl restart httpd; systemctl enable httpd

Installing Adagios running on Naemon on RHEL 7 or CentOS 7

https://github.com/opinkerfi/adagios/wiki/Naemon-and-Adagios-Install-Guide

Installing on redhat based systems - RHEL6

This chapter shows how to install nagios and adagios from scratch on redhat, centos or fedora based machines.

# First install the opensource.is repositories
rpm -ihv http://opensource.is/repo/ok-release.rpm
yum update -y ok-release

# Redhat/Centos users need to install the epel repositories (fedora users skip this step)
yum install -y epel-release

# Install nagios, adagios and other needed packages
yum --enablerepo=ok-testing install -y pnp4nagios mk-livestatus nagios git adagios okconfig acl python-setuptools nagios-plugins-all

# If you don't know how to configure SElinux, put it in permissive mode:
sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/sysconfig/selinux
setenforce 0

# Now all the packages have been installed, and we need to do a little bit of
# configuration before we start doing awesome monitoring

# Lets make sure adagios can write to nagios configuration files, and that
# it is a valid git repo so we have audit trail
cd /etc/nagios/
git init
git config user.name "yourname"
git config user.email "yourname@yourdomain.com"
git add *
git commit -m "Initial commit"

# Make sure nagios group will always have write access to the configuration files:
chown -R nagios /etc/nagios/* /etc/nagios/.git
setfacl -R -m group:nagios:rwx /etc/nagios/
setfacl -R -m d:group:nagios:rwx /etc/nagios/

# By default objects created by adagios will go to /etc/nagios/adagios so make sure that this directory exists and nagios.cfg contains a reference to this directory.
mkdir -p /etc/nagios/adagios
pynag config --append cfg_dir=/etc/nagios/adagios

# The status view relies on broker modules livestatus and pnp4nagios, so lets configure
# nagios.cfg to use those
pynag config --append "broker_module=/usr/lib64/nagios/brokers/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg"
pynag config --append "broker_module=/usr/lib64/mk-livestatus/livestatus.o /var/spool/nagios/cmd/livestatus"
pynag config --set "process_performance_data=1"

# Add nagios to apache group so it has permissions to pnp4nagios's session files
usermod -G apache nagios

# We need to restart both apache and nagios so new changes take effect
service nagios restart ; chkconfig nagios on
service httpd restart ; chkconfig httpd on
service npcd restart ; chkconfig npcd on

# We need to allow user nagios to restart nagios daemon

visudo 

# add the following three lines to the end of the file

# Nagios daemon control
Defaults:nagios !requiretty
nagios ALL = (root) NOPASSWD: /etc/init.d/nagios

#
# Optional - Configuring Environment variables Nagios systemd service   
# 
sudo mkdir /etc/systemd/system/nagios.service.d
sudo vim  /etc/systemd/system/nagios.service.d/env.conf
# For example, update PERL5LIB path so that nagios user loads correct perl libraries for plugins
[Service]
Environment=""PERL5LIB=$PERL5LIB:/var/spool/nagios/perl5_custom_lib"

> sudo systemctl daemon-reload

Installing on debian based systems

This chapter shows how to install nagios, and adagios from scratch on debian based machines.

# 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 update -y

# Install pre-requisits
apt-get install nagios3 git libapache2-mod-wsgi check-mk-livestatus pynag  -y

# Install adagios
apt-get install adagios --force-yes


# If you plan on using the built-in status view in adagios you need these:
pynag config --append "broker_module=/usr/lib/check_mk/livestatus.o /var/lib/nagios3/rw/livestatus"

# New objects created with adagios go here, make sure nagios is reading
# that directory
mkdir -p /etc/nagios3/adagios
pynag config --append cfg_dir=/etc/nagios3/adagios


# Create git repo which adagios uses for version control
cd /etc/nagios3/
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 nagios /etc/nagios3 /etc/adagios

# Install pnp4nagios and get graphs working
apt-get install pnp4nagios -y
pynag config --set "process_performance_data=1"
pynag config --append "broker_module=/usr/lib/pnp4nagios/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg"
usermod -G www-data nagios
sed -i 's/RUN.*/RUN="yes"/' /etc/default/npcd
service npcd start


# Restart nagios so new configuration changes are applied
service nagios3 restart

Installing from pip

If you are a python developer, or for some reasons the packages above do not work for you, adagios can be installed with pip by running the following command:

pip install django==1.6 pynag adagios

or

pip install --install-option="--prefix=/opt/adagios" django==1.6 pynag adagios

This assumes you already have a working monitoring environment and nagios, livestatus are already configured. Please consults the redhat or debian guides on how to configure everything.

Configuration on non-standard set ups

If you install adagios from packages, it will assume that you are running nagios from packages as well. If you have installed nagios in a different location, or if you are using another monitoring core (naemon, icinga, shinken, etc) there are a few things you need to configure.

Keep an eye our for the following, if you have non standard paths:

  • Adagios main config (/etc/adagios/adagios.conf) Make sure paths to nagios.cfg and the nagios binary are correct
  • Apache config file (/etc/httpd/conf.d/adagios.conf on rhel) - make sure adagios runs as a user that has access to the nagios.cfg file

Other resources

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.