LoginSignup
1
1

More than 5 years have passed since last update.

HyClops for Zabbix のインストール

Last updated at Posted at 2014-06-20

公式URL
http://tech-sketch.github.io/hyclops/jp/

リポジトリの追加
sudo su -
curl http://download.opensuse.org/repositories/home:/fengshuo:/zeromq/CentOS_CentOS-6/home:fengshuo:zeromq.repo > /etc/yum.repos.d/zeromq.repo

関連パッケージの追加
su ec2-user
sudo yum install gcc gcc-c++ zeromq zeromq-devel python-devel python-setuptools ipmitool

Pipのインストール
sudo wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

Pythonモジュールのインストール
sudo pip install apache-libcloud==0.13.2 zabbix-api pyzmq psphere python-daemon==1.6 configobj
sudo pip install ordereddict argparse
sudo pip install boto

HyClopsのインストール
sudo wget https://github.com/tech-sketch/hyclops/archive/0.2.0.tar.gz
sudo tar zxvf 0.2.0.tar.gz
sudo su -
cd /root
cd hyclops-0.2.0
python setup.py install

サービスの自動起動設定
#in case of SysV init
cp -a ./misc/init.d/redhat/hyclops /etc/init.d/

#in case of Upstart
cp -a ./misc/init.d/ubuntu/hyclops.conf /etc/init/

外部スクリプトのコピー
cp -a ./misc/externalscripts/* /usr/lib/zabbix/externalscripts

権限設定
chown zabbix:zabbix /usr/lib/zabbix/externalscripts
chmod u+x /usr/lib/zabbix/externalscripts/*

HyClopsの設定
vi /opt/hyclops/hyclops.conf

サーバ起動設定
chkconfig hyclops on
service hyclops start

値のマッピング
名前:Script Return Code
0⇒uccess
1⇒failure

名前:Libcloud Node State
0⇒running
1⇒rebooting
2⇒terminated
3⇒pending
4⇒stopped

Zabbixに自動登録するための設定
cd /root/hyclops-0.2.0/misc/import_data
vi globalmacros.xml

⇒Zabbix サーバとHyClopsサーバが一緒の場合は不要

Zabbixのダッシュボード画面関連ファイルの置換
sudo su -
cd /root/hyclops-0.2.0
python setup.py replace -d /usr/share/zabbix --zabbix-version=2.2

Zabbix templates,scripts,globalmacroデータのインポート
cd /root/hyclops-0.2.0
python setup.py import -f <zabbix frontend url> -u <zabbix username> -p <zabbix password>
python setup.py import -f http://localhost/zabbix -u Admin -p zabbix

Cronの設定

crontab -u hyclops -e

居なくなった仮想サーバに対する処理の記述を行う。(例 5分間隔)

crontab
*/5 * * * * /opt/hyclops/cron_scripts/delete_not_exist_hosts.py

削除時間を設定する場合 -d 日にち(例 10日後に削除を行う場合)
*/5 * * * * /opt/hyclops/cron_scripts/delete_not_exist_hosts.py -d 10

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1