最近在我管理的 Linux 主机上安装了 Monitorix 工具,这是一套可以监控系统状态的工具,可监控的项目非常的多,你也可以自行设定要监控的服务,预设就可以分析 CPU 与内存使用率、磁盘存取使用率(Disk I/O Usage)、网络使用率(Network traffic and usage)、各服务使用需求(network services demand)、使用者登入的状况、....等等,而且还提供非常详尽的 Web 报表,以下是我其中一台主机的报表。
虽然当时官方网站上有提供 Ubuntu Linux 7.10/8.04 的安装说明,但我安装在我的 Ubuntu Linux 8.04 的时候还是有些步骤不太一样,以下是安装的笔记:
安装相关套件 ( 记得一定要安装 Apache 否则没办法看报表 )
apt-get install apache2 rrdtool and librrds-perl procmail
下载最新版 Monitorix 套件 ( 可到http://www.monitorix.org/downloads.html查询下载连结 )
wget http://www.monitorix.org/monitorix-1.2.2.tar.gz
解压缩
tar zxvf monitorix-1.2.2.tar.gz
cd monitorix-1.2.2
vi install.sh
修改 install.sh 安装程式的第 63 到 69 行
把
SBIN="/usr/local/sbin"
ETC="/usr/local/etc"
INIT="/usr/local/etc/rc.d"
LIB="/usr/local/lib"
DOC="/usr/local/share"
HTDOCS="/usr/local/www/data"
CGIBIN="/usr/local/www/cgi-bin"
改成
SBIN="/usr/sbin"
ETC="/etc"
INIT="/etc/init.d"
LIB="/usr/local/lib"
DOC="/usr/local/share"
HTDOCS="/var/www"
CGIBIN="/usr/lib/cgi-bin"
正式进行安装
# ./install.sh
Welcome to Monitorix v1.2.1 installation process.
This install script has detected that this is a Linux operating system.
Currently Monitorix supports only the following Linux distributions:
1 - RedHat/Fedora/CentOS
2 - Generic
3 - Debian
4 - Gentoo
5 - Slackware
Please select your option: 2
The following is a list of the default paths where to install the Monitorix
components:
1 - /usr/sbin
2 - /etc
3 - /etc/init.d
4 - /usr/local/lib
5 - /usr/local/share
6 - /var/www
7 - /usr/lib/cgi-bin
Please type ENTER if all it's correct:
Last chance to stop the installation.
Are you sure to install Monitorix on the paths shown? [y/n]: y
建立一个漏掉的目录
mkdir -p /var/lib/monitorix
修正 vi /etc/monitorix.conf 的问题(第264行)
将
our %BASE_WWW = ("Linux-RHFC" => "/var/www/html",
改成
our %BASE_WWW = ("Linux-RHFC" => "/var/www",
启动 Monitorix 服务
/etc/init.d/monitorix.sh start
变更排程的程式加上执行旗标
chmod +x /etc/cron.d/monitorix
安装完成!
官方相关连结 http://www.monitorix.org/doc-debian.html
来源:Linux社区