Nagios Full Notes
Nagios Full Notes
Nagios is an open source software that can be used for network and infrastructure monitoring.
Nagios will monitor servers, switches, applications and services.
It alerts the System Administrator when something went wrong and also alerts back when the issues have been
rectified.
Features
Monitor your entire IT infrastructure.
Identify problems before they occur.
Know immediately when problems arise.
Share availability data with stakeholders.
Detect security breaches.
Reduce downtime and business losses.
yum install –y httpd php wget gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip
Start Webserver
6
User and Group Creation for Nagios
12
useradd nagios
25
passwd nagios
groupadd nagcmd (nagcmd group for allowing external commands to be submitted through the web interface.)
7
usermod -a -G nagcmd nagios
66
usermod -a -G nagcmd apache
mkdir /nagios
cd /nagios/
, 98
06
curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
(Before Downloading check for latest package)
0
cd nagios-*
5
./configure --with-command-group=nagcmd
91
make all
make install
make install-commandmode
92
make install-init
make install-config
make install-webconf
om
curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
make
make install
tl
of
curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
rs
ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
make all
w
make install
make install-xinetd
w
make install-daemon-config
w
vi /etc/xinetd.d/nrpe
vi /usr/local/nagios/etc/nagios.cfg
mkdir /usr/local/nagios/etc/servers
vi /usr/local/nagios/etc/objects/contacts.cfg
vi /usr/local/nagios/etc/objects/commands.cfg
Add this at the end of the file
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
Configure Apache
Use htpasswd to create an admin user, called "nagiosadmin", that can access the Nagios web interface:
6
http://nagios_server_ip/nagios
12
To Monitor a Host with NRPE
25
Note: Repeat this section for each server you wish to monitor
7
On a host that you want to monitor, install the EPEL repository:
66
yum install epel-release
yum install nrpe nagios-plugins-all
vi /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,<Private / pub IP of your Nagios Server>
, 98
06
systemctl enable nrpe.service
systemctl start nrpe.service
0
22
Once you are done installing and configuring NRPE on the hosts that you want to monitor, you will have to add these
hosts to your Nagios server configuration before it will start monitoring them.
5
vi /usr/local/nagios/etc/servers/yourhost.cfg
92
define host {
use linux-server
host_name Remote host Name to be monitored
alias My first Apache server
address <IP Address of Remote host to be monitored>
om
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
s.c
}
ab
If you want to monitor particular Service (If you're not sure what use generic-service means, it is simply inheriting the values of a service
template called "generic-service" that is defined by default.)
tl
define service {
of
use generic-service
host_name Remote host Name to be monitored
service_description PING
rs
check_command check_ping!100.0,20%!500.0,60%
}
te
define service {
.en
use generic-service
host_name Remote host Name to be monitored
service_description SSH
check_command check_ssh
w
notifications_enabled 0
}
w
w
http://nagios_server_ip/nagios