zabbixインストールでエージェントを監視対象サーバへ設定
エージェントの設定
サーバにエージェントをいれても仕方ないので別サーバを用意して設定
環境
zabbixサーバ
CentOS6.5 64bit
MySQL5.6
PHP5.5
Nginx
IP:192.168.51.129
zabbixエージェント用のサーバ
CentOS6.5 64bit
IP:192.168.51.130
設定(エージェント用サーバ設定)
zabbixのユーザーを作成
[root@localhost ~]# groupadd zabbix [root@localhost ~]# useradd -g zabbix zabbix [root@localhost ~]# cat /etc/passwd | grep zabbix zabbix:x:502:502::/home/zabbix:/bin/bash [root@localhost ~]#
ダウンロードしたソースファイルを配置
[root@localhost ~]# ll /tmp/zabbix-2.2.2.tar.gz -rw-r--r-- 1 root root 14595839 3月 17 20:08 2014 /tmp/zabbix-2.2.2.tar.gz [root@localhost ~]#
解凍
[root@localhost ~]# cd /tmp/ [root@localhost tmp]# tar zxf zabbix-2.2.2.tar.gz [root@localhost tmp]#
コンパイル&インストール
[root@localhost ~]# cd /tmp/ [root@localhost tmp]# tar zxf zabbix-2.2.2.tar.gz [root@localhost tmp]# # コンパイル [root@localhost ~]# cd /tmp/ [root@localhost tmp]# tar zxf zabbix-2.2.2.tar.gz [root@localhost tmp]# cd zabbix-2.2.2 [root@localhost zabbix-2.2.2]# [root@localhost zabbix-2.2.2]# ./configure \ --prefix=/usr/share/zabbix \ --enable-agent [root@localhost zabbix-2.2.2]# make install [root@localhost zabbix-2.2.2]# ll /usr/share/zabbix/ 合計 20 drwxr-xr-x 2 root root 4096 3月 22 10:40 2014 bin drwxr-xr-x 4 root root 4096 3月 22 10:40 2014 etc drwxr-xr-x 2 root root 4096 3月 22 10:40 2014 lib drwxr-xr-x 2 root root 4096 3月 22 10:40 2014 sbin drwxr-xr-x 3 root root 4096 3月 22 10:40 2014 share [root@localhost zabbix-2.2.2]#
設定ファイルを編集
[root@localhost etc]# mkdir -p /var/log/zabbix [root@localhost etc]# chown -R zabbix.zabbix /var/log/zabbix/ [root@localhost etc]# vim /usr/share/zabbix/etc/zabbix_agentd.conf ---- LogFile=/var/log/zabbix/zabbix_agentd.log Server=192.168.51.129 ServerActive=192.168.51.129 Hostname=zabbix_agent01 ----
起動スクリプトの設定
[root@localhost zabbix-2.2.2]# cp -a /tmp/zabbix-2.2.2/misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/. [root@localhost zabbix-2.2.2]# vim /etc/init.d/zabbix_agentd ---- ZABBIX_BIN="/usr/share/zabbix/sbin/zabbix_agentd" ----
起動
[root@localhost zabbix-2.2.2]# service zabbix_agentd start Zabbix Agent を起動中: [ OK ] [root@localhost zabbix-2.2.2]#
起動確認
[root@localhost zabbix-2.2.2]# ps aux | grep zabbix_agentd zabbix 9973 0.9 0.0 17584 732 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd zabbix 9974 0.0 0.0 17584 708 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd: collector [idle 1 sec] zabbix 9975 0.0 0.0 17584 620 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd: listener #1 [waiting for connection] zabbix 9976 0.0 0.0 17584 620 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd: listener #2 [waiting for connection] zabbix 9977 0.0 0.0 17584 620 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd: listener #3 [waiting for connection] zabbix 9978 0.1 0.0 17596 768 ? S 11:06 0:00 /usr/share/zabbix/sbin/zabbix_agentd: active checks #1 [idle 1 sec] root 9980 0.0 0.0 107520 948 pts/0 S+ 11:06 0:00 grep zabbix_agentd [root@localhost zabbix-2.2.2]#
自動起動設定
[root@localhost zabbix-2.2.2]# chkconfig zabbix_agentd on [root@localhost zabbix-2.2.2]# chkconfig --list zabbix_agentd zabbix_agentd 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost zabbix-2.2.2]#
zabbixサーバの設定
ホスト設定
「設定」>「ホスト」で画面を移動
「ホストの作成」をクリック
追加されたことを確認
テンプレート設定
「設定」>「テンプレート」で画面遷移
「テンプレートの作成」をクリック
テンプレートが作成されたことを確認
アイテム
「アイテム」をクリック
「アイテムの作成」をクリック
作成されたことを確認
監視確認
「監視データ」>「最新データ」を指定
グループを「Linux servers」へ切り替え表示切り替え
「CPU usage」の「グラフ」をクリック
参考
http://www.sraoss.co.jp/technology/zabbix/introduction/01-firststep.php
http://d.hatena.ne.jp/kt_hiro/20111112/1321033380
まとめ
サーバもエージェントも最初は設定が面倒な感じ…。インストールがうまくいけばあとはある程度簡単に出来そう。
自宅の環境では重いので外部にサーバを借りてやってみよう。
とりあえず、検討する
Zabbix統合監視「実践」入門 ~障害通知、傾向分析、可視化による省力運用 (Software Design plusシリーズ)
- 作者: 寺島広大
- 出版社/メーカー: 技術評論社
- 発売日: 2010/04/08
- メディア: 大型本
- 購入: 1人 クリック: 76回
- この商品を含むブログ (12件) を見る
Zabbix統合監視徹底活用 ~複雑化・大規模化するインフラの一元管理 (Software Design plus)
- 作者: TIS株式会社,池田大輔
- 出版社/メーカー: 技術評論社
- 発売日: 2014/02/07
- メディア: 大型本
- この商品を含むブログ (2件) を見る