0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Virtualbox+CentOS6.8+Zabbix2.4でVMWare ESXiをSMART監視する

Last updated at Posted at 2017-01-06

前提

  • Virtualbox 5.1.10
  • CentOS 6.8 64bit(Virtualbox上)
  • Zabbix 2.4(VBのCentOS6.8上)
  • PHP 5.3.3
  • MySQL 5.1
  • Virtualboxはブリッジ接続設定
  • SSH接続にはTeraTermを使用
  • VirtualboxへのCentOS6.8の構築はここを参照

Virtualbox上のCentOS6.8にzabbix-serverを構築する

zabbixパッケージ群をインストール

$ sudo su -

zabbix のリポジトリ取得
# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm

パッケージ群をインストール
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese zabbix-agent

インストール出来たか確認
# zabbix_server -V
Zabbix server v2.4.8 (revision 59539) (20 April 2016)
Compilation time: May  4 2016 01:32:12

zabbixに使用するDBをインストール

# yum -y install mysql-server

インストール出来たか確認
# mysqladmin version
mysqladmin  Ver 8.42 Distrib 5.1.73, for redhat-linux-gnu on x86_64
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.1.73
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 16 days 21 min 36 sec

Threads: 21  Questions: 1262225  Slow queries: 15  Opens: 2066  Flush tables: 1  Open tables: 64  Queries per second avg: 0.912

MySQLの設定

データベースとユーザの作成をする
# mysql -uroot

zabbixというデータベースを作成
mysql> create database zabbix character set utf8 collate utf8_bin;

zabbix用のユーザを作成
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '設定したいパスワード';
mysql> exit
 
スキーマの登録(初期データのインポート)
# cd /usr/share/doc/zabbix-server-mysql-2.4.8/create/
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

設定その他もろもろ

zabbixサーバの設定
vi /etc/zabbix/zabbix_server.conf

以下の箇所を修正(必ず頭の#を取る)
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<DBユーザ作成時に設定したパスワード>

Apacheの設定
vi /etc/httpd/conf.d/zabbix.conf

# php_value date.timezone Europe/Riga
↓
php_value date.timezone Asia/Tokyo

各サービス自動起動設定

# service mysqld start
# chkconfig mysqld on
 
# service zabbix-server start
# chkconfig zabbix-server on
 
# service httpd start
# chkconfig httpd on

ブラウザでzabbixサーバにアクセスしてみよう

これをブラウザに入力→ http://"CentOS6.8のIPアドレス"/zabbix/

ブラウザで見れることが確認できたら各種設定どおりに設定し、進む。
ログインの初期情報は

Username: Admin
Password: zabbix

ログインしたら画面右上の「プロファイル」から「パスワードの変更」をクリック。
パスワードを変更したら[更新]を押す。

監視対象のESXiのデバイス名を確認する

まずVMWareESXiにSSHでログイン.
VMWareESXiへSSH接続方法

  1. TeraTermでVMWareESXiのIPアドレスにSSHで接続する。
  2. ESXiのユーザ名を入力して"チャレンジレスポンス認証を使う(キーボードインタラクティブ)"にチェックを入れて[OK]
  3. パスワードを入力して[OK]
ログインしたら以下のコマンドでデバイス名を確認
esxcli storage core device list
~出力省略~

以下のコマンドを実行でSMART情報を取得する
esxcli storage core device smart get -d デバイス名

Parameter                     Value  Threshold  Worst
----------------------------  -----  ---------  -----
Health Status                 OK     N/A        N/A
Media Wearout Indicator       N/A    N/A        N/A
Write Error Count             N/A    N/A        N/A
Read Error Count              200    51         200
Power-on Hours                40     0          40
Power Cycle Count             98     0          98
Reallocated Sector Count      200    140        200
Raw Read Error Rate           200    51         200
Drive Temperature             112    0          77
Driver Rated Max Temperature  65     45         30
Write Sectors TOT Count       200    0          200
Read Sectors TOT Count        200    51         200
Initial Bad Block Count       N/A    N/A        N/A
こんなかんじ

ブラウザ上のzabbixでESXiのSMART自動取得を設定する

  1. [設定]→[ホスト]→zabbix_serverを選択する。
  2. zabbix-serverの[アイテム]をクリック。
  3. アイテム一覧が出たら画面右上の[アイテムの作成]をクリック。
  4. 以下のように設定。出来たら[追加]をクリック。(載ってない部分はデフォルト/空白でOK)
名前 例:VMESXi
タイプ SSHエージェント
キー ssh.run[ディスク名,ESXiのIPアドレス,22]
ホストインターフェース 127.0.0.1 : 10050
認証方式 パスワード
ユーザー名 ESXiのユーザ名
パスワード ESXiのパスワード
実行するスクリプト ssh ESXiのユーザ名@ IPアドレス "esxcli storage core device smart get -d デバイス名"
データ型 テキスト
更新間隔(秒) 1200(ご自由に)
アプリケーションの作成 SMART

これですべての設定が終了です。

0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?