Nagios setup
Nagios workflow
Step1:
launch kvm vm and login with ncodeitadm
First install centos in your laptop
Next install kvm in centos and create a bridge network
After creating a bridge open virt-manager and configure the vm by selecting the required image file qcow2
After creating vm open terminal and login with username and password
Username: ncodeitadm
Password: ncodeit123
commands :
Next install kvm in centos and create a bridge network
After creating a bridge open virt-manager and configure the vm by selecting the required image file qcow2
After creating vm open terminal and login with username and password
Username: ncodeitadm
Password: ncodeit123
commands :
1
|
# virt-manager
|
1
|
# brctl show to check the bridge
|
Step2:
check connectivity
you need to check for ip address
command:
you need to check for ip address
command:
1
|
ip a
|
After getting the ip-address
1
|
# ping google.com
|
Step3: Nagios installation
1
|
yum -y install httpd php gcc glibc glibc-common wget perl gd gd-devel unzip zip
|
#this command will install all the pre requisites for the VM
1
|
useradd nagios
|
1
|
groupadd nagcmd
|
1
|
usermod -a -G nagcmd nagios
|
1
|
usermod -a -G nagcmd apache
|
#adding a user and a group
Step4:
1
|
cd /tmp/
|
1
|
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
|
# downloading nagios version 4.3.4 and extract it with tar as below
1
|
tar -zxvf /tmp/nagios-4.*.tar.gz
|
1
|
cd /tmp/nagios-4.*
|
#navigate to the extracted folder
1
|
./configure --with-nagios-group=nagios --with-command-group=nagcmd
|
1
|
make all
|
1
|
make install
|
1
|
make install-init
|
1
|
make install-config
|
1
|
make install-commandmode
|
1
|
make install-webconf
|
1
|
make install-exfoliation
|
# make installing
1
|
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
|
1
|
systemctl restart httpd
|
1
|
systemctl enable httpd
|
# restart and enable apache server
1
|
cat /usr/local/nagios/etc/objects/contacts.cfg
|
Step5:
1
|
cd /tmp
|
1
|
wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
|
# download a nagios plugin and extract it
1
|
tar -zxvf /tmp/nagios-plugins-*.tar.gz
|
1
|
cd /tmp/nagios-plugins-*/
|
1
|
./configure --with-nagios-user=nagios --with-nagios-group=nagios
|
1
|
make
|
1
|
make install
|
#make installing
Step6:
1
|
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
|
1
|
systemctl start nagios
|
1
|
chkconfig nagios on
|
1
|
getenforce
|
1
|
setenforce 0
|
open browser IP/nagios/
username=nagiosadmin password=ncodeit123
Step7:
ssh root@ip of others
1
|
yum install epel-release -y
|
1
|
yum install nrpe nagios-plugins-all -y
|
1
|
vi /etc/nagios/nrpe.cfg
|
1
|
#add ip of server at
allowed_hosts=127.0.0.1,<server ip address>
1
|
systemctl start nrpe
|
1
|
systemctl enable nrpe
|
#starting and enabling nrpe
Step8: It is performed in the server side.
1
|
mkdir -p /usr/local/nagios/etc/servers
|
1
|
sudo vi /usr/local/nagios/etc/nagios.cfg
|
uncomment cfg_dir=/usr/local/nagios/etc/server
1
|
sudo vi /usr/local/nagios/etc/servers/clients.cfg
|
define host{ use linux-server host_name your-host-name alias your-host-name address Server IP max_check_attempts 5 check_period 24×7 notification_interval 30 notification_period 24×7 } define service{ use generic-service host_name your-host-name service_description SSH check_command check_ssh notifications_enabled 1 }
#edit hostname and IP to your configuration
Step9:
1
|
systemctl restart nagios
|
go to nagios browser and left side cilck on services—select ssh
No comments:
Post a Comment