Adding hosts and services to Nagios - Redhat hosts: Difference between revisions

From Apoyar Wiki
Jump to navigation Jump to search
(Created page with "Adding Redhat host to Nagios -------------------------------- 1. Connect to Nagios server (nagios.apoyar with neal username and apoyar.key) #cd /usr/local/etc/nagios/objects/machines #open and edit .cfg file (depending on whether we are adding host for Apoyar or other customers) 2. Add the host name in member list to recognize Nagios probe for checks Save file (:wq!) and exit vi editor Go to below path • cd /usr/local/etc/nagios/objects • vi servic...")
 
No edit summary
 
Line 58: Line 58:


chown nagios:nagios /home/nagios/.ssh/ authorized_keys
chown nagios:nagios /home/nagios/.ssh/ authorized_keys
then try to ssh new server from nagios server (It should work)




Line 89: Line 90:


chown nagios:nagios /home/nagios/bin/*
chown nagios:nagios /home/nagios/bin/*
9. Run below command on nagios server and check syntax errors with below command
/usr/local/bin/nagios -v /usr/local/etc/nagios/nagios.cfg
10. If we got all errors and warning zero, then go to nagios dashboard (nagios.apoyar.eu) and restart the nagios process it.

Latest revision as of 08:56, 5 December 2022

Adding Redhat host to Nagios



1. Connect to Nagios server (nagios.apoyar with neal username and apoyar.key)

  1. cd /usr/local/etc/nagios/objects/machines
  1. open and edit .cfg file (depending on whether we are adding host for Apoyar or other customers)


2. Add the host name in member list to recognize Nagios probe for checks


Save file (:wq!) and exit vi editor


Go to below path


• cd /usr/local/etc/nagios/objects


• vi services.cfg


3. Add the new hostname to the services, which we need for new server in Nagios to monitor.


Save file (:wq!) and exit vi editor


4. Need to create user name with home folder for user


  1. adduser nagios

Set password for nagios to access from Nagios server

  1. passwd nagios
  1. cd /home/nagios
  1. mkdir .ssh
  1. mkdir bin


5. After that need to change owner of those folder which is created by root.

  1. chown nagios:nagios .ssh/ -R
  1. chown nagios:nagios bin –R

6. Copy public key (authorized_keys) file from any existing working server to access server password authentication less and change permissions on it as below

chmod 500 /home/nagios/.ssh/authorized_keys

chown nagios:nagios /home/nagios/.ssh/ authorized_keys then try to ssh new server from nagios server (It should work)


7. Need to install nagios packages on host machine

yum install nagios-plugins

yum install perl

yum install python3-psutil

ln -s /bin/python3 /usr/bin/python

yum updateinfo

dnf install perl-Array-Unique

dnf install perl-File-Slurp

dnf install perl-Number-Format

dnf install perl-utils

dnf install nagios-plugins-perl

dnf install perl-LWP-Protocol-https

8. Copy required plugins from existing server on new server into bin folder and change permissions on those plugins as below

chmod 755 /home/nagios/bin/*

chown nagios:nagios /home/nagios/bin/*

9. Run below command on nagios server and check syntax errors with below command

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

10. If we got all errors and warning zero, then go to nagios dashboard (nagios.apoyar.eu) and restart the nagios process it.