Centreon 是一个开源工具,可以监控您的整个基础设施,包括网络、系统和应用程序。Centreon 推动卓越的业务绩效,使 IT 运营与业务目标保持一致。使用 Centreon,您可以根据阈值设置通知、设置电子邮件警报、轻松添加任何系统进行监控。centreon-logocentreon-logo

在 AlmaLinux 8 上安装 Centreon Monitoring

步骤 1. 首先,让我们先确保您的系统是最新的。

sudo dnf update
sudo dnf install epel-release

步骤 2. 在 AlmaLinux 8 上禁用 SELinux。

您可以使用以下命令检查 SELinux 的当前状态:

sestatus

输出:

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      16

要将 SELinux 模式永久设置为 permissive,请运行以下命令:

sudo nano /etc/selinux/config

将 SELINUX 值更改为禁用:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

保存文件并重启系统:

reboot

步骤 3. 在 AlmaLinux 8 上安装 Apache。

运行以下命令安装 Apache HTTP 服务器:

sudo dnf install httpd httpd-tools

在您的系统上安装 Apache 服务后,启动所有必需的服务:

sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl status httpd

步骤 4. 在 AlmaLinux 8 上安装 PHP。

PHP 是一种流行的脚本语言,可为数百万个网站和应用程序的动态内容提供支持。现在我们运行以下命令来安装 PHP:

sudo dnf install php-cli php-fpm php-mysqlnd php-dom php-simplexml php-xml php-curl php-exif php-ftp php-gd php-iconv php-json php-mbstring php-posix

验证并检查 PHP 版本:

php --version

使用新版本的 Centreon,您必须配置 PHP 文件的良好时区。现在您必须更改创建文件以指示您的适当时区:

sudo nano /etc/php.d/php-timezone.ini

添加以下配置:

date.timezone = Etc/UTC

接下来,现在通过编辑max_execution_timemax_input_time在文件中增加 PHP 脚本执行超时:php.ini

sudo nano /etc/php.ini

添加以下文件:

max_execution_time = 300
max_input_time = 300

使用以下命令保存文件,启用并重新启动 PHP-FPM 服务:

sudo systemctl enable php-fpm
sudo systemctl restart php-fpm

步骤 5. 在 AlmaLinux 8 上安装 MariaDB。

MariaDB 是一种流行的数据库服务器。安装很简单,只需要几个步骤,如图所示:

sudo dnf install mariadb-server mariadb

安装完成后,开始使用以下命令使其在系统启动时启动:

sudo systemctl restart mariadb
sudo systemctl status mariadb
sudo systemctl enable mariadb

默认情况下,MariaDB 未加固。您可以使用mysql_secure_installation脚本保护 MariaDB 。您应该仔细阅读以下每个步骤,这些步骤将设置 root 密码、删除匿名用户、禁止远程 root 登录以及删除测试数据库和访问安全 MariaDB 的权限:

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

要登录 MariaDB,请使用以下命令(请注意,它与您用于登录 MariaDB 数据库的命令相同):

mysql -u root -p

这将提示您输入密码,因此请输入您的 MariaDB 根密码并按 Enter。登录到数据库服务器后,您需要为 Centreon 安装创建一个数据库:

MariaDB [(none)]> CREATE DATABASE centreon_database;
MariaDB [(none)]> CREATE USER ‘centreon_user’@’localhost’ IDENTIFIED BY ‘strong-your-password’;
MariaDB [(none)]> GRANT ALL ON centreon_database.* TO ‘centreon_user’@\'localhost’ IDENTIFIED BY ‘strong-your-password’ WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT

步骤 6. 在 AlmaLinux 8 上安装 Centreon Monitoring。

默认情况下,Centreon 在 AlmaLinux 基础存储库中不可用。现在我们将 Centreon 存储库添加到您的 AlmaLinux 系统:

sudo dnf install https://yum.centreon.com/standard/21.10/el8/stable/noarch/RPMS/centreon-release-21.10-2.el8.noarch.rpm

之后,使用以下命令安装 Centreon 软件包:

sudo dnf install centreon centreon-database

接下来,为 Centreon 设置优化的 MariaDB 配置:

cat /etc/systemd/system/mariadb.service.d/centreon.conf
[Service]
LimitNOFILE=32000

我们来看看配置文件:

cat /etc/my.cnf.d/centreon.cnf

这需要重启 MariaDB 服务:

sudo systemctl daemon-reload
sudo systemctl restart mariadb

在开始 Centreon Web 安装过程之前,您需要执行以下命令:

sudo systemctl start mariadb
sudo systemctl start php-fpm
sudo systemctl start httpd
sudo systemctl start centreon
sudo systemctl start cbd
sudo systemctl start centengine
sudo systemctl start gorgoned
sudo systemctl start snmptrapd
sudo systemctl start centreontrapd
sudo systemctl start snmpd

步骤 7. 访问 Centreon Monitoring Web 界面。

成功安装后,打开您的网络浏览器并使用 URL 访问 Centreon 。这将显示欢迎使用 Centreon 安装屏幕,如下所示,并完成完成安装所需的步骤http://your-IP-address/centreon

centreon-monitoring-installation-interfacecentreon-monitoring-installation-interface

感谢您使用本教程在您的 AlmaLinux 8 系统上安装 Centreon 监控。如需更多帮助或有用信息,我们建议您查看Centreon 官方网站。