Project 1 Network Management - nrubera/SYS-265-03-Tech-Journal GitHub Wiki

Nagios Network Monitoring

Build Documentation

Open NMon01. This is primarily where we’re gonna host everything. First, we need the prerequisites. We need Apache, PHP, and some libraries. Type yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp to get all you need.

Next, create a Nagios user and group. Do this by typing useradd nagios, and then groupadd nagcmd. Add the Nagios and Apache users to the group. Afterwards, we download the Nagios Core and the Nagios Plugin. We first have to make a directory: /root/nagios. Change to that, and we can begin the process. Use wget on the following urls:

https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz

https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

Next, extract them, with tar -xvf nagios-4.4.5.tar.gz, and the same for nagios-plugins-2.2.1.tar.gz.

Time to configure the core. Change directory to nagios-4.4.5/ and configure with the command ./configure --with-command-group=nagcmd. Compile it with make all and install the libraries into the machine with make install. Install the init scripts with make install-init. We also really want Nagios to work with the command line, so make install-command mode to get that. We should get some sample files as well, so make install-config.

Now we gotta customize the configuration. Open contacts.cfg with your preferred text editor. It should be under /usr/local/nagios/etc/objects/contacts.cfg. Set the email address to one you use, to get alerts about the servers.

Ready to get funky with web interfaces? In the Nagios 4.4.5 directory, make install-webconf to configure the web interface for Nagios. The nagiosadmin user is already created, but it needs a password. Type htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin. Restart Apache to make them take effect. Next we have to compile and install the plugin. Go to /root/nagios and change into the nagios-plugins-2.2.1/ plugin directory from there. All you have to do is configure using ./configure --with-nagios-user=nagios --with-nagios-group=nagios and make, then make install. Go back up to the Nagios directory and type /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg to verify the files.

image

We also have to make sure Nagios works across reboots. In root, enable nagios and httpd, and then start nagios.service.

Installing Nagios Client ++ on Windows

Next, please connect to your nagios core by entering the Ip address you assigned earlier. At this step it will ask you to enter in your username and password. Unless changed your username should be: nagiosadmin And the password should have been set in an early step.

image

This is what it will look like when you first log in.

image

Now that we know the webclient it working, we will need to install NSClient++ To do so please go to this link: https://sourceforge.net/projects/nscplus/files/latest/download/

Steps on going the the install are below:

image

image

Make sure that you enter in the IP address of the nagios core server.

image

image

Once the installation is complete please start the service:

image

Let's make sure that the service is running now by going into the Services and locating NSClient++

image

From here go to properties -> Log On and select “Allow service to interact with desktop”

image

Restart the service

Now we need to add the host to the Nagios Core server.

First lets make a backup

To get here got to /usr/local/nagios/etc/objects/

image

Sudo nano windows.cfg

image

Add the host exactly like it is below

image

Note: If you would like to check services on this device under host name you will need to add the host

image

image

Next let's make sure that everything is okay by verifying the files again. Remember the command? If not here it is again: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

image

If you are seeing your Host on nagios and it is saying that it is down but, services are still being checked. Please go into your firewall and enable “File and Printer Sharing(Echo Request IPv4). Schedule another check and it should be all set from there. This happens because the way Nagios is checking to see if the system is up and running is by sending a ping command and sometimes by default this port will be disabled, not allowing ping requests to get through.

image

Installing Nagios Client (nrpe) on CentOS

Type yum -y install wget openssl-devel and press Enter

Type cd /tmp and press Enter

Type wget http://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz and press Enter

Type tar xzf linux-nrpe-agent.tar.gz and press Enter

Type cd linux-nrpe-agent and press Enter

Type ./fullinstall and press Enter

Type y and press Enter

image

image

Type cd /tmp and press Enter

Type wget http://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz and press Enter

image

Type tar xzf linux-nrpe-agent.tar.gz and press Enter

Type cd linux-nrpe-agent and press Enter

Type ./fullinstall and press Enter

image

When prompted, type the IP Address of your Nagios Core host

image

Sources:

https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html#CentOS

https://www.tecmint.com/install-nagios-in-linux/

https://tecadmin.net/install-nrpe-on-centos-rhel/