[CentOS6][Cacti] 監視サーバの準備


Create: 2013/01/22
LastUpdate: 2013/01/23
[ メニューに戻る ]

ここでは、以下のような構成を想定して、Cacti をインストールする監視サーバを1台作成します。
XenServer6環境の仮想マシン(CentOS6.3)を使用します。

監視サーバ
+-------------+
| localhost   |
|             |
| Cacti       |
+-------------+
監視対象
+-------------+
| remotehost  |
|             |
|             |
+-------------+

今回インストールする cacti のバージョンは 0.8.8a です。推奨動作環境は、「Cacti Manual 0.8.8 - Requirements」 を参照してください。
日本語(UTF8)での動作確認が目的なので、ApacheやMysql などの設定変更は、必要最低限としています。
ユーザーを明示していない箇所は、 root ユーザーで作業しています。

1.OSのインストール


仮想マシンには、 こちら の手順で最小構成の CentOS6.0 をインストールしたあと、CentOS6.3 に yum で update しました。
この時点でのサーバの状態は以下のとおり。
  • OS: CentOS6.3
  • 導入パッケージ: 最小構成
  • デフォルト言語: ja_JP.UTF-8
  • タイムゾーン: Asia/Tokyo
  • SELinux: 無効
  • ファイヤーウォール: iptables 停止、ip6tables 停止

2.Apache、php、MySQL のインストール


以下のようにして yumコマンドでApache、php、MySQLをインストールします。
# yum install httpd php php-mysql mysql mysql-server

3.php の設定


PHPの設定についての詳細は、「Cacti Manual 0.8.8 - Configure PHP」 を参照してください。
/etc/php.ini 以下のように修正します。(赤字部分)
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = "Asia/Tokyo"

4.Apacheの起動


Apacheは、デフォルトの設定でOKなので、設定変更せず、以下のようにして、Apacheのサービスを起動します。
# service httpd start
httpd を起動中: httpd: apr_sockaddr_info_get() failed for centos5
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]
※ /etc/httpd/conf/httpd.conf の ServerName を定義すれば、このメッセージは消えます。

5.MySQL の起動


/etc/my.cnf を修正して、mysqlのデフォルトのキャラクタセットを UTF8 に変更します。
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# server charset
character-set-server  = utf8
skip-character-set-client-handshake

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client] # client charset
default-character-set = utf8
mysqlを起動します。
# service mysqld start 
一応、設定した文字コードになっているか確認します。
# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.66, for redhat-linux-gnu (i386) using readline 5.1

Connection id:          2
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.66 Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 20 sec

Threads: 1  Questions: 5  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.250
--------------

mysql> Bye