在 Linux 上安装 munin 服务器端在基于Ubuntu/Debian的机器上安装 Munin 服务器:apt-get install munin apache2在基于 Redhat/CentOS 的机器上安装 Munin 服务器:在基于 Redhat 的机器上安装 Munin 之前,你需要确保 启用 EPEL 软件仓库,因为基于 Redhat 的机器的软件仓库默认没有 Munin,下载EPEL 的rpm 安装包(下载对应版本):wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm下载完成后,通过以下命令安装EPEL 软件包rpm -ivh epel-release-6-8.noarch.rpm或rpm -ivh epel-release*安装好EPEL 源后,用yum 命令来检查是否添加到源列表:# yum repolistLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.vonline.vn * epel: buaya.klas.or.id * extras: centos-hn.viettelidc.com.vn * updates: mirrors.fibo.vnrepo id repo name statusbase CentOS-6 - Base 6,381epel Extra Packages for Enterprise Linux 6 - x86_64 10,023extras CentOS-6 - Extras 13nginx nginx repo 47updates CentOS-6 - Updates 1,555repolist: 18,019EPEL已经在repo 后列出,并且显示提供了上万个软件包,所以EPEL 已经安装到你的CentOS了,EPEL源的配置安装到了/etc/yum.repos.d/epel.repo 文件。然后就可以直接安装munin了,执行命令:yum install munin httpd
在 Linux 上配置 Munin 服务器端:下面是我们要在服务器上启动 Munini 所进行的步骤:步骤 1:在 /etc/munin/munin.conf 中添加需要监控的主机详情。在 /etc/munin/munin.conf 文件中添加主机条目,调到文件末尾添加要监控的客户端。在这个例子中,我添加了要监控的数据库服务器和它的 IP 地址。[db.linuxprobe.com]address 192.168.1.25use_node_name yes保存文件并退出。步骤 2:配置 apache web 服务器使其包括 munin 配置。在 /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
在 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 端口,如果不行,你需要在客户端机器中的防火墙打开该端口。访问 Munin web 页面http://munin.linuxprobe.com/munin/index.html即可。注意,测试之前已经将域名定义到了指定的服务端的80端口。