This post illustrate how to install nagios step by step on your server
Nagios official website:
It is an awesome start for the enterprise or the big scale environment, imagine yourself being a system administrator with more than one server to manage, how would you keep an eye on all of them?
Luckily we’ve got this awesome piece of open source software that lets us monitor all our servers from one single window.
NagiOS has got a lot of plugins and too many powerful tools, this article covers some basic tutorial on how to install nagios on a centos based server.
If you get stuck anywhere just leave a comment below or just e-mail us at firstname.lastname@example.org with your problem and we will post the answer on our Q&A section.
So let’s get our hands dirty! Depending on your distro you would first need to install some dependencies such as GCC library, net-snmp, etc. In order to get nagios to work, I will be using CentOS for this tutorial.
yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp
The line above has installed the famous web server apache as well as php too which will be covered in depth in the next article of How to install LAMP on CentOS.
Then we have got to add a system user for nagios to use as well as a system group, so on CentOS you add a user and a group with the following commands:
Now a small trick that most of the people forget about, which is adding the nagios and the apache user to the group we created earlier:
usermod -G nagcmd nagios
usermod -G nagcmd apache
Now let’s create a directory for nagios installation base:
Then let’s navigate to the nagios directory we have just created.
Next step would be making sure that we have the wget command installed on our system and if not we can use the following command:
yum install wget -y
Then let’s download the nagios compressed packaged:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.1.tar.gz -y
Afterwards, we need to extract the downloaded compressed package
tar –xvf nagios-4.0.1.tar.gz
Now let’s navigate to the extracted folder and start compiling it with the following command:
Only few steps far away:
1st installing the init scripts which would help you to start and stop nagios from the command line at ease:
Nagios command line tools can also be installed as following:
Install nagios files:
To make it accessible through the web interface:
Nothing left now apart from creating a password for the nagios login interface:
htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
That’s all, we can now start using it after restating the web server and here’s a screenshot below for the login screen.