Adding a New Bleckmann Host to Nagios Monitoring: Difference between revisions

From Apoyar Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
• Log in to the Mercury server (your internal DNS server).
• Log in to the Mercury server (your internal DNS server).


• Add the DNS entry (IP Hostname) for the new server.
• Add the DNS entry (IP > Hostname) for the new server.




Line 22: Line 22:
cd /usr/local/etc/nagios/objects/machines
cd /usr/local/etc/nagios/objects/machines


3. Create or edit the config for the new server
3. Edit the config for the new server


vi bleckmann.cfg
vi bleckmann.cfg
Line 82: Line 82:
Install the NRPE agent and required packages:
Install the NRPE agent and required packages:


Core plugins and dependencies
'''Core plugins and dependencies'''


yum install nagios-plugins
yum install nagios-plugins
Line 93: Line 93:




Perl modules
'''Perl modules'''


dnf install perl-Array-Unique
dnf install perl-Array-Unique
Line 108: Line 108:




EPEL and full NRPE plugin set
'''EPEL and full NRPE plugin set'''


yum install epel-release -y
yum install epel-release -y

Latest revision as of 14:12, 27 June 2025

🔹 Step 1: Add DNS Entry (on Mercury Server)

Before anything else:

• Make sure the Nagios server can resolve the new server’s hostname.

• Log in to the Mercury server (your internal DNS server).

• Add the DNS entry (IP > Hostname) for the new server.


🔹 Step 2: Define the New Server in Nagios

1. Log in to the Nagios server

Example: nagios.apoyar

2. Navigate to the machines config folder

cd /usr/local/etc/nagios/objects/machines

3. Edit the config for the new server

vi bleckmann.cfg

o Add the host definition for the new server (similar to existing entries).

o Save the file.


🔹 Step 3: Add Service Checks for the New Server

1. Go to the services configuration directory:

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

2. Edit the services.cfg file:

vi services.cfg

o Add the new server under all required services (like disk, CPU, memory).

o Use the same format as other servers.


🔹 Step 4: Validate Nagios Configuration

Run the syntax check to ensure there are no errors:

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

• Make sure "Total Warnings: 0" and "Total Errors: 0"

• Fix anything if it shows up


🔹 Step 5: Prepare the New Server for Monitoring

1. Create a nagios user:

adduser nagios

2. Create a bin folder:

cd /home/nagios

mkdir bin

3. Change ownership:

chown nagios:nagios /home/nagios/bin -R


🔹 Step 6: Install Required Nagios Plugins & Dependencies

Install the NRPE agent and required packages:

Core plugins and dependencies

yum install nagios-plugins

yum install perl

yum install python3-psutil

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


Perl modules

dnf install perl-Array-Unique

dnf install perl-File-Slurp

dnf install perl-Number-Format

dnf install nagios-plugins-perl

dnf install perl-LWP-Protocol-https

dnf install perl-List-MoreUtils


EPEL and full NRPE plugin set

yum install epel-release -y

yum install nrpe nagios-plugins-disk nagios-plugins-load nagios-plugins-procs nagios-plugins-users nagios-plugins-swap nagios-plugins-http nagios-plugins-ping nagios-plugins-ssh -y


🔹 Step 7: Copy Custom Plugins

Go to the plugins directory:

cd /usr/lib64/nagios/plugins/

here, get all custom or missing plugins from an existing monitored server.


🔹 Step 8: Configure NRPE

Edit the NRPE configuration:

vi /etc/nagios/nrpe.cfg

• Copy configuration style and plugin command definitions from an existing server.

• Make sure all command[...] entries point to valid plugin scripts.


🔹 Step 9: Enable and Start NRPE

systemctl start nrpe.service

systemctl enable nrpe.service

systemctl status nrpe.service

Ensure it is:

• Active (running)

• Enabled

• No errors in status output


🔹 Step 10: Finalize in Nagios Dashboard

1. Restart Nagios process (from web UI or via command line).

2. After restart, the new server will appear on the dashboard.

3. Manually reschedule checks for all its services.

4. Wait until all checks turn green and OK.