この情報は古い可能性があります!

rrdtoolを使った状態監視ツールでクールな画像を出してくれる
monitorixというツールを使ってみます。

HP: http://www.monitorix.org/

ダウンロードとインストール

cd /usr/local/src
wget http://www.monitorix.org/monitorix-1.2.4.tar.gz
tar zxvf monitorix-1.2.4.tar.gz
cd monitorix-1.2.4
ここでLinuxだとrpmで入れろと怒られるので 手動でインストールします。
cp monitorix.pl /usr/sbin
cp monitorix.conf /etc
cp ports/Linux-RHFC/monitorix.init /etc/init.d/monitorix
mkdir /var/lib/monitorix
cp -r reports /var/lib/monitorix
mkdir /usr/local/apache2/cgi-bin/monitorix
cp monitorix.cgi /usr/local/apache2/cgi-bin
cp localhost.cgi /usr/local/apache2/cgi-bin/monitorix

とりあえずドキュメント?類はいらないのでコピーしません。

次に設定です。
意外なほど日本での設定の解説がないので適当にやっておきます。
ということでコンフィグ全部かきます。
やりながらなので当てにならないかもしれません。
あと、現状日本語は使えないようです('A`)

/etc/monitorix.conf

#!/usr/bin/perl
#
# @(#) Fibranet NSP, SL
# Copyright (C) 2005-2006 by Jordi Sanfeliu < admin@fibranet.cat >
#
# config file for Monitorix
#
# +----------------------------------------+----------------------+
# | | image number 2 |
# | image number 1 +----------------------+
# | | image number 3 |
# +----------------------------------------+----------------------+
#
# +--------------------+---------------------+--------------------+
# | image number 1 | image number 3 | image number 5 |
# +--------------------+---------------------+--------------------+
# | image number 2 | image number 4 | image number 6 |
# +--------------------+---------------------+--------------------+
#
#
# Rigid levels = 0, 1 or 2:
# 0 - No rigid, no lower-limit and no upper-limit
# 1 - No rigid, but with lower-limit and upper-limit
# 2 - Rigid with lower-limit and upper-limit
#
# All LIMIT values are really limited if RIGID == 2 (RRD feature).
#

use strict;

# General
our $TITLE="momo-i web server"; # <title></title>に入る名前
our $HOSTNAME="www.momo-i.org"; # ホスト名
our $OSTYPE="Linux-RHFC"; # Linux-RHFC, FreeBSD, ...
our $IDATE="01 Jan 2006"; # initial statistics date
our $SAMBAVER="3"; # Sambaのバージョン(2か3)
our $MULTIHOST="N"; # Enable multihost feature
our $MULTIHOST_FOOTER="Y"; # (multihost) display URL in image
our $MULTIHOST_IMGPERLINE="2"; # (multihost) # of images per line
our $REPORT_LANG="en"; # Report language
our $THEME_COLOR="black"; # Default is "black", none is "white"
our $EMAIL="webmaster\@momo-i.org"; # レポートメールのアドレス(?)

# CPU stats configuration
our $CPU1_RIGID="1"; # rigid level
our $CPU1_LIMIT="2"; # CPUs max value
our $CPU2_RIGID="0"; # rigid level
our $CPU2_LIMIT="100"; # NPROC max value
our $MEMORY="2048"; # MB of memory

# HP/Compaq servers supported for temperatures graphic
# ML310, ML330G3, ML350G3, ML570
our $MACHINE=""; # HP/Compaq server model

# DISK stats configuration
our @MNT_LIST =("/boot"); # 最大7つまでパーティションの指定が可能
our @MNT_ACOL =("#888888",
"#44EEEE",
"#EE44EE",
"#EEEE44",
"#44EE44",
"#4444EE",
"#FFA500"); # predefined mount area colors
our @MNT_LCOL =("#888888",
"#00EEEE",
"#EE00EE",
"#EEEE00",
"#00EE00",
"#0000EE",
"#DDA500"); # predefined line2 colors
our $DISK2_RIGID="2"; # rigid level
our $DISK2_LIMIT="1000"; # IOCount max value
our $DISK3_RIGID="2"; # rigid level
our $DISK3_LIMIT="1000"; # Sector max value

# NET stats configuration
our @NET_LIST =("eth0",
"eth1"); # net devices (max 3)
our @NET_TYPE =("ADSL1Mbs Internet",
"FastEthernet LAN"); # device description
our @NET_RIGID=("2",
"2"); # rigid level
our @NET_LIMIT=("100000",
"10000000"); # bytes per second max value
our $INETIF="eth0"; # specify inet interface (eth0, eth1)

# SERVU stats configuration
our $SERVU1_RIGID="0"; # rigid level
our $SERVU1_LIMIT="1000"; # Services max value
our $SERVU2_RIGID="0"; # rigid level
our $SERVU2_LIMIT="1000"; # POP3 hits max value
our $SERVU3_RIGID="0"; # rigid level
our $SERVU3_LIMIT="1000"; # WWW hits max value

# Port numbers
# For those ports you don't want monitorize, please leave the variable defined
# as simply "our $PORTnn;" (without quotes) where nn is the port number.
our $PORT01="25";
our $PORT02="21";
our $PORT03="80";
our $PORT04="22";
our $PORT05="23";
our $PORT06="110";
our $PORT07="139";
our $PORT08="3306";
our $PORT09="4559";
our $PORT10="3128";
our $PORT11="53";
our $PORT12="143";

# Port names
# For those ports you don't want monitorize, please leave the variable defined
# as simply "our $PORTnn_NAME;" (without quotes) where nn is the port number.
our $PORT01_NAME="SMTP";
our $PORT02_NAME="FTP";
our $PORT03_NAME="WWW";
our $PORT04_NAME="SSH";
our $PORT05_NAME="TELNET";
our $PORT06_NAME="POP3";
our $PORT07_NAME="NETBIOS";
our $PORT08_NAME="MYSQL";
our $PORT09_NAME="FAX";
our $PORT10_NAME="SQUID";
our $PORT11_NAME="DNS";
our $PORT12_NAME="IMAP";

# PORT1 stats configuration
our $PORT01_RIGID="2"; # rigid level
our $PORT01_LIMIT="1000"; # PORT01 max value
our $PORT02_RIGID="2"; # rigid level
our $PORT02_LIMIT="1000"; # PORT02 max value
our $PORT03_RIGID="2"; # rigid level
our $PORT03_LIMIT="1000"; # PORT03 max value
our $PORT04_RIGID="2"; # rigid level
our $PORT04_LIMIT="1000"; # PORT04 max value
our $PORT05_RIGID="2"; # rigid level
our $PORT05_LIMIT="1000"; # PORT05 max value
our $PORT06_RIGID="2"; # rigid level
our $PORT06_LIMIT="1000"; # PORT06 max value

# PORT2 stats configuration
our $PORT07_RIGID="2"; # rigid level
our $PORT07_LIMIT="1000"; # PORT07 max value
our $PORT08_RIGID="2"; # rigid level
our $PORT08_LIMIT="1000"; # PORT08 max value
our $PORT09_RIGID="2"; # rigid level
our $PORT09_LIMIT="1000"; # PORT09 max value
our $PORT10_RIGID="2"; # rigid level
our $PORT10_LIMIT="1000"; # PORT10 max value
our $PORT11_RIGID="2"; # rigid level
our $PORT11_LIMIT="1000"; # PORT11 max value
our $PORT12_RIGID="2"; # rigid level
our $PORT12_LIMIT="1000"; # PORT12 max value

# USER stats configuration
our $USER1_RIGID="0"; # rigid level
our $USER1_LIMIT="100"; # Login/SSH max value
our $USER2_RIGID="0"; # rigid level
our $USER2_LIMIT="100"; # Samba max value
our $USER3_RIGID="0"; # rigid level
our $USER3_LIMIT="100"; # NetaTalk max value

# INT stats configuration
our $INT1_RIGID="0"; # rigid level
our $INT1_LIMIT="100"; # Generic Interrupt max value
our $INT2_RIGID="0"; # rigid level
our $INT2_LIMIT="100"; # Core-devices max value
our $INT3_RIGID="0"; # rigid level
our $INT3_LIMIT="100"; # Low-devices max value

# List of Servers
our @SERV_LIST;

# Defined colors for black mode
our %BLACK = ("canvas" => "#000000",
"back" => "#101010",
"font" => "#C0C0C0",
"mgrid" => "#80C080",
"grid" => "#808020",
"frame" => "#808080",
"arrow" => "#FFFFFF",
"shadea" => "#404040",
"shadeb" => "#404040" );

# PC LAN for accounting traffic bytes
our $PC_DEFMAIL=$EMAIL; # default when @PC_MAIL is not used
our @PC_MAIL; # email for each pc on LAN
our $PC_MAX=100; # far enough (DON'T TOUCH THIS!)
our @PC_LIST;
#our @PC_LIST = ("pc101", # list of pc on LAN (DNS name)
# "pc102",
# "pc103");
#our @PC_IP = ("192.168.1.101/32", # list of pc on LAN (IP address + mask)
# "192.168.1.102/32",
# "192.168.1.103/32");


# Paths
our %SMBSTATUS = ("Linux-RHFC" => "/usr/bin/smbstatus",
"FreeBSD" => "/usr/local/bin/smbstatus");
our %MACUSERS = ("Linux-RHFC" => "/usr/bin/macusers",
"FreeBSD" => "/usr/local/bin/macusers");
our %HTTP_LOG = ("Linux-RHFC" => "/usr/local/apache2/logs/access_log",
"FreeBSD" => "/var/log/httpd-access.log");
our %SECURE_LOG = ("Linux-RHFC" => "/var/log/secure",
"FreeBSD" => "/var/log/auth.log");

our %PATH_CRON = ("Linux-RHFC" => "/etc/cron.d/monitorix.sh",
"FreeBSD" => "/var/cron/tabs/monitorix.sh");
our %PATH_BIN = ("Linux-RHFC" => "/usr/sbin/monitorix.pl",
"FreeBSD" => "/usr/local/sbin/monitorix.pl");
our %BASE_WWW = ("Linux-RHFC" => "/usr/local/apache/htdocs",
"FreeBSD" => "/usr/local/www/data");
our %BASE_DIR = ("Linux-RHFC" => "/var/lib/monitorix/",
"FreeBSD" => "/usr/local/lib/monitorix/");

# =======================================================================
# ====== Probably you dont have to touch anything below this line ======
# =======================================================================

our @GRAPH_NAME = ("cpu",
"temp",
"disk",
"net",
"servu",
"port",
"user",
"int" );

our %GRAPH_TITLE = ( "cpu" => "CPU load average and memory utilization",
"temp" => "Core temperatures",
"disk" => "Disk i/o activity and usage",
"net" => "Network traffic and usage",
"servu" => "Network services demand",
"port" => "Network port traffic",
"user" => "Users using the system",
"int" => "Devices interrupt activity" );

our %GRAPHS =("CPU load" => "_cpu1",
"Processes" => "_cpu2",
"Memory" => "_cpu3",
"CPU temperatures" => "_temp1",
"System board temperatures" => "_temp2",
"Disk usage" => "_disk1",
"Disk i/o activity" => "_disk2",
"Disk sectors activity" => "_disk3",
"Network eth0 traffic" => "_net01",
"Network eth0 packets" => "_net02",
"Network eth0 errors" => "_net03",
"Network eth1 traffic" => "_net11",
"Network eth1 packets" => "_net12",
"Network eth1 errors" => "_net13",
"Network eth2 traffic" => "_net21",
"Network eth2 packets" => "_net22",
"Network eth2 errors" => "_net23",
"Network services demand" => "_servu1",
"POP3 service demand" => "_servu2",
"WWW service demand" => "_servu3",
"Port 01 traffic" => "_port01",
"Port 02 traffic" => "_port02",
"Port 03 traffic" => "_port03",
"Port 04 traffic" => "_port04",
"Port 05 traffic" => "_port05",
"Port 06 traffic" => "_port06",
"Port 07 traffic" => "_port07",
"Port 08 traffic" => "_port08",
"Port 09 traffic" => "_port09",
"Port 10 traffic" => "_port10",
"Port 11 traffic" => "_port11",
"Port 12 traffic" => "_port12",
"SSH/Telnet users" => "_user1",
"Samba users" => "_user2",
"NetaTalk users" => "_user3",
"Interrupt activity" => "_int1",
"Core activity" => "_int2",
"Low-Devices activity" => "_int3");

# Pathnames
our $BASE_URL="http://" . $ENV{HTTP_HOST};
our $USAGE_DIR="usage/";
our $REPORT_DIR="reports/";
our $IMGSEMAIL_DIR="imgs_email/";

our $CPU_RRD=$BASE_DIR{$OSTYPE} . "cpu.rrd";
our $DISK_RRD=$BASE_DIR{$OSTYPE} . "disk.rrd";
our $NET_RRD=$BASE_DIR{$OSTYPE} . "net.rrd";
our $SERVU_RRD=$BASE_DIR{$OSTYPE} . "servu.rrd";
our $PORT_RRD=$BASE_DIR{$OSTYPE} . "port.rrd";
our $USER_RRD=$BASE_DIR{$OSTYPE} . "user.rrd";
our $INT_RRD=$BASE_DIR{$OSTYPE} . "int.rrd";
our $PC_RRD=$BASE_DIR{$OSTYPE} . "pc.rrd";
our $TEMP_RRD=$BASE_DIR{$OSTYPE} . "temp.rrd";

our $LOGO=$BASE_DIR{$OSTYPE} . $REPORT_DIR . $REPORT_LANG . "/" . $IMGSEMAIL_DIR . "logo.jpg";
our $TIT=$BASE_DIR{$OSTYPE} . $REPORT_DIR . $REPORT_LANG . "/" . $IMGSEMAIL_DIR . "title.jpg";
our $BLANK=$BASE_DIR{$OSTYPE} . $REPORT_DIR . $REPORT_LANG . "/" . $IMGSEMAIL_DIR . "blank.png";
our $SIGN=$BASE_DIR{$OSTYPE} . $REPORT_DIR . $REPORT_LANG . "/" . $IMGSEMAIL_DIR . "signature.png";

とりあえずこれで以下のコマンドをたたいて何も表示されなければOKです。

/usr/sbin/monitorix.pl

エラーが出た場合はその箇所を修正しましょう。

次に/usr/local/apache/htdocs/monitorix/にいろいろと出てるか確認します。
http://localhost/monitorix/ で表示がされればOKです。

コメントを追加

Plain text

  • HTMLタグは利用できません。
  • 行と段落は自動的に折り返されます。
  • ウェブページのアドレスとメールアドレスは自動的にリンクに変換されます。
CAPTCHA
半角で
この質問はあなたが人間の訪問者であるかどうかをテストし、自動化されたスパム送信を防ぐためのものです。
ももーい に投稿