業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

Ubuntu Server25.10 : Nagios Server

Nagios Server

Nagios is an open source monitoring solution running on Linux.
Nagios is designed to periodically check critical network, application, or server parameters.
These parameters include microprocessor load, number of running processes, log files, disk and memory usage, as well as many other services such as SMTP (Simple Mail Transfer Protocol), HTTP (Hypertext Transfer Protocol), POP3 (Post Office Protocol 3), etc. can be checked.

These parameters require a microprocessor load, a database such as PHP or MySQL to run Nagois, and a web server such as Apache or Nginx. We will proceed under the assumption that all of these have already been configured。

1. Install necessary packages

2. Installing Nagios Core

①Download

②Install

It appears as follows

compile

It appears as follows

Create Nagios Users and Groups

Add Apache User to Nagios Group

Install Nagios Core

Install Nagios init script

Install external command files and permissions

Install Nagios Configuration Files

Install Apache configuration files for Nagios

3. Install Nagios Plugin

①Download the latest code from the Nagios Plugins page

②Install

The following nagios-plugins are available:

Create necessary directories

4. Creating a Nagios Web User

Create a user account to access the Nagios Web Dashboard. This user account is used for authentication.
The default name of the user is nagiosadmin, which is defined as the preferred user name in the /usr/local/nagios/etc/cgi.cfg file.

Set ownership and permissions

Restart Apache

Allow HTTP service port in firewall

Start and Enable Nagios Services

Reboot system

Confirmation of service execution

5. Access the Nagios Web Interface

Access http://[FQDN]/nagios or http://[IP address]/nagios in any browser.
Username : nagoisadmin
Password : Password specified when the user was created above
[Log in]

After successful login, the following dashboard will appear

Show host availability
Click on [Hosts] in the left menu

Click [Tactical Overview] on the left menu to view the monitoring data

Click [Current Status] [Services] on the left menu : The current monitoring service details are displayed.

6. Nagios Agent Configuration

To monitor the agent. Install the following
• NRPE Agent to run plugins

6.1 Installing Nagios NRPE Agent
NRPE agent available in default Ubuntu repository

Version Check

Start and activate the service

Check the status of the NRPE agent

Allow services to pass through the firewall
NRPE uses TCP port 5666 by default.

Check if port 5666/tcp is listening

7. Adding a monitored host

Add the following server to the host and configure it as a target for simple ping death/activity monitoring
OS : Ubuntu24.04
IP address : 192.168.11.85

7.1 Configuration File Editing

7.2 Directory Create

7.3 Create new definition file

The name "korodes.cfg" can be arbitrary.

7.4 Restart Nagios server

Log in to the Nagios server (http://[server IP address]/nagios) and look at Hosts, and the host is added.

8. Adding Monitoring Services

Add monitoring services to the hosts added above.
OS : Ubuntu24.04
IP address : 192.168.11.85

8.1 Configuration on the server to be monitored

8.1.1 Agent installed on monitored hosts
Install nrpe and typical service plugins from EPEL

8.1.2 Configuration File Editing

# vi /etc/nagios/nrpe.cfg

Line 106 : Add a host to allow connections (specify Nagios server)
allowed_hosts=127.0.0.1,::1,192.168.11.83

Line 122 : Allow command arguments
dont_blame_nrpe=1

Line 300-304 : Comment and add
# command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
# command[check_load]=/usr/lib/nagios/plugins/check_load -r -w .15,.10,.05 -c .30,.25,.20
# command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
# command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
# command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

Add part of the plugin

command[check_by_ssh]=/usr/lib/nagios/plugins/check_by_ssh $ARG1$
command[check_dhcp]=/usr/lib/nagios/plugins/check_dhcp $ARG1$
command[check_disk]=/usr/lib/nagios/plugins/check_disk $ARG1$
command[check_file_age]=/usr/lib/nagios/plugins/check_file_age $ARG1$
command[check_ftp]=/usr/lib/nagios/plugins/check_ftp $ARG1$
command[check_http]=/usr/lib/nagios/plugins/check_http $ARG1$
command[check_imap]=/usr/lib/nagios/plugins/check_imap $ARG1$
command[check_load]=/usr/lib/nagios/plugins/check_load $ARG1$
command[check_log]=/usr/lib/nagios/plugins/check_log $ARG1$
command[check_mysql]=/usr/lib/nagios/plugins/check_mysql $ARG1$
command[check_ntp]=/usr/lib/nagios/plugins/check_ntp $ARG1$
command[check_ntp_peer]=/usr/lib/nagios/plugins/check_ntp_peer $ARG1$
command[check_ntp_time]=/usr/lib/nagios/plugins/check_ntp_time $ARG1$
command[check_ping]=/usr/lib/nagios/plugins/check_ping $ARG1$
command[check_pop]=/usr/lib/nagios/plugins/check_pop $ARG1$
command[check_spop]=/usr/lib/nagios/plugins/check_spop $ARG1$
command[check_procs]=/usr/lib/nagios/plugins/check_procs $ARG1$
command[check_smtp]=/usr/lib/nagios/plugins/check_smtp $ARG1$
command[check_ssmtp]=/usr/lib/nagios/plugins/check_ssmtp $ARG1$
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh $ARG1$
command[check_swap]=/usr/lib/nagios/plugins/check_swap $ARG1$
command[check_tcp]=/usr/lib/nagios/plugins/check_tcp $ARG1$
command[check_udp]=/usr/lib/nagios/plugins/check_udp $ARG1$
command[check_ups]=/usr/lib/nagios/plugins/check_ups $ARG1$
command[check_users]=/usr/lib/nagios/plugins/check_users $ARG1$

8.1.3 nrpe server activation and startup

8.1.4 Open NRPE ports 5666/tcp and 5666/udp on firewall

8.2 Nagios Server Side Configuration

8.2.1 nrpe plugin installation

8.2.2 Copy to nagios plugin directory

8.2.3 commands.cfg edit

8.2.4 Edit and add korodes.cfg created when you added the host earlier
I'll add HTTP,SSH,FTP this time.

8.2.5 Restart Nagios

8.2.6 Accsess http://[Nagios Server IP Address]/nagios
Newly added monitoring services are added as shown in the figure below.

Copied title and URL