Icinga 是一个强大的开源监控解决方案,提供了一个强大的平台来确保您的 IT 基础架构的稳定性和性能。
在 Fedora 38 上安装 Icinga
第 1 步。在我们可以在 Fedora 38 上安装 Icinga 之前,重要的是要确保我们的系统是最新的软件包。这将确保我们可以访问最新功能和错误修复,并且我们可以毫无问题地安装 Icinga:
<span class="pln">sudo dnf update</span>
第 2 步。安装必要的软件包。
Icinga的Web界面依赖于Apache网络服务器和PHP。通过运行以下命令安装这些包:
<span class="pln">sudo dnf install httpd sudo dnf install php php</span><span class="pun">-</span><span class="pln">cli php</span><span class="pun">-</span><span class="pln">xml php</span><span class="pun">-</span><span class="pln">json php</span><span class="pun">-</span><span class="pln">mbstring</span>
Icinga 2是核心监控引擎,而Icinga Web 2提供基于Web的前端。使用以下命令安装它们:
<span class="pln">sudo dnf install icinga2 icinga2</span><span class="pun">-</span><span class="pln">ido</span><span class="pun">-</span><span class="pln">mysql icingaweb2</span>
第 4 步。配置数据库。
为了存储配置和监控数据,Icinga 依赖于数据库。MariaDB是一个合适的选择。使用以下命令安装它:
<span class="pln">sudo dnf install mariadb</span><span class="pun">-</span><span class="pln">server</span>
要保护您的 MariaDB 安装,请使用 MySQL 安全安装脚本:
<span class="pln">sudo mysql_secure_installation</span>
接下来,通过运行以下命令为 Icinga 创建一个数据库:
<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>
系统将提示您输入 MariaDB 根密码:
<span class="pln">CREATE DATABASE icinga</span><span class="pun">;</span><span class="pln"> GRANT ALL PRIVILEGES ON icinga</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'icinga'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'icinga_password'</span><span class="pun">;</span><span class="pln"> FLUSH PRIVILEGES</span><span class="pun">;</span> <span class="kwd">exit</span>
第5步。配置冰雪 2.
打开 Icinga 2 的配置文件:
<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">icinga2</span><span class="pun">/</span><span class="pln">features</span><span class="pun">-</span><span class="pln">available</span><span class="pun">/</span><span class="pln">api</span><span class="pun">.</span><span class="pln">conf</span>
找到以下行并启用 API 功能:
<span class="kwd">object</span> <span class="typ">ApiListener</span> <span class="str">"api"</span> <span class="pun">{</span> <span class="pun">...</span><span class="pln"> accept_config </span><span class="pun">=</span> <span class="kwd">true</span><span class="pln"> accept_commands </span><span class="pun">=</span> <span class="kwd">true</span> <span class="pun">...</span> <span class="pun">}</span>
保存文件,然后启用 Icinga 2 服务以在启动时启动,然后启动它:
<span class="pln">sudo systemctl enable icinga2 sudo systemctl start icinga2</span>
第 6 步。配置 Icinga Web 2。
使用安装脚本配置 IDO 数据库:
<span class="pln">sudo icingacli setup config webserver apache</span>
创建 Icinga Web 2 管理员帐户并启用 Web 界面:
<span class="pln">sudo icingacli setup config webserver</span>
步骤 7.配置 SELinux 和防火墙。
修改 SELinux 设置以允许 Icinga 2 和 Icinga Web 2 正常运行:
<span class="pln">sudo setsebool </span><span class="pun">-</span><span class="pln">P httpd_can_connect_icinga </span><span class="lit">1</span>
在防火墙上打开所需的端口:
<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">http sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">https sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">=</span><span class="lit">5665</span><span class="pun">/</span><span class="pln">tcp sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">runtime</span><span class="pun">-</span><span class="pln">to</span><span class="pun">-</span><span class="pln">permanent</span>
第8步。访问冰网 2.
设置完成后,通过打开 Web 浏览器并导航到以下位置来访问 Icinga Web 2 界面:
<span class="pln">http</span><span class="pun">:</span><span class="com">//your_server_IP/icingaweb2</span>
使用您之前创建的管理员凭据登录。