loading...

27/07/2023

Nagios

====================== Basic Configuration ======================

# timedatectl set-timezone Asia/Dhaka
# timedatectl


# vi /etc/selinux/config

SELINUX=disabled
😡

# chkconfig firewalld on
#reboot

# hostnamectl set-hostname graph.nmslab.net
# logout

# hostname

# nmtui
# nmcli connection down enp0s3
# nmcli connection up enp0s3
# ifconfig

# vim /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
103.110.59.150 graph.nmslab.net graph
😡

# hostname

# adduser sysadmin
# passwd sysadmin

# dnf -y install openssh-clients openssh-server
or yum install openssh-clients openssh-server

# cd /etc/ssh/

#vi sshd_config

Port 4422
PermitRootLogin no
AllowUsers sysadmin
😡

# firewall-cmd –permanent –add-port=4422/tcp
# firewall-cmd –reload

# systemctl enable sshd
# systemctl status sshd
# systemctl restart sshd

Try to login remotely
#ssh sysadmin@103.110.59.150 –p 4422

========================== Nagios Configuration ====================

# yum install httpd php php-cli gd gd-devel gcc glibc glibc-common wget perl unzip zip net-snmp

# systemctl enable httpd
# systemctl restart httpd
# systemctl status httpd

# useradd nagios
# passwd nagios
–> New Pass: 123@321

# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache

# cat /etc/group

# cd /tmp/
# w!get https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
# tar -zxvf nagios-4.4.5.tar.gz
# cd /tmp/nagios-4.4.5

# ./configure –with-nagios-group=nagios –with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode

# make install-webconf
# make install-exfoliation

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
—>New Password: 123@321
# systemctl restart httpd

# cd /tmp
# w!get https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
# tar -zxvf nagios-plugins-2.3.3.tar.gz
# cd /tmp/nagios-plugins-2.3.3

# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
# make
# make install

#vi /usr/local/nagios/etc/objects/contacts.cfg

Find the following line and enter the email id:
email sk@unixmen.com ; <<*****
>> Replace with engr.zafar@gmail.com [configure email server]

# vi /etc/httpd/conf.d/nagios.conf

Comment the following lines
# Order allow,deny
# Allow from all

Uncomment and Change lines as shown below
Order deny,allow
Deny from all
Allow from 127.0.0.1 192.168.1.0/24 N.B. Allow block 192.168.1.0/24

[This step will done by 2 times]

Add the rule to the permanent set and reload FirewallD.
=========================================================
# firewall-cmd –zone=public –add-service=http –permanent
# firewall-cmd –reload

# systemctl enable httpd
# systemctl restart httpd
# systemctl status httpd

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, then start the Nagios service.
# systemctl restart nagios

Start Nagios on system startup.
# systemctl enable nagios

Access Nagios in Web Browser
http:// 192.168.1.10/nagios N.B 192.168.1.10- Nagios Server IP

Username : nagiosadmin
pass: 123@321

Posted in LinuxTaggs: