CloudStack Hyderabad Meetup: Using CloudStack to build IaaS clouds
Zabbixによる CloudStack環境の 統合監視
-
Upload
truongngoc -
Category
Documents
-
view
292 -
download
5
Transcript of Zabbixによる CloudStack環境の 統合監視
![Page 1: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/1.jpg)
ICTの力を、お客様のビジネスの推進力に。
戦略マーケティング部
マーケティング1室
三島 匡史
2013年7月19日
Zabbixによる CloudStack環境の 統合監視
1
![Page 2: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/2.jpg)
CloudStack環境における運用課題
2 All Rights Reserved, Uniadex Ltd. 2013
CloudStackのデータ収集 作成されたインスタンスの監視自動化
CloudStackの監視機能では 継続的なデータ収集ができない 運用の基礎データとして 分析したい
CloudStack上で作られる たくさんのインスタンス (仮想マシン)の監視を 個別に設定するのは非常に 手間がかかってしまう。 インスタンスの起動と自動に 監視を始めてほしい
![Page 3: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/3.jpg)
アジェンダ
自己紹介
CloudStackのご紹介
ZabbixによるCloudStack監視自動化
デモ
3 All Rights Reserved, Uniadex Ltd. 2013
![Page 4: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/4.jpg)
自己紹介
三島匡史 (みしま ただし)
基盤構築サービスのマーケティング担当
OSSを使ったシステム開発教育、Linuxシステム構築、 運用サービスなどの企画、設計、提案などを いままで行ってきました
CloudStack、Zabbixなどを活用した、 システム基盤構築サービスをご紹介しております
4 All Rights Reserved, Uniadex Ltd. 2013
![Page 5: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/5.jpg)
会社概要
5 All Rights Reserved, Uniadex Ltd. 2013
日本ユニシスグループの総合ICTサポートサービス企業 ICT基盤のプロフェッショナル集団
お客さまが最適なICT環境を創る
お客さまがICTを効果的に使う
お客さまが自身のICTインフラを安全/確実に守る
という3つの局面に応じた支援サービスを提供
社 名: ユニアデックス株式会社
住 所: 東京都江東区豊洲1-1-1
設 立: 1997年3月4日
資本金: 7億5,000万円
株 主: 日本ユニシス株式会社(100%)
従業員: 2,703名(2013年4月現在)
売上高: 970億円(2013年3月期実績)
関連企業: エス・アンド・アイ株式会社(2008年5月 連結子会社化)
![Page 6: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/6.jpg)
ユニアデックスの特徴
6 All Rights Reserved, Uniadex Ltd. 2013
24時間365日のサービス体制 ハードウエア、ソフトウエア、ネットワークに対応した3つのサポートを統合したマネージド・サービスセンターと、 国内約180ヵ所の拠点が連携するサポート体制
高品質なサービス 全国 約2200名の技術者が、ISO9001、CMMI、ISMSなどの認証、ITIL準拠など多くの国際規格に裏付けられた品質でサービスを提供します
マルチベンダー/ワンストップ 大手有力ベンダーとの強力なパートナーシップのもと、 ベンダーニュートラルな立場で、お客様にとって最適なハードウエア/ソフトウエアを選定/調達。 設計/導入/保守までをワンストップでご提供します
![Page 7: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/7.jpg)
マルチベンダー、マルチレイヤー、ワンストップ
7 All Rights Reserved, Uniadex Ltd. 2013
パブリッククラウド
移行 PlateSpin
仮想化ハイパーバイザー VMware, XenServer, KVM, Hyper-V
バックアップ Netvault Backup
監視 Zabbix
サーバー IBM,Dell,HP
Cisco Systems
ストレージ NetApp,EMC,
Dell,HP,IBM,日立
ネットワーク Citrix NetScaler, Cisco Nexus, F5
BIG-IP,Juniper SRX
Citrix CloudPlatform
認証 LDAPManager, IceWall SSO
資産管理 Admi-21
運用管理 IP&A
テンプレート作成 UshareSoft UForge
![Page 8: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/8.jpg)
CloudStackのご紹介
8 All Rights Reserved, Uniadex Ltd. 2013
![Page 9: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/9.jpg)
CloudStack概要
CloudStackとは? クラウド基盤ソフトウェア
Amazon EC2ライクな IaaS環境を構築可能
プライベートクラウド、パブリッククラウドにおいて実績多数
経緯 2010年5月 VMOps, IncからCloud.comへ社名変更
2011年7月 Citrix Systems, IncがCloud.comを買収
2012年4月 CitrixがApache Foundation Projectに寄贈を発表
9
All Rights Reserved, Uniadex Ltd. 2013
OSS版 CITRIX版
![Page 10: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/10.jpg)
ワールドワイドでの採用実績
国内外で実績多数
120社以上のIaaS/プライベートクラウドで採用
事実上のデファクトスタンダード
10 All Rights Reserved, Uniadex Ltd. 2013
通信 / サービスプロバイダー 企業 Web / メディア 出典:Citrix Systems,Inc.
![Page 11: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/11.jpg)
CloudStackの特徴
操作性に優れたGUI
日本語インターフェース
マルチハイパーバイザーサポート
マルチテナント環境
Router/LB/FW/VPN等のNW機能が豊富
オープンなAPI
CloudStack API
Amazon EC2/S3 互換REST API
11 All Rights Reserved, Uniadex Ltd. 2013
![Page 12: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/12.jpg)
リッチなWebインターフェース
管理、操作がわかりやすい
12 All Rights Reserved, Uniadex Ltd. 2013
![Page 13: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/13.jpg)
インスタンスの作成
簡単5ステップ、わずか10分で インスタンスを追加
13 All Rights Reserved, Uniadex Ltd. 2013
![Page 14: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/14.jpg)
クラウド管理
マルチハイパーバイザー環境を 統合的に管理
14 All Rights Reserved, Uniadex Ltd. 2013
NFSサーバ 管理サーバー
VMware Xen Server KVM
CloudStack
![Page 15: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/15.jpg)
CloudStackの監視機能
ダッシュボードによりシステム全体の リソース状況の確認
インフラストラクチャ画面で各ゾーンの リソース状況の確認
継続的監視の機能は無い
15 All Rights Reserved, Uniadex Ltd. 2013
![Page 16: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/16.jpg)
Zabbixによる CloudStack環境の監視
16 All Rights Reserved, Uniadex Ltd. 2013
![Page 17: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/17.jpg)
CloudStackをうまく、早く、安く 運用するコツ
おすすめはZabbixによる継続的監視
17 All Rights Reserved, Uniadex Ltd. 2013
•評価 No.1 のOSS統合監視ソフトウェア •商用製品に劣らない、充実した機能 •大規模運用にも対応可能な拡張性の高さ
![Page 18: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/18.jpg)
ZabbixによるCloudStack環境の統合監視
18 All Rights Reserved, Uniadex Ltd. 2013
物理 サーバー
ハイパーバイザー
ネットワーク 機器
物理 ストレージ
OS
ミドルウェア
アプリケーション
仮想 サーバ
仮想 ネットワーク
仮想 ストレージ
ZABBIX
ハードウェア監視 (SNMPトラップ) リソース監視 (SNMPポーリング)
物理ハードウェア/ソフトウェア/仮想サーバのマルチレイヤーを統合監視
プロセス監視、ログ監視
仮想リソースの状態、サービス監視
仮想サーバーの稼働状況 物理リソースの状態 I/O動作でのハードウェアエラー検出
![Page 19: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/19.jpg)
監視設定の流れ
CloudStack環境監視
1. CloudStack APIからデータ取得
2. 対象データの抽出
3. Zabbixから実行しグラフ化
インスタンス(仮想マシン)の自動監視
1. エージェントを組みこんだテンプレートの準備
2. インスタンスを作成
3. エージェントが自動登録し、監視開始
19 All Rights Reserved, Uniadex Ltd. 2013
![Page 20: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/20.jpg)
ZabbixによるCloudStack環境の監視
CloudStack APIからデータを取得し、 Zabbixでトレンドをグラフ化
20 All Rights Reserved, Uniadex Ltd. 2013
①APIよりデータを取得
②データを 変換し、値を取得
③値をDBに出力
CloudStack Zabbix Server
Web UI グラフ確認
![Page 21: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/21.jpg)
CloudStackの全体監視
REST APIを使った監視が可能
HTTPアクセスでデータ取得し、グラフ化
21 All Rights Reserved, Uniadex Ltd. 2013
![Page 22: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/22.jpg)
CloudStackデータの取得
今回は認証が無い簡易APIを使用
commandで取得したいデータを指定
今回は全体のCPUデータを取得したいので listCapacity を指定
accountはlistCapacityを取得するため管理者を指定
データ形式はjsonを指定
Linuxのcurlコマンドでデータ取得 22 All Rights Reserved, Uniadex Ltd. 2013
$cloudstack_url = "http://172.16.183.2:8096/api ?command=listCapacity &account=admin &response=json"; $cmd = 'curl "'.$cloudstack_url.'" 2> /dev/null'; exec ($cmd,$cs_data_json);
![Page 23: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/23.jpg)
データの出力
json形式のデータを連想配列に変換
目的のデータのtypeを指定する
今回はCPUなので typeは「 CAPACITY_TYPE_CPU 」
Zabbixは実行したスクリプトの標準出力を取り込む
echo で値を出力
23 All Rights Reserved, Uniadex Ltd. 2013
$cs_data = json_decode ($cs_data_json[0],true); foreach($cs_data["listcapacityresponse"]["capacity"] as $data){ if( $data["type"] == CAPACITY_TYPE_CPU){ $res=$data["percentused"]; } } echo $res;
![Page 24: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/24.jpg)
Zabbixの監視設定
監視のアイテムとして追加
タイプ → 外部チェック
キー → 監視を実行するスクリプト
データ型 → 浮動小数
24 All Rights Reserved, Uniadex Ltd. 2013
![Page 25: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/25.jpg)
(参考)CloudStack API
http://download.cloud.com/releases/3.0.3/api_3.0.3/TOC_Root_Admin.html
25 All Rights Reserved, Uniadex Ltd. 2013
![Page 26: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/26.jpg)
(参考)取得したlistCapacityのデータ構造
26 All Rights Reserved, Uniadex Ltd. 2013
array(1) { ["listcapacityresponse"]=> array(2) { ["count"]=> int(9) ["capacity"]=> array(9) { [0]=> array(6) { ["type"]=> int(0) ["zoneid"]=> string(36) "c26de38e-1b84-422c-b82e-98c2db42e9c7" ["zonename"]=> string(11) "Cloud-Zone1" ["capacityused"]=> int(15904800768) ["capacitytotal"]=> int(51407183872) ["percentused"]=> string(5) "30.94" }
capacityの中に各typeのデータが格納されている
typeの値で取得したい データを選択する
Zoneが複数ある場合は Zoneの指定も必要
取得対象はpercentusedの値
![Page 27: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/27.jpg)
(参考)listCapacityのtype
http://download.cloud.com/releases/3.0.3/api_3.0.3/root_admin/listCapacity.html
27 All Rights Reserved, Uniadex Ltd. 2013
CAPACITY_TYPE_MEMORY 0
CAPACITY_TYPE_CPU 1
CAPACITY_TYPE_STORAGE 2
CAPACITY_TYPE_STORAGE_ALLOCATED 3
CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP 4
CAPACITY_TYPE_PRIVATE_IP 5
CAPACITY_TYPE_SECONDARY_STORAGE 6
CAPACITY_TYPE_VLAN 7
CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP 8
CAPACITY_TYPE_LOCAL_STORAGE 9
![Page 28: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/28.jpg)
デモ
CloudStack環境の監視
インスタンスの監視を自動化
28 All Rights Reserved, Uniadex Ltd. 2013
![Page 29: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/29.jpg)
インスタンスの監視を自動化
テンプレートにZabbixエージェントを組み込み Zabbixサーバーの情報をセット
インスタンス作成時に自動でインスタンスの情報を
取得し、Zabbixサーバーに送信
29 All Rights Reserved, Uniadex Ltd. 2013
CloudStack
テンプレートから インスタンス作成
XenServer Zabbix Server
監視に必要な情報を サーバに自動送信
テンプレートに エージェントを 組み込む
![Page 30: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/30.jpg)
Zabbix Serverへの登録のしくみ
ZabbixのAPIを使用
エージェントを起動後、Serverに向けて登録スクリプトを実行
事前に用意したテンプレートを使い、監視項目も自動設定
30 All Rights Reserved, Uniadex Ltd. 2013
{ “jsonrpc”:”2.0”, “method”:”host.create”, “id”:3, “param”:{ “host”:”Linux001”, “ip”:10.32.147.246”, “port”: 10050, “useip”: 1, “groups”:[ { “groupid”: 4} ], "templates":[ { "templateid":10001 } ] }
Server=10.32.155.29 Hostname=Linux001
Zabbix_agentd.conf json形式のコマンドデータ
同じHost名
サーバの IPアドレス
![Page 31: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/31.jpg)
CloudStackテンプレートの作成
初期起動時に自動実行するファイルを導入
1. /etc/rc.local
2. /root/update_Zabbix_conf.sh
3. /root/zabbixserver_request.php
4. root/ZabbixApiAbstract.class.php
/etc/rc.local
起動スクリプトとして、インスタンス起動時に 動作するスクリプトを指定
/root/update_Zabbix_conf.shを実行する
31 All Rights Reserved, Uniadex Ltd. 2013
![Page 32: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/32.jpg)
送信準備
/root/update_Zabbix_conf.sh
設定ファイルの修正
IPアドレスとホスト名を引数として登録スクリプトを実行
32 All Rights Reserved, Uniadex Ltd. 2013
filename='/etc/zabbix/zabbix_agentd.conf' hostname=`hostname` entryupdate="Hostname=$hostname" sed -i s/^Hostname.*/$entryupdate/g $filename
ipaddress=`/sbin/ifconfig | grep 'inet addr' | grep -v 127.0.0.1 | awk '{print $2;}' | cut -d: -f2` /usr/bin/php /root/zabbixserver_request.php $hostname $ipaddress
![Page 33: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/33.jpg)
登録スクリプトを実行
/root/zabbixserver_request.php
Zabbix APIを使ってオブジェクト作成
ユーザ名、パスワードが必要
33 All Rights Reserved, Uniadex Ltd. 2013
$host=$argv[1]; $ip=$argv[2]; $api = new ZabbixApi('http://172.16.183.11/zabbix/api_jsonrpc.php', 'Admin', 'zabbix');
![Page 34: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/34.jpg)
登録スクリプトを実行
/root/zabbixserver_request.php
Zabbix APIを使ってホスト情報を送信
34 All Rights Reserved, Uniadex Ltd. 2013
$res = $api->hostcreate( array( 'host' => $host, 'name' => $host, 'ip' => $ip, 'useip' => 1, 'dns' => "", 'groups' => array(array( 'groupid' => 4 )), 'templates' => array( 'templateid' => 10001 ) ) );
![Page 35: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/35.jpg)
PHPのZabbixAPI用ライブラリ
/root/ZabbixApiAbstract.class.php
PhpZabbixApiライブラリに含まれる
Zabbix APIを実行するためのPHPライブラリ
http://zabbixapi.confirm.ch/
35 All Rights Reserved, Uniadex Ltd. 2013
![Page 36: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/36.jpg)
CloudStackテンプレートの作成
設定完了したインスタンスを停止する
該当インスタンスのボリュームメニューから 「テンプレートの作成」を押下
テンプレートの名前、説明を入力し、作成
36 All Rights Reserved, Uniadex Ltd. 2013
![Page 37: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/37.jpg)
(参考)Zabbix API
Zabbix API ドキュメント
https://www.zabbix.com/documentation/1.8/api
https://www.zabbix.com/documentation/2.0/manual/appendix/api/api
37 All Rights Reserved, Uniadex Ltd. 2013
{ “jsonrpc”:”2.0”, “method”:”host.create”, “id”:3, “param”:{ “host”:”Linux001”, “ip”:10.32.147.246”, “port”: 10050, “useip”: 1, “groups”:[ { “groupid”: 4} ], "templates":[ { "templateid":10001 } ] }
実行するコマンド クラス「host」の中のcreateを実行
paramに情報をセットする
![Page 38: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/38.jpg)
(参考)Zabbix APIからPhpZabbixApiへの変換
①method名は「.」を抜いた形にする
②paramの「:」を「=>」に変換
③ネストされたものは配列で指定
38 All Rights Reserved, Uniadex Ltd. 2013
$res = $api->hostcreate( array( 'host' => “Linux001”, 'name' => “Linux001”, 'ip' => “10.32.147.246”, 'useip' => 1, 'dns' => "", 'groups' => array(array( 'groupid' => 4 )), 'templates' => array( 'templateid' => 10001 ) ) );
{ “jsonrpc”:”2.0”, “method”:”host.create”, “id”:3, “param”:{ “host”:”Linux001”, “ip”:10.32.147.246”, “port”: 10050, “useip”: 1, “groups”:[ { “groupid”: 4} ], "templates":[ { "templateid":10001 } ] }
①
②
③
![Page 39: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/39.jpg)
まとめ
CloudStackのリソースをモニタリングしグラフ化!!
新しい仮想サーバも素早く監視!!
監視設定が自動化できて効率化!!
39 All Rights Reserved, Uniadex Ltd. 2013
![Page 40: Zabbixによる CloudStack環境の 統合監視](https://reader034.fdocument.pub/reader034/viewer/2022042423/588ca4061a28abb4218b9bb5/html5/thumbnails/40.jpg)
40 All Rights Reserved, Uniadex Ltd. 2013
ご清聴ありがとうございました