OMDを使った監視サーバ構築(前編)
OMD(Open Monitoring Distribution)]を使って監視サーバを構築してみます。
Open Monitoring Distribution - Wiki - OMD
OMDってなに?
こちらは公式サイトからの引用です。
Welcome to OMD - the Open Monitoring Distribution. OMD implements a completely new concept of how to install, maintain and update a monitoring system built on Nagios.
OMD avoids the tedious work of manually compiling and integrating Nagios addons while at the same time avoiding the problems of pre-packaged installations coming with your Linux distribution, which are most times outdated and provide no regular updates.
Nagiosとそのアドオンを用いた監視システムを構築するためのディストリビューションで、2012/07現在、下記のソフトウェアで構成されます。
- nagios
- nagios-plugins
- nsca
- check_nrpe
- Icinga
- Shinken
- nagvis
- pnp4nagios
- rrdtool/rrdcached
- Check_MK
- MK Livestatus
- Multisite
- dokuwiki
- Thruk
- Mod-Gearman
- check_logfiles
- check_oracle_health
- check_mysql_health
- jmx4perl
- check_webinject
- check_multi
OMDを使うと面倒な設定をせずに監視サーバの初期構築ができて便利です。
ソフトウェアのバージョンアップもOMDに任せることができます。
インストール方法
Debian, Ubuntu, CentOS, RedHat, Suseではレポジトリからインストールすることが可能です。
OMD Repository – ConSol* Labs
CentOS 6の場合はこんな感じで実行します。
$ sudo sh -c "wget -O - http://labs.consol.de/OMD/rh60/stable/omd.repo > /etc/yum.repos.d/omd.repo" $ sudo yum install omd-0.54
サイト作成
実際に監視サーバを作成してみます。(OMDでは site とよびます)
$ sudo omd create hoge Adding /omd/sites/hoge/tmp to /etc/fstab. Creating temporary filesystem /omd/sites/hoge/tmp...OK Created new site hoge with version 0.54. The site can be started with omd start hoge. The default web UI is available at http://example.com/hoge/ The admin user for the web applications is omdadmin with password omd. Please do a su - hoge for administration of this site.
これで hoge ユーザが作成され、監視システム構築の準備が整いました。
今後は hoge ユーザにスイッチして作業を進めます。
OMDの使い方
基本的には作成したサイトのユーザにスイッチしてから omd コマンドで各種命令を実行します。
OMD[hoge]:~$ omd help Usage (called as site user): omd help Show general help omd version [SITE] Show version of OMD omd versions List installed OMD versions omd sites Show list of sites omd update Update site to other version of OMD omd start [SERVICE] Start services of one or all sites omd stop [SERVICE] Stop services of site(s) omd restart [SERVICE] Restart services of site(s) omd reload [SERVICE] Reload services of site(s) omd status [SERVICE] Show status of services of site(s) omd config ... Show and set site configuration parameters omd diff ([RELBASE]) Shows differences compared to the original version files omd umount Umount ramdisk volumes of site(s) General Options: -V <version> set specific version, useful in combination with update/create omd COMMAND -h, --help show available options of COMMAND
- 特定のユーザにスイッチした場合はそのサイトだけ影響を受けます
- rootユーザの場合、すべてのサイトのサービスをいっぺんに操作できます
- ただし、すべてのコマンドが実行できるわけではありません(たとえばconfig, diffなどは不可)
OMDの設定変更
$ omd config
を実行することでOMD自体の設定ができます。
なお、設定を変更する際にいったんそのサイトのサービスが止まるので気をつけてください。
Basic
- AUTOSTART
ONにするとOMDが起動する時にそのサイトも起動させることができます。
- CORE
利用する監視システムを指定する。
Nagios, Icinga, Shinkenからお好みで。
- CRONTAB
サイト固有のcrontabを有効にする場合ONにする。
- TMPFS
テンポラリファイルのためにラムディスクを利用する場合ONにする。
Web GUI
- APACHE_MODE
Apacheをサイトごとに個別に起動させる、システムのApacheを利用する、Webサーバを利用しないの3つから選択する。
- DEFAULT_GUI
サイトのWebページにアクセスした際にデフォルトで表示させるGUIを選択する。
Nagios, Icingaなどなどお好みで。
- DOKUWIKI_AUTH
ユーザ管理にDokuwikiを使う場合にONにする。
Addons
MySQLを使うアドオンで、サイトごとに別々のMySQLを起動させたい場合ONにする。
- NAGVIS_URLS
NagVisとリンクさせるGUIを選択する。
- PNP4NAGIOS
パフォーマンスデータの処理にPNP4Nagiosを利用する場合ONにする。
PNP4Nagiosは取得したデータをもとにグラフを作ってくれます。
Distributed Monitoring
- LIVESTATUS_TCP
- MOD_GEARMAN
- NSCA
それぞれ利用したい場合はONにする。
これで監視サーバの構築が終わりました。
次回は実際に設定追加等をやってみます。