/etc/sysconfig/osoba

linuxについての忘備録など

CentOS6.4にZabbix2.2環境を構築する

タイトルの通り。

CentOS6.4はクリーンインストール。選んだパッケージはDesktopに開発ツール等(適当で可)。

 

取急ぎselinuxを無効にする。

# setenforce permissive

# vi /etc/sysconfig/selinux

  #SELINUX=enforcing

  ↓
  SELINUX=disabled

 

iptablesを設定する(ここでは検証環境のため自動起動off、ストップ)

# service iptables stop

# chkconfig iptables off

 

MySQLDをインストールし起動。

# yum -y install mysql-server

# /etc/init.d/mysqld start

 

Zabbixのリポジトリファイルをインストール。

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

# yum localinstall zabbix-release-2.2-1.el6.noarch.rpm

 

Zabbixのインストール。

yum install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese zabbix-agent

 

MySQLの設定。

mysql -uroot

mysql> create database zabbix character set utf8;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

mysql> exit

 

MySQLスキーマ作成。

# cd /usr/share/doc/zabbix-server-mysql-2.2.4/create/

# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

 

zabbix_server.confの設定。

※一応アクティブチェック機能の利用を想定した設定もしとく。

# vi /etc/zabbix/zabbix_server.conf

「# DBPassword=」→「DBPassword=zabbix」

「# ListenIP=0.0.0.0」→「ListenIP=192.168.11.230」

「# AllowRoot=0→「AllowRoot=1」

 

zabbix_agentd.confの設定。

# vi zabbix_agentd.conf

「Server=127.0.0.1」→「Server=192.168.11.230」

「ListenIP=0.0.0.0」→「ListenIP=192.168.11.230

「ServerActive=127.0.0.1」→「ServerActive=192.168.11.230

「Hostname=Zabbix server」→「Hostname=zabbix1」※zabbixのWebUI上の設定もこれに合わせる必要あり。

「AllowRoot=0」→「AllowRoot=1」

 

httpdのzabbix.confを設定。

# vi /etc/httpd/conf.d/zabbix.conf

  # php_value date.timezone Europe/Riga

  ↓

  php_value date.timezone Asia/Tokyo

 

httpdの起動と自動起動設定。

# /etc/init.d/httpd start

# chkconfig httpd on

 

zabbixの起動と自動起動設定。

# /etc/init.d/zabbix-server start

/etc/init.d/zabbix-agent start

# chkconfig zabbix-server on

# chkconfig zabbix-agent on

 

 

zabbixのWebUIの設定。

1. http://192.168.11.230/zabbix/setup.php にアクセス、Nextをクリック

2. 「2. Check of pre-requisites」にて全ての項目がOKなことを確認、Nextをクリック

3. 「3. Configure DB connection」にて、以下の通り設定

  Database port 「3306」

  User 「zabbix」

  Password 「zabbix」

  Test connectionでOKなことを確認、Nextをクリック

4. 「4. Zabbix server details」にて以下のとおり設定

  Host 「192.168.11.230」

  Name 「zabbix1」

 

 

zabbix WebUIのログイン画面では

Username 「Admin」

Password 「zabbix」

でログイン。

Dashboardの「Status of Zabbix」の「Zabbix server is running」が「Yes」なことを確認。

 

 

「設定」-「ホスト」の「Zabbix server」をクリック。

「ホスト名」を「zabbix1」に修正。

IPアドレス」を「192.168.11.230」に修正。

「ステータス」を「有効」に修正。

しばらくするとホスト一覧の「zabbix1」の「エージェントの状態」の「Z」が緑色に点灯する。

 

 

 

以上でとりいそぎzabbixのインストールは完了。