Hi all!
Good news are on the way: you can now run Adagios even on NS 7!
Just a couple of notes about this procedure:
- You have to use Nagios 3.5.1 core yet (we’ll take the rpm from one of these mirrors): that’s for a known limitation of Adagios mk-liveststatus implementation (take a look here);
- The procedure is still experimental so there’s a chance it will change!
Now let’s go on!
Source:
https://github.com/opinkerfi/adagios/wiki/Adagios-on-CentOS-7-with-Nagios-4 (notice the “Under construction, not ready yet” in the title! ;))
-
Install additional repo:
yum localinstall http://opensource.is/repo/ok-release.rpm -y
-
Change releasever ref into ok repo url (mandatory or installation fails):
sed -i ‘s/rhel$releasever/rhel7/’ /etc/yum.repos.d/ok.repo
-
Procede with installation:
yum -y --enablerepo=ok* install pnp4nagios nagios-plugins*
git adagios okconfig acl python-setuptools mk-livestatus pynag
ftp://bo.mirror.garr.it/1/centos/7.3.1611/cloud/x86_64/openstack-newton/common/nagios-3.5.1-1.el7.x86_64.rpm
ftp://bo.mirror.garr.it/1/centos/7.3.1611/cloud/x86_64/openstack-newton/common/nagios-common-3.5.1-1.el7.x86_64.rpm -
Don’t want Nagios to log into syslog (too verbose!), so disable it:
sed -i ‘s/use_syslog=1/use_syslog=0/’ /etc/nagios/nagios.cfg
-
Fit localhost check_http command to NS Apache configuration:
touch /var/www/html/apacheok
sed -i ‘s/check_http/check_http!-u /apacheok/’ /etc/nagios/objects/localhost.cfg -
Choose nagiosadmin password:
htpasswd -c /etc/nagios/passwd nagiosadmin
-
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 let’s 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 session files:
usermod -G apache nagios
-
Define new services according to NethServer default (see developer manual):
config set nagios service status enabled
mkdir -p /etc/e-smith/db/configuration/defaults/nagios
echo “service” > /etc/e-smith/db/configuration/defaults/nagios/type
echo “enabled” > /etc/e-smith/db/configuration/defaults/nagios/statusconfig set npcd service status enabled
mkdir -p /etc/e-smith/db/configuration/defaults/npcd
echo “service” > /etc/e-smith/db/configuration/defaults/npcd/type
echo “enabled” > /etc/e-smith/db/configuration/defaults/npcd/statusconfig set nrpe service access private TCPPort 5666 status enabled
mkdir -p /etc/e-smith/db/configuration/defaults/nrpe
echo “service” > /etc/e-smith/db/configuration/defaults/nrpe/type
echo “enabled” > /etc/e-smith/db/configuration/defaults/nrpe/status
echo “private” > /etc/e-smith/db/configuration/defaults/nrpe/access
echo “5666” > /etc/e-smith/db/configuration/defaults/nrpe/TCPPort -
We need to fix a known bug (see here):
sed -i “3iALLOWED_HOSTS = [’*’]\n” /etc/adagios/adagios.conf
-
Enable, start and signal the new services:
systemctl enable nagios
systemctl enable npcd
systemctl enable nrpesystemctl start nagios
systemctl start npcd
systemctl start nrpe
systemctl restart httpdsignal-event runlevel-adjust
-
Add the following line at the end of Adagios sudoers fragment file:
cat << EOT > /etc/sudoers.d/nagios-adagios
Nagios daemon control on NethServer 7
Defaults:nagios !requiretty
nagios ALL = (root) NOPASSWD: /usr/bin/systemctl
EOT -
Fix permission in logrotate fragment:
sed -i “2isu nagios nagios” /etc/logrotate.d/okconfig
-
To prevent unforseen nagios package update, add:
mkdir -p /etc/e-smith/templates-custom/etc/yum.conf
echo -e “#\n# 25exclusions\n#\nexclude=nagios nagios-common\n” > /etc/e-smith/templates-custom/etc/yum.conf/25exclude
expand-template /etc/yum.conf
Done! Now you can access Adagios form the default url:
using nagiosadmin credentials.
Test it, test it, test it and let me know!