Skip to content

Installing nagios on archlinux

Nagios is one of the most used softwares for monitoring servers. Hint: Icinga itself is a fork of nagios. Many of the used steps to install nagios are also needed for a icinga installation, but I focus on installing nagios.

What have to be done before:
1. Installation of yaourt
2. Installation of apache2 (httpd)

First install find and install nagios:

# yaourt -Ss nagios
...
aur/nagios 4.0.2-1 [installed] (168)
    Nagios is an open source host, service and network monitoring program.
aur/nagios-plugins 1.5-1 [installed] (111)
    Plugins are scripts and programs that perform host and service checks.
...
# yaourt -S nagios nagios-plugins

Before moving on we need to create a password for the user “nagiosadmin” to be able to access the webinterface.

# htpasswd -c /etc/nagios/htppasswd.users nagiosadmin

Once the installation is done proceed with the configuration of nagios. Luckily nagios comes with a bunch of sample configuration files. They can be found in archlinux in the /etc/nagios folder.

# cd /etc/nagios
# cp /etc/nagios/cgi.cfg.sample /etc/nagios/cgi.cfg
# cp /etc/nagios/resource.cfg.sample /etc/nagios/resource.cfg
# cp /etc/nagios/nagios.cfg.sample /etc/nagios/nagios.cfg
# cp /etc/nagios/objects/commands.cfg.sample /etc/nagios/objects/commands.cfg
# cp /etc/nagios/objects/contacts.cfg.sample /etc/nagios/objects/contacts.cfg
# cp /etc/nagios/objects/localhost.cfg.sample /etc/nagios/objects/localhost.cfg
# cp /etc/nagios/objects/templates.cfg.sample /etc/nagios/objects/templates.cfg
# cp /etc/nagios/objects/timeperiods.cfg.sample /etc/nagios/objects/timeperiods.cfg
# cp /etc/webapps/nagios/apache.example.conf /etc/httpd/conf/extra/nagios.conf

We have to fix the permissions on the folder that user “nagios” (created automatically by the installation) may access it.

# chown -R nagios:nagios /etc/nagios
# chown -R nagios:nagios /usr/share/nagios

We need to configure apache in order to work with nagios.

# nano /etc/httpd/conf/httpd.conf

and add at the end of the file following line:
Include "conf/extra/nagios.conf"

restart httpd:

# systemctl restart httpd

start nagios:

# systemctl start nagios

enbable startup of nagios at boot:

# systemctl enable httpd     # only needed if apache isn't already activated
# systemctl enable nagios

nagios04nagios03nagios02nagios01

 

 

 

Links:
[1] Nagios-Homepage
[2] Icinga-Homepage
[3] wiki article on nagios for archlinux

Post a Comment

You must be logged in to post a comment.