Nagios 是一个自由开源的网络和警报引擎,它用于监控各种设备,例如网络设备和网络中的服务器。它支持 Linux 和 Windows,并提供了直观的 Web 界面,可让你轻松监控网络资源。
Nagios 是一个自在开源的网络和警报引擎,它用于监控各种设备,例如网络设备和网络中的服务器。它支撑 Linux 和 Windows,并供给了直观的 Web 界面,可让你轻松监控网络资源。经过专业装备后,它能够在服务器或网络设备下线或许毛病时向你宣布邮件警报。在本文中,咱们阐明了如安在 RHEL 8/CentOS 8 上装置和装备 Nagios Core。
Nagios Core 的先决条件
在开端之前,请先查看并保证有以下各项:
- RHEL 8/CentOS 8 环境
- 能经过 SSH 拜访该环境
- 快速安稳的互联网衔接
满意上述要求后,咱们开端吧!
过程 1:装置 LAMP
为了使 Nagios 能够按预期作业,你需求装置 LAMP 或其他 Web 软件,由于它们将在浏览器上运转。为此,请履行以下指令:
%&&&&&%0
Install-LAMP-stack-CentOS8
你需求保证 Apache Web 服务器已发动并正在运转。为此,请运用以下指令启用并发动 Apache 服务器:
# systemctl start httpd
# systemctl enable httpd
Start-enable-httpd-CentOS8
查看 Apache 服务器运转状况:
# systemctl status httpd
Check-status-httpd-centos8
接下来,咱们需求启用并发动 MariaDB 服务器,运转以下指令:
# systemctl start mariadb
# systemctl enable mariadb
Start-enable-MariaDB-CentOS8
要查看 MariaDB 状况,请运转:
# systemctl status mariadb
Check-MariaDB-status-CentOS8
别的,你或许会考虑加强或维护服务器,使其不容易遭到未经授权的拜访。要维护服务器,请运转以下指令:
# mysql_secure_installation
保证为你的 MySQL 实例设置一个强暗码。关于后续提示,请输入 “Y” 并按回车。
Secure-MySQL-server-CentOS8
过程 2:装置必需的软件包
除了装置 LAMP 外,还需求一些其他软件包来装置和正确装备 Nagios。因而,如下所示装置软件包:
# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix
Install-requisite-packages-CentOS8
过程 3:创立 Nagios 用户帐户
接下来,咱们需求为 Nagios 用户创立一个用户帐户。为此,请运转以下指令:
# adduser nagios
# passwd nagios
Create-new-user-for-Nagios
现在,咱们需求为 Nagios 创立一个组,并将 Nagios 用户增加到该组中。
# groupadd nagiosxi
现在增加 Nagios 用户到组中:
# usermod -aG nagiosxi nagios
别的,将 Apache 用户增加到 Nagios 组:
0
# systemctl start httpd
# systemctl enable httpd
Add-Nagios-group-user
过程 4:下载并装置 Nagios Core
现在,咱们能够持续装置 Nagios Core。Nagios 4.4.5 的最新安稳版别于 2019 年 8 月 19 日发布。但首要,请从它的官方网站下载 Nagios tarball 文件。
要下载 Nagios Core,请首进入/tmp
目录:
1
# systemctl start httpd
# systemctl enable httpd
接下来下载 tarball 文件:
2
# systemctl start httpd
# systemctl enable httpd
Download-Nagios-CentOS8
下载完 tarball 文件后,运用以下指令将其解紧缩:
3
# systemctl start httpd
# systemctl enable httpd
接下来,进入未紧缩的文件夹:
4
# systemctl start httpd
# systemctl enable httpd
按此次序运转以下指令:
5
# systemctl start httpd
# systemctl enable httpd
要装备 Apache,请运转以下指令:
6
# systemctl start httpd
# systemctl enable httpd
过程 5:装备 Apache Web 服务器身份验证
接下来,咱们将为用户Nagiosadmin
设置身份验证。请注意不要更改该用户名,不然,或许会要求你进一步的装备,这或许很繁琐。
要设置身份验证,请运转以下指令:
7
# systemctl start httpd
# systemctl enable httpd
Configure-Apache-webserver-authentication-CentOS8
体系将提示你输入nagiosadmin
用户的暗码。输入并按要求承认暗码。在本教程结束时,你将运用该用户登录 Nagios。
为使更改收效,请重新发动 Web 服务器:
8
# systemctl start httpd
# systemctl enable httpd
过程 6:下载并装置 Nagios 插件
插件能够扩展 Nagios 服务器的功用。它们将协助你监控各种服务、网络设备和运用。要下载插件的 tarball 文件,请运转以下指令:
9
# systemctl start httpd
# systemctl enable httpd
接下来,解压 tarball 文件并进入到未紧缩的插件文件夹:
0
# systemctl status httpd
要装置插件,请编译源代码,如下所示:
1
# systemctl status httpd
过程 7:验证和发动 Nagios
成功装置 Nagios 插件后,验证 Nagios 装备以保证全部杰出,而且装备中没有过错:
2
# systemctl status httpd
Verify-Nagios-settings-CentOS8
接下来,发动 Nagios 并验证其状况:
3
# systemctl status httpd
Start-check-status-Nagios-CentOS8
假如体系中有防火墙,那么运用以下指令答应 ”80“ 端口:
4
# systemctl status httpd
过程 8:经过 Web 浏览器拜访 Nagios 面板
要拜访 Nagios,请翻开服务器的 IP 地址,如下所示:http://server-ip/nagios。
这将呈现一个弹出窗口,提示输入咱们在过程 5 创立的用户名和暗码。输入凭证并点击“Sign In”。
Access-Nagios-via-web-browser-CentOS8
这将引导你到 Nagios 面板,如下所示:
Nagios-dashboard-CentOS8
咱们总算成功地在 CentOS 8 / RHEL 8 上装置和装备了 Nagios Core。欢迎你的反应。
知优网 » 如安在CentOS 8/RHEL 8上装置和装备Nagios Core