How to Install and configure Nagios in Archlinux

Nagios is a popular open source computer system and network monitoring software application. It watches hosts and services, alerting users when things go wrong and again when they get better.

Nagios was originally designed to run under Linux, but also runs well on other Unix variants. It is free software, licensed under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

First thing  to do  is to  install Lamp on Arck to  activate apache  or php

Download  tarballs from AUR  ArchLinux  (Nagios and  Nagios-plugins)

Download  nagios  from :

Dwonload nagios-plugins :

Install developemnt packages

[root@localhost ~]# pacman -S base-devel
:: There are 11 members in group base-devel:
:: Repository core
1) autoconf  2) automake  3) bison  4) fakeroot  5) flex  6) gcc  7) libtool
8) m4  9) make  10) patch  11) pkg-config

Enter a selection (default=all):

Extract nagios  and  nagios plugin   from AUR  and    install them

tar  -zxvf  nagios.tar.gz

Now cd Nagios directory

cd nagios

Install  and  download  nagios ,  download  and  install also  dependencies if  needed

[root@localhost nagios]# makepkg -s --asroot


==> Making package: nagios 3.2.3-1 (Mon Jun 27 19:54:04 GMT 2011)
==> Checking runtime dependencies…
==> Checking buildtime dependencies…
==> Retrieving Sources…
-> Downloading nagios-3.2.3.tar.gz…

After this  step, a new file  will be  generated  in the same  directory : nagios-3.2.3-1-i686.pkg.tar.xz

Install this file using the command:

pacman -U nagios-3.2.3-1-i686.pkg.tar.xz

Now  do  the  same  with  Nagios  plugin

Download , extract   and  install

tar -zxvf nagios-plugins.tar.gz; cd  nagios-plugin
makepkg -s --asroot
pacman -U nagios-plugins-1.4.15-1-i686.pkg.tar.xz

II Nagios Configuration

Copy the sample config files as root:

 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

Make owner/group for all the files to nagios/nagios:

chown -R nagios:nagios /etc/nagios

Create htpasswd.users file with a username and password, eg. admin and  insert  you   chosen password

htpasswd -c /etc/nagios/htpasswd.users admin

change the  owner and group of  this  directorychown -R nagios:nagios /usr/share/nagios

Download SNMP
pacman -S net-snmp
Targets (1): net-snmp-5.6.1-1
Total Download Size:    2.08 MB
Total Installed Size:   13.09 MB
Proceed with installation? [Y/n] y

you can add snmpd to /etc/rc.conf to start with system next time under DAEMON=

Start Nagios

/etc/rc.d/nagios restart

You can add nagios to /etc/rc.conf to start with system next time unde DAEMON=

III Apache Configuration

Edit /etc/httpd/conf/httpd.conf, add the following

# nagios
Include /etc/httpd/conf/extra/nagios.conf 

Add the apache user http to the group nagios, otherwise you will get the following error when using nagios:

Could not open command file '/var/nagios/rw/nagios.cmd' for update!:  

Add user to apache using the command:

# usermod -G nagios -a http


VI PHP Configuration

Edit /etc/php/php.ini to include /usr/share/nagios in the open_basedir directive.

Example configuration:

open_basedir = /srv/http/:/usr/share/nagios



restart apache and nagios
rc.d restart snmpd
rc.d sretart httpd
rc.d restart nagios

Start the browser http://ip/nagios or http://hostname/nagios

and login with your login and password

{module user9-footer}