❏ 站外平台:

在 Linux 上安装和配置 Munin 监控服务器

作者: Surendra Anne 译者: LCTT 나원호

| 2016-01-22 21:32   评论: 5 收藏: 5    

Munin 是一款类似 RRD tool 的非常棒的系统监控工具,它能提供给你多方面的系统性能信息,例如 磁盘、网络、进程、系统和用户。这些是 Munin 默认监控的内容。

Munin 如何工作?

Munin 以客户端-服务器模式运行。主服务器上运行的 Munin 服务器进程会从本地运行的客户端守护进程(Munin 可以监控它自己的资源)或者远程客户端(Munin 可以监控上百台机器)收集数据,然后在它的 web 界面上以图形的方式显示出来。

在服务器中配置 Munin

要配置服务器端和客户端,我们需要完成以下两步。

  1. 安装 Munin 服务器软件包并配置,使得它能从客户端收集数据。
  2. 安装 Munin 客户端,使得服务器能连接到客户端守护进程进行数据收集。

在 Linux 上安装 munin 服务器端

在基于 Ubuntu/Debian 的机器上安装 Munin 服务器:

apt-get install munin apache2

在基于 Redhat/CentOS 的机器上安装 Munin 服务器:

在基于 Redhat 的机器上安装 Munin 之前,你需要确保 启用 EPEL 软件仓库,因为基于 Redhat 的机器的软件仓库默认没有 Munin。

yum install munin httpd

在 Linux 上配置 Munin 服务器端

下面是我们要在服务器上启动 Munini 所进行的步骤:

  1. 在 /etc/munin/munin.conf 中添加需要监控的主机详情。
  2. 配置 apache web 服务器使其包括 munin 配置。
  3. 为 web 界面创建用户名和密码
  4. 重启 apache 服务器

步骤 1

/etc/munin/munin.conf 文件中添加主机条目。调到文件末尾添加要监控的客户端。在这个例子中,我添加了要监控的数据库服务器和它的 IP 地址。

示例:

[db.linuxnix.com]
 address 192.168.1.25
 use_node_name yes

保存文件并退出。

步骤 2

在 /etc/apache2/conf.d 目录中编辑或创建文件 munin.conf 用于包括 Munin 和 Apache 相关的配置。另外注意一点,默认其它和 web 相关的 Munin 配置保存在 /var/www/munin 目录。

vi /etc/apache2/conf.d/munin.conf

内容:

Alias /munin /var/www/munin
<Directory /var/www/munin>
 Order allow,deny
 Allow from localhost 127.0.0.0/8 ::1
 AllowOverride None
 Options ExecCGI FollowSymlinks
 AddHandler cgi-script .cgi
 DirectoryIndex index.cgi
 AuthUserFile /etc/munin/munin.passwd
 AuthType basic
 AuthName "Munin stats"
 require valid-user
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault M310
 </IfModule>
</Directory>

保存文件并退出。

步骤 3

现在为查看 munin 的图示而创建用户名和密码:

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

注意:对于 Redhat/Centos 机器,要访问你的配置文件,需要在每个路径中用 “httpd” 替换 “apache2”。

步骤 4

重启 Apache 服务器,使得 Munin 配置生效。

基于 Ubuntu/Debian :

service apache2 restart

基于 Centos/Redhat :

service httpd restart

在 Linux 上安装和配置 Munin 客户端

步骤 1

在 Linux 上安装 Munin 客户端

apt-get install munin-node

注意:如果你想监控你的 Munin 服务器端,你也需要在服务器端安装 munin-node。

步骤 2

编辑 munin-node.conf 文件配置客户端。

vi /etc/munin/munin-node.conf

示例:

allow ^127\.0\.0\.1$
allow ^10\.10\.20\.20$

# 监听到哪个地址上
host *

# 以及哪个端口
port 4949

注意: 10.10.20.20 是我的 Munin 服务器,它连接到客户端的 4949 端口获取数据。

步骤 3

在客户端机器中重启 munin-node:

service munin-node restart

测试连接

检查你是否能从服务器的连接到客户端的 4949 端口,如果不行,你需要在客户端机器中的防火墙打开该端口。

telnet db.linuxnix.com 4949

访问 Munin web 页面

http://munin.linuxnix.com/munin/index.html

希望这些能对你配置基本的 Munin 服务器有所帮助。 


via: http://www.linuxnix.com/install-and-configure-munin-monitoring-server-in-linux/

作者:Surendra Anne 译者:ictlyh 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出



最新评论

[1]
来自湖南湘潭的 Chrome 49.0|Windows XP 用户 发表于 2016-03-21 20:41 的评论:
Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
You have new mail in /var/mail/root
来自湖北武汉的 Firefox 47.0|Windows 7 用户 2016-06-13 10:31 6 回复
增加selinux中http的端口
semanage port -l|grep http #查看SELinux下http相关端口
semanage port -a -t http_port_t -p tcp 888 #增加这个非标准端口即可
[1]
来自湖南湘潭的 Chrome 49.0|Windows XP 用户 发表于 2016-03-21 20:41 的评论:
Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
You have new mail in /var/mail/root
linux [Chrome 49.0|Mac 10.11] 2016-03-22 09:21 4 回复
这不是说了么,80端口被占用了,肯定是有另外一个 web 服务器占着呢。
来自湖南湘潭的 Chrome 49.0|Windows XP 用户 2016-03-21 20:40 4 回复
httpd重启失败,我是用的CentOS
alpha [Firefox 44.0|Windows 7] 2016-02-15 15:23 6 回复
The requested URL /munin/ was not found on this server.
安装如上的配置,验证测试时候出现问题了呢!!
httpd的/var/www/html/下是有munin文件及内容的
[root@oracle munin]# pwd
/var/www/html/munin
[root@oracle munin]# ls
disk-day.html    disk-year.html   exim-week.html  linux.com           network-week.html  processes-day.html    processes-year.html  system-month.html
disk-month.html  exim-day.html    exim-year.html  network-day.html    network-year.html  processes-month.html  static               system-week.html
disk-week.html   exim-month.html  index.html      network-month.html  problems.html      processes-week.html   system-day.html      system-year.html
[root@oracle munin]#

但是网页上就是不能发现,权限修改了755,httpd服务重启过了
求解答下!!
LCTT 译者
나원호 🌟🌟🌟🌟🌟
共计翻译: 113.5 篇 | 共计贡献: 817
贡献时间:2015-04-03 -> 2017-06-28
访问我的 LCTT 主页 | 在 GitHub 上关注我


返回顶部

分享到微信

打开微信,点击顶部的“╋”,
使用“扫一扫”将网页分享至微信。