如何在 Debian 12 上安装 Munin 监控工具如何在 Debian 12 上安装 Munin 监控工具如何在 Debian 12 上安装 Munin 监控工具如何在 Debian 12 上安装 Munin 监控工具
  • 业务
  • 目标
  • 支持
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容

如何在 Debian 12 上安装 Munin 监控工具

发表 admin at 2025年2月28日
类别
  • 未分类
标签

Munin 是一款免费开源系统和网络监控工具,可通过 Web 浏览器以图表形式显示系统指标。该软件作为客户端-服务器模型工作。 IT 部门可以通过网络浏览器监控自己的资源和数百台远程计算机。它可以帮助您收集系统信息,例如处理器负载、硬盘使用情况、网络流量、对一台或多台计算机上的服务器服务的访问等等。

本教程将向您展示如何在 Debian 12 上安装 Munin 监控工具。

先决条件

  • 运行 Debian 12 的服务器。
  • 服务器上配置了 root 密码。

安装 Apache 网络服务器

Munin 可以在许多 Web 服务器上运行,包括 Apache、Nginx 和 Lighttpd。在这篇文章中,我们将为 Munin 安装 Apache。

您可以使用以下命令安装 Apache 和其他必需的软件包:

apt install apache2 apache2-utils libcgi-fast-perl libapache2-mod-fcgid -y

安装所有软件包后,您必须启用 fcgid 模块。您可以使用以下命令启用它:

a2enmod fcgid

完成后,重新启动 Apache 服务以应用更改:

systemctl restart apache2

安装Munin监控工具

Munin 软件包默认包含在 Debian 12 默认存储库中。您可以使用以下命令安装它:

apt install munin munin-node munin-plugins-extra -y

安装所有软件包后,您必须创建一个管理员帐户和密码才能访问 Munin。

您可以使用以下命令创建它:

htpasswd -c /etc/munin/munin-htpasswd admin

设置您的管理员密码,如下所示:

New password: 
Re-type new password: 
Adding password for user admin

完成后,您可以继续下一步。

为 Munin 配置 Apache

在 Munin 安装期间,将在 /etc/munin/apache24.conf 中创建 Apache 配置文件。您需要将其复制到 Apache 配置目录中。

cp -p /etc/munin/apache24.conf /etc/apache2/sites-available/munin.conf

接下来,使用以下命令编辑 Munin 配置文件:

nano /etc/apache2/sites-available/munin.conf

进行以下更改:

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
Alias /munin/static/ /var/cache/munin/www/static/

<Directory /var/cache/munin/www>
AuthUserFile /etc/munin/munin-htpasswd
Authtype Basic
AuthName "Munin"
Require valid-user
Options FollowSymLinks SymLinksIfOwnerMatch
Options None
</Directory>

<Directory /usr/lib/munin/cgi>
AuthUserFile /etc/munin/munin-htpasswd
Authtype Basic
AuthName "Munin"
Require valid-user
Options FollowSymLinks SymLinksIfOwnerMatch

<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>
</Directory>

保存并关闭文件,然后使用以下命令启用 Munin 虚拟主机:

a2ensite munin

接下来,重新启动 Apache 和 Munin 服务以应用更改:

systemctl restart apache2
systemctl restart munin-node

您可以使用以下命令检查 Munin 的状态:

systemctl status munin-node

您将得到以下输出:

? munin-node.service - Munin Node
     Loaded: loaded (/lib/systemd/system/munin-node.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-11-06 15:36:58 UTC; 7s ago
       Docs: man:munin-node(1)
             http://guide.munin-monitoring.org/en/stable-2.0/reference/munin-node.html
    Process: 30715 ExecStartPre=install -o munin -g munin -d /run/munin (code=exited, status=0/SUCCESS)
   Main PID: 30716 (munin-node)
      Tasks: 1 (limit: 4679)
     Memory: 9.2M
        CPU: 798ms
     CGroup: /system.slice/munin-node.service
             ??30716 /usr/bin/perl -wT /usr/sbin/munin-node --foreground

Nov 06 15:36:57 debian11 systemd[1]: Starting Munin Node...
Nov 06 15:36:58 debian11 systemd[1]: Started Munin Node.

您还可以使用以下命令检查 Apache 状态:

systemctl status apache2

您将得到以下输出:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-11-06 15:36:51 UTC; 31s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 30700 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 30704 (apache2)
      Tasks: 7 (limit: 4679)
     Memory: 17.3M
        CPU: 115ms
     CGroup: /system.slice/apache2.service
             ??30704 /usr/sbin/apache2 -k start
             ??30705 /usr/sbin/apache2 -k start
             ??30706 /usr/sbin/apache2 -k start
             ??30707 /usr/sbin/apache2 -k start
             ??30708 /usr/sbin/apache2 -k start
             ??30709 /usr/sbin/apache2 -k start
             ??30710 /usr/sbin/apache2 -k start

Nov 06 15:36:51 debian11 systemd[1]: Starting The Apache HTTP Server...

访问 Munin Web 界面

现在,打开 Web 浏览器并使用 URL http://your-server-ip/munin 访问 Munin Web 界面。您将被重定向到 Munin 登录页面:

提供您的管理员用户名、密码,然后单击登录按钮。您应该在以下页面上看到 Munin 仪表板:

结论

恭喜!您已在 Debian 12 上成功安装 Munin 监控服务器。您现在可以将远程计算机添加到 Munin 服务器并从基于 Web 的界面监控它们。

©2015-2025 Norria support@alaica.com