on  it road.com

访问 Nagios Web 界面

在 Web 浏览器中打开 URL http://nagios-01.onitroad.com/nagios4/。

以 nagiosadmin 用户身份登录。

成功登录后,我们已到达 Nagios 默认仪表板。

单击左侧菜单中的“战术概览”。

单击左侧菜单中的“服务”。

在 Ubuntu 20.04 LTS 上安装 Nagios 监控服务器

Nagios Core 是一种流行的网络监控工具。
在本教程中,我们将学习如何在 Ubuntu 20.04 LTS 上安装它。

在 Ubuntu 20.04 LTS 上安装 Nagios Core

Nagios Core 可通过标准 APT 存储库在 Ubuntu 20.04 LTS 中使用。
尽管可用版本不是最新的,但它是适用于 Linux 发行版的稳定且受支持的版本。

因此,我们可以使用 apt 命令轻松地在 Ubuntu 上安装 Nagios Core 和 Nagios Plugins。

$ sudo apt install -y nagios4 nagios-plugins-contrib nagios-nrpe-plugin
...
Processing triggers for php7.4-cli (7.4.3-4ubuntu2.4) ...
Processing triggers for libapache2-mod-php7.4 (7.4.3-4ubuntu2.4) ...

在安装 Nagios 核心的过程中,可能会要求我们配置 Postfix 邮件设置。

选择“无配置”选项,然后单击“确定”以完成设置。

Nagios 的 Apache 配置文件使用以下两个 apache 模块。
mod_authz_groupfile 用于允许或者拒绝通过组成员身份验证的访问,mod_authz_groupfile 启用 MD5 摘要验证。

因此,我们必须通过在 Linux Bash 提示符下执行以下命令来启用它们。

$ sudo a2enmod authz_groupfile auth_digest
[sudo] password for jackli:
Considering dependency authz_core for authz_groupfile:
Module authz_core already enabled
Enabling module authz_groupfile.
Considering dependency authn_core for auth_digest:
Module authn_core already enabled
Enabling module auth_digest.
To activate the new configuration, you need to run:
  systemctl restart apache2

Nagios Core 的默认配置文件安装在 Apache 配置目录中。
我们可以根据要求对其进行修改。

使用 nano 文本编辑器编辑 Nagios 配置文件。

$ sudo nano /etc/apache2/conf-enabled/nagios4-cgi.conf

找到此文件中的以下几行,并通过在行首插入井号 (#) 来注释它们。

#Require ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
#<Files "cmd.cgi">
#Require all    granted
#</Files>

通过从行首删除哈希 (#) 符号来查找并取消注释以下行。

Require valid-user

要访问 Nagios Web 界面,我们需要一个用户凭据。

我们可以使用以下命令在身份验证文件中添加用户。

$ sudo htdigest -c /etc/nagios4/htdigest.users Nagios4 nagiosadmin
Adding password for nagiosadmin in realm Nagios4.
New password:
Re-type new password:

重新启动 Apache 服务以应用我们迄今为止所做的更改。

$ sudo systemctl restart apache2

在 Ubuntu ufw(简单防火墙)中允许 Apache 服务。

$ sudo ufw allow Apache
Rules updated
Rules updated (v6)
日期:2020-09-17 00:16:44 来源:oir作者:oir