Category Archives: Zabbix

さくらのVPSにZabbix 2.2入れた

1.事前準備

前にZabbix 1.8を入れたときの投稿を参照しました。Zabbixのシステム要件はこちらに書いてあります。

MySQLのインストール。

# yum -y install mysql mysql-server mysql-devel

初期設定。

# vi /etc/my.cnf
default-character-set=utf8
character-set-server=utf8
skip-character-set-client-handshake

# service mysqld start

mysql_secure_installationを走らせて、rootのパスワードの設定などをする。

# mysql_secure_installation

PHPのインストール。

# yum -y install php php-gd php-bcmath php-mysql php-mbstring php-xml

その他のインストール。

# yum -y install OpenIPMI fping iksemel net-snmp net-snmp-libs net-snmp-utils unixODBC

2.Zabbix 2.2インストール

2.2のyumリポジトリを使えるようにする。

# rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm

インストール。

# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese

※これでzabbix, zabbix-web, zabbix-serverが一緒に入ります。

# yum -y install zabbix-agent zabbix-get

インストールしたら、メジャーバージョンアップしないようにenabledを0にする。

# vi /etc/yum.repos.d/zabbix.repo

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/2.2/rhel/6/$basearch/
enabled=0

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/6/$basearch/
enabled=0

3.Zabbix 2.2起動のための設定

MySQLにzabbixデータベースを作って権限付与。

# mysql -u root -p
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '★★★';
mysql> flush privileges;

スキーマとデータをインポート。

# cd /usr/share/doc/zabbix-server-mysql-2.2.2/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

PHPの設定。時間のところを変える。

# vi /etc/php.ini

[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'

# service httpd restart

Zabbix設定のDB名などを修正。

# vi /etc/zabbix/zabbix_server.conf

Zabbix起動。

# service zabbix-server start

あとは、https://★★★/zabbix/にアクセスしてボタンを押していくだけ。

完了後にログインして無事インストール完了!

しかしながら初期画面にて、Zabbix server is not runningが出てしまいました。SELinuxは無効になっているので、悩みました。zabbix_server.confと/etc/zabbix/web/zabbix.conf.phpのIPをlocalhostから127.0.0.1にしたところ、問題は解決しました。うーん、IPv6あたりが悪さをしていたのかなあ。