Nagios
is one of the well-knows tools for monitoring servers and services in a
network. It works on a client-server structure that means there is a server
regularly connects to Nagios clients and obtain the latest state of the servers
and services.
In Nagios
we define hosts, and services and we can group them together for ease of
management.
A
Host is an actual machine. e.g. a physical server or a work station.
We
define a host as below:
define host {
use generic-host
host_name ns1.ksa.com
alias NameServer
address 10.10.0.4
}
A
service is an actual UDP, TCP, or ICMP that does specific job such as HTTP
service. We define a service as below:
define service {
use
generic-service
host_name ns1.ksa.com
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
Nagios
comes with a bunch of plugins and each of which does a specific job. As shown
above, a PING service was defined to regularly check the state of the target (a
Nagios client).
On
each client a nagios-nrpe-server should be installed. This component allows the
Nagios server to send the service/server health-check commands to the clients.
It is installed with the following command.
sudo apt-get –y install
nagios-nrpe-server
It
should be configured that to which server the Nagios client should listen to.
allowed_hosts=10.10.0.5 //IP address of the nagios server
So far, we have deployed a Nagios Server on a raspberry pi
and a Nagios client on the KSA’s main server. We have configured the Nagios to
check the following services:
· Number of running processes
· * Disk usage
· * Number of logged in users
· *HTTP service monitoring
· * And MySql service monitoring
One of the functionalities of the Nagios is to notify
network administrators when incidents happen. For example a server goes down or
a service stops working. We will configure the Nagios to send us email when a
service/server fails using our email server.