-
Notifications
You must be signed in to change notification settings - Fork 74
Install guide
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.
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.
-
Latest Adagios built from rpms running in a Centos 7 container
- Docker repositry
- Source repository
docker pull opinkerfi/adagios-rpm
-
Latest Adagios built from git running in a Centos 7 container
- Docker repositry
- Source repository
docker pull opinkerfi/adagios-git
This chapter shows how to install Adagios from scratch on Red Hat, Centos or Fedora based machines.
# If you don't know how to configure SElinux, put it in permissive mode:
# OS Version
OS_VERSION=$(rpm -E %{rhel})
sudo sed -i "s/SELINUX=enforcing/SELINUX=permissive/" /etc/selinux/config
sudo setenforce 0
# First install the repositories needed for this setup
# sudo rpm -Uvh "https://labs.consol.de/repo/stable/rhel8/i386/labs-consol-stable.rhel8.noarch.rpm"
curl -s https://download.opensuse.org/repositories/home:/naemon/AlmaLinux_${OS_VERSION}/home:naemon.repo > /etc/yum.repos.d/naemon-stable.repo
# Enable EPEL
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${OS_VERSION}.noarch.rpm
# Enable CodeReady Builder
grep -i stream /etc/os-release && sudo crb enable || sudo subscription-manager repos --enable "codeready-builder-for-rhel-${OS_VERSION}-$(arch)-rpms"
# Install dependency packages
#sudo yum install -y git acl mod_ssl git python36 python36-devel python3-pip python3-setuptools
sudo yum install -y git acl mod_ssl git python3-pip python3-setuptools
sudo pip3 install --upgrade pip
# Install Naemon / Thruk
sudo yum install -y naemon
sudo systemctl enable naemon httpd
sudo systemctl start naemon httpd
sudo chown -R naemon:naemon /etc/naemon
sudo chmod -R 775 /etc/naemon
sudo chmod g+s /etc/naemon
# Move livestatus broker location so Pynag can find it
cat /etc/naemon/module-conf.d/livestatus.cfg >> /etc/naemon/naemon.cfg
sudo mv /etc/naemon/module-conf.d/livestatus.cfg /etc/naemon/module-conf.d/livestatus.cfg.d
sudo systemctl restart naemon
# Lets make sure Adagios can write to Naemon configuration files, and that
# it is a valid git repo so we have audit trail
cd /etc/naemon/
git init
git config --global user.name "Your Name"
git config --global user.email [email protected]
git config --global --add safe.directory /etc/naemon
git add .
git commit -a -m "Initial commit"
## Install Adagios
sudo git clone -b adagios-2.0.2-1 --depth 1 https://github.com/opinkerfi/adagios.git /opt/adagios
#sudo git clone -b master --depth 1 https://github.com/opinkerfi/adagios.git /opt/adagios
sudo groupadd --system adagios
sudo adduser --system -g adagios adagios
sudo usermod -aG naemon adagios
sudo chown --recursive adagios:adagios /opt/adagios/
## Configure Adagios
sudo mkdir -p /etc/adagios/conf.d /var/lib/adagios /etc/naemon/adagios
sudo cp /opt/adagios/adagios/etc/adagios/adagios_naemon.conf /etc/adagios/adagios.conf
sudo sed -i 's|# ALLOWED_HOSTS|ALLOWED_HOSTS|g' /etc/adagios/adagios.conf
sudo cp /opt/adagios/adagios/etc/adagios/conf.d/force_script_name.conf /etc/adagios/conf.d/
sudo cp /opt/adagios/adagios/etc/adagios/conf.d/okconfig.conf /etc/adagios/conf.d/
sudo cp /opt/adagios/adagios/etc/sudoers.d/adagios_naemon /etc/sudoers.d/
sudo chown --recursive adagios:adagios /etc/adagios /var/lib/adagios
# The following script will create a new Python virtual environment where Adagios is located.
sudo /opt/adagios/upgrade.sh
# Activate Python virtualenv
source /opt/adagios/venv/bin/activate
pynag config --append cfg_dir=/etc/naemon/adagios
## Install Adagios as systemd service
sudo cp /opt/adagios/contrib/gunicorn.py /opt/adagios/gunicorn.py
sudo cp /opt/adagios/contrib/*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start adagios
sudo systemctl enable adagios
# Apache
sudo cp /opt/adagios/contrib/apache_gunicorn_adagios.conf /etc/httpd/conf.d/
sudo systemctl restart naemon adagios httpd
## Install OKconfig from Github
source /opt/adagios/venv/bin/activate
sudo git clone -b master --depth 1 https://github.com/opinkerfi/okconfig.git /opt/okconfig
cd /opt/okconfig
pip install -r requirements.txt
python setup.py install
sudo cp /opt/okconfig/etc/okconfig.conf /etc/
# Make okconfig Naemon aware
sed -i '
s|/etc/nagios/nagios.cfg|/etc/naemon/naemon.cfg|g
s|/etc/nagios/okconfig/|/etc/naemon/okconfig/|g' /etc/okconfig.conf
okconfig init
okconfig verify
# Fix permissions
sudo chown -R naemon:naemon /etc/naemon
sudo chmod -R 775 /etc/naemon
# Add firewall rules
sudo firewall-cmd --add-service=https --add-service=http --permanent
sudo firewall-cmd --reload
# Restart services
sudo systemctl restart naemon adagios httpd
sudo yum install -y nagios-plugins-disk \
nagios-plugins-dns \
nagios-plugins-dummy \
nagios-plugins-file_age \
nagios-plugins-fping \
nagios-plugins-http \
nagios-plugins-icmp \
nagios-plugins-load \
nagios-plugins-nrpe \
nagios-plugins-ping \
nagios-plugins-procs \
nagios-plugins-snmp \
nagios-plugins-ssh \
nagios-plugins-ssl_validity \
nagios-plugins-swap \
nagios-plugins-time \
nagios-plugins-uptime \
nagios-plugins-users \
# Certificate check
sudo curl -fsSL https://raw.githubusercontent.com/matteocorti/check_ssl_cert/master/check_ssl_cert --output /usr/lib64/nagios/plugins/check_ssl_cert
sudo chmod +x /usr/lib64/nagios/plugins/check_ssl_cert
# NCPA server plugin
sudo curl -fsSL https://raw.githubusercontent.com/NagiosEnterprises/ncpa/master/client/check_ncpa.py --output /usr/lib64/nagios/plugins/check_ncpa.py
sudo chmod +x /usr/lib64/nagios/plugins/check_ncpa.py
sudo rpm -Uvh https://repo.nagios.com/nagios/8/nagios-repo-8-1.el8.noarch.rpm
sudo yum install -y ncpa
sudo rpm -ihv http://opensource.is/repo/ok-release.rpm
sudo yum update -y ok-release
sudo yum install -y nrpe nagios-plugins-load nagios-plugins-procs nagios-plugins-swap
sudo yum --enablerepo=ok-testing install -y nagios-plugins-check_cpu nagios-okconfig-nrpe
# Fix allowed hosts and dont blame nrpe in nrpe settings
export NAGIOS_SERVER='192.168.1.100'
sed -i "/^allowed_hosts=/ s/$/,$NAGIOS_SERVER/" /etc/nagios/nrpe.cfg
sed -i '/^dont_blame_nrpe=/c\dont_blame_nrpe=1' /etc/nagios/nrpe.cfg
sudo systemctl enable nrpe
sudo systemctl restart nrpe
This chapter shows how to install Adagios from scratch on Red Hat, Centos or Fedora based machines.
# 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 python2-django16
# Optional
# sudo yum install -y bash-completion bash-completion-extras
# source /etc/profile.d/bash_completion.sh
#
# Install Nagios 4
#
yum install -y nagios nagios-plugins-all
#
# Install Livestatus
#
# Build mk-livestatus for Nagios4
wget https://droppa.ok.is/dl/data/8b15d652f132667abbf0b80dd9d956d4cc368d1c/mk-livestatus-1.2.6.tar.gz
sudo yum install -y make gcc-c++
tar -zxvf mk-livestatus-1.2.6.tar.gz
cd mk-livestatus-1.2.6
./configure --with-nagios4
make
make install
#
# Install Adagios and OKconfig
#
sudo yum --enablerepo=ok install -y adagios
sudo yum --enablerepo=ok-testing install -y okconfig
sudo mkdir -p /etc/nagios/commands /etc/nagios/pynag
#
# 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 "[email protected]"
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
pynag config --append cfg_dir=/etc/nagios/pynag
# 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/local/lib/mk-livestatus/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 -aG 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
#
sudo yum install -y thruk
# Set Apache basic auth password for Nagios/Thruk/Adagios
#
# htpasswd /etc/nagios/passwd <username>
sudo mv /etc/thruk/htpasswd /etc/thruk/htpasswd.bak
sudo ln -s /etc/nagios/passwd /etc/thruk/htpasswd
# change default password for nagiosadmin
htpasswd /etc/nagios/passwd nagiosadmin
# Configure Thruk backend using livestatus
cat << EOF >> /etc/thruk/thruk_local.conf
<Component Thruk::Backend>
<peer>
name = backend_1
id = 99999
type = livestatus
<options>
peer = /var/spool/nagios/cmd/livestatus
</options>
</peer>
</Component>
EOF
# Error checking
chown -R nagios:nagios /etc/nagios/* /etc/nagios/.git
nagios -v /etc/nagios/nagios.cfg
#
# Enable and start services
#
sudo systemctl enable --now nagios
sudo systemctl enable --now npcd
sudo systemctl enable --now httpd
sudo systemctl restart nagios npcd httpd
sudo systemctl status nagios npcd httpd
#
# Optional Configure firewall
#
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
https://github.com/opinkerfi/adagios/wiki/Naemon-and-Adagios-Install-Guide
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.9 pynag adagios okconfig
or
pip install --install-option="--prefix=/opt/adagios" django<=1.9 pynag adagios okconfig
This assumes you already have a working monitoring environment and Nagios, Livestatus are already configured. Please consults the Red Hat or Debian guides on how to configure everything.
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