[Nagios] Nagios BPI

Nagios Business Process Intelligence (BPI)はサービスの状態やホストの状態の依存関係を作り、グループ化して表示、監視するNagiosのAddI-Onです。複雑なサービスの依存関係や、サービス、ホストの重要度を柔軟に定義することができNagiosと組み合わせて使用することで、より複雑な監視に対応することが可能です。

本家サイトでPDFの説明書が提供されていますので、一読しておくとよいかもしれません。なお、今回はNagiosBPIで日本語を扱えるように、若干の修正を入れたいと思います。

まずは、Nagios BPIをダウンロードします。

wget http://assets.nagios.com/downloads/exchange/nagiosbpi/nagiosbpi.zip

BPIはNagiosのWebUIのディレクトリに展開することにします。

cd /usr/share/nagios
unzip nagiosbpi.zip

パーミッションの変更スクリプトが付属しているので、スクリプトに実行権限をつけて、実行します。

cd nagiosbpi
chmod +x set_bpi_perms.sh
./set_bpi_perms.sh

次に、設定ファイルを変更します。パスを環境に合わせて記載してください。

vi constants.conf
#STATUSFILE=/usr/local/nagios/var/status.dat
STATUSFILE=/var/nagios/status.dat
#OBJECTSFILE=/usr/local/nagios/var/objects.cache
OBJECTSFILE=/var/nagios/objects.cache
#CONFIGFILE=/usr/local/nagiosxi/html/includes/components/nagiosbpi/bpi.conf
CONFIGFILE=/usr/share/nagios/nagiosbpi/bpi.conf
#CONFIGBACKUP=/usr/local/nagiosxi/html/includes/components/nagiosbpi/tmp/bpi.conf.backup
CONFIGBACKUP=/usr/share/nagios/nagiosbpi/tmp/bpi.conf.backup

ここで、ブラウザを起動して動作確認を行います。サンプルがいくつか登録されていますので、参考にしてください。たとえば、冗長化されたWebサーバ10台のうち3台以上が停止したら、警告などという設定も可能です。

http://<nagios server ip>/nagios/nagiosbpi

さて、このWebUIは見た目にも、サービスを把握しやすく便利なのですが、残念なことに日本語に対応していません。しかし、若干の修正を加えることで、Display Nameとについては、日本語を扱うことが可能です。

下記のファイルを編集し、htmlentitiesの3番目の引数をUTF-8と指定してください。

vi /usr/share/nagios/nagiosbpi/functions/process_post.php
 65 $title = htmlentities(trim($array['groupTitle']),ENT_COMPAT | ENT_HTML401,"UTF-8");
 66 $display = htmlentities(trim($array['groupDisplay']),ENT_COMPAT | ENT_HTML401,"UTF-8");
 69 $desc = (isset($array['groupDesc']) ? htmlentities(trim($array['groupDesc']),ENT_COMPAT | ENT_HTML401,"UTF-8") : '');

これで、Display Nameとについては、日本語も扱うことができます。

ここまでの設定で、Nagios BPI のインタフェースの設定は、完了しました。これだけだと、Nagios BPIでのステータスがNagiosからは見えてきませんので、チェック用のプラグインの設定を行います。

mv check_bpi.php /usr/lib64/nagios/plugins/
vi /usr/lib64/nagios/plugins/check_bpi.php
$file = '/usr/share/nagios/nagiosbpi/api_tool.php';

では、ちょっと試験をして見ます。サンプルとして登録されている、LocalServicesはGroupIDが、「localServices1」となっていますので、引数にこのGroupIDを指定します。

/usr/lib64/nagios/plugins/org/check_bpi.php localServices1
Group state is: Ok;  0 Child Problems

と、「localServices1」が正常であることを確認することができました。

あとは、Nagiosのコマンドコンフィグとサービスコンフィグ、ホストコンフィグを登録sれば、監視を行うことができます。マニュアルに、ホストコンフィグではダミーのIPを指定するとよいとのことです。

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] NagVis インストール

NagVisはNagios上のホストやサービスをマップとして表示するAdd-Onです。Nagiosだけでは把握しづらいホスト間の関係やサービスのステータスをマップ上に表示することで、わかりやすく把握することができます。

動作確認:CentOS 6.2 + Nagios 3.2.3 + MK Livestatus 1.1.12p7
ライセンス:GPL v2

準備

pnp-mbstringとgraphvisをインストールします。graphvizはNagiosの親子関係に基づく、マップを自動表示します。

yum install php-mbstring
yum install graphviz

ダウンロードと展開

wget http://downloads.sourceforge.net/project/nagvis/NagVis%201.6/nagvis-1.6.5.tar.gz
cd /usr/local/src
tar xvzf nagvis-1.6.5.tar.gz
cd nagvis-1.6.5/

インストール

それではインストールします。インストールスクリプトが用意されていますので、コレを実行します。

./install.sh
 +------------------------------------------------------------------------------+
 | Welcome to NagVis Installer 1.6.5 |
 +------------------------------------------------------------------------------+
 | This script is built to facilitate the NagVis installation and update 
 | procedure for you. The installer has been tested on the following systems: 
 | - Debian Etch, Hardy (4.0, 5.0) 
 | - Ubuntu Hardy, Intrepid, Jaunty, Karmic, Lucid (8.04 to 10.04) 
 | - SuSE Linux Enterprise Server 10 and 11
 | Similar distributions to the ones mentioned above should work as well. 
 | That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE 
 | If you experience any problems using these or other distributions, please
 | report that to the NagVis team.
 +------------------------------------------------------------------------------+
 | Do you want to proceed? [y]: y <enter>
 +------------------------------------------------------------------------------+
 | Starting installation of NagVis 1.6.5
 +------------------------------------------------------------------------------+
 | OS : CentOS release 6.2 (Final)
 +--- Checking for tools -------------------------------------------------------+
 | Using packet manager /bin/rpm found 
 +--- Checking paths -----------------------------------------------------------+
 | Please enter the path to the nagios base directory [/usr]:<enter>
 | nagios path /usr found
 | Please enter the path to NagVis base [/usr/nagvis]:<enter>
 +--- Checking prerequisites ---------------------------------------------------+
 | PHP 5.3 found
 | PHP Module: gd php found 
 | PHP Module: mbstring found
 | PHP Module: gettext compiled_in found 
 | PHP Module: session compiled_in found 
 | PHP Module: xml compiled_in found 
 | PHP Module: pdo php found 
 | Apache mod_php found 
 | Checking Backends. (Available: mklivestatus,ndo2db,ido2db,merlinmy) 
 | Do you want to use backend mklivestatus? [y]:<enter>
 | Do you want to use backend ndo2db? [n]:<enter>
 | Do you want to use backend ido2db? [n]:<enter>
 | Do you want to use backend merlinmy? [n]:<enter>
 | Livestatus Socket (/usr/var/rw/live) MISSING
 | Valid socket formats are: tcp:127.0.0.1:7668 or unix:/path/to/live
# MK Livestatusを、TCP経由でアクセスする場合は、「tcp:127.0.0.1:6557」を入力 # UNIXソケット経由でアクセスする場合は、「unix:/var/nagios/rw/live」を入力 | Please enter your MKLivestatus socket: tcp:127.0.0.1:6557<enter>
 | PHP Module: sockets compiled_in found
 | Graphviz 2.26 found
 | Graphviz Module dot 2.26.0 found
 | Graphviz Module neato 2.26.0 found
 | Graphviz Module twopi 2.26.0 found
 | Graphviz Module circo 2.26.0 found
 | Graphviz Module fdp 2.26.0 found
 | SQLite 3.6 found
 +--- Trying to detect Apache settings -----------------------------------------+
 | Please enter the web path to NagVis [/nagvis]:<enter>
 | Please enter the name of the web-server user [apache]:<enter>
 | Please enter the name of the web-server group [apache]:<enter>
 | create Apache config file [y]:<enter>
 +--- Checking for existing NagVis ---------------------------------------------+
 +------------------------------------------------------------------------------+
 | Summary |
 +------------------------------------------------------------------------------+
 | NagVis home will be: /usr/nagvis 
 | Owner of NagVis files will be: apache 
 | Group of NagVis files will be: apache 
 | Path to Apache config dir is: /etc/httpd/conf.d 
 | Apache config will be created: yes 
 | Installation mode: install
 | Do you really want to continue? [y]:<enter>
 +------------------------------------------------------------------------------+
 | Starting installation 
 +------------------------------------------------------------------------------+
 | Creating directory /usr/nagvis... done 
 | Creating directory /usr/nagvis/var... done 
 | Creating directory /usr/nagvis/var/tmpl/cache... done 
 | Creating directory /usr/nagvis/var/tmpl/compile... done 
 | Creating directory /usr/nagvis/share/var... done 
 | Copying files to /usr/nagvis... done 
 | Creating directory /usr/nagvis/etc/profiles... done 
 | Creating main configuration file... done 
 | adding base="/usr/nagvis" done 
 | Adding MKLivestatus Backend... done 
 | Adding webserver group to file_group... done 
 | Creating web configuration file... done 
 | Setting permissions for web configuration file... done 
 +--- Setting permissions... ---------------------------------------------------+
 | /usr/nagvis/etc/nagvis.ini.php-sample done 
 | /usr/nagvis/etc done 
 | /usr/nagvis/etc/maps done 
 | /usr/nagvis/etc/maps/* done 
 | /usr/nagvis/etc/automaps done 
 | /usr/nagvis/etc/automaps/* done 
 | /usr/nagvis/etc/profiles done 
 | /usr/nagvis/share/userfiles/images/maps done 
 | /usr/nagvis/share/userfiles/images/maps/* done 
 | /usr/nagvis/share/userfiles/images/shapes done 
 | /usr/nagvis/share/userfiles/images/shapes/* done 
 | /usr/nagvis/var done 
 | /usr/nagvis/var/* done 
 | /usr/nagvis/var/tmpl done 
 | /usr/nagvis/var/tmpl/cache done 
 | /usr/nagvis/var/tmpl/compile done 
 | /usr/nagvis/share/var done 
 +------------------------------------------------------------------------------+
 | Installation complete 
 | You can safely remove this source directory. 
 | For later update/upgrade you may use this command to have a faster update: | ./install.sh -n /usr -p /usr/nagvis -l "tcp:127.0.0.1:6557" -b mklivestatus -u apache -g apache -w /etc/httpd/conf.d -a y
 | What to do next? 
 | - Read the documentation 
 | - Maybe you want to edit the main configuration file? 
 | Its location is: /usr/nagvis/etc/nagvis.ini.php 
 | - Configure NagVis via browser 
 | - Initial admin credentials: 
 | Username: admin 
 | Password: admin 
 +------------------------------------------------------------------------------+

ブラウザから、「http:/<server ip address>/nagvis」にアクセスし、ユーザ「admin」、パスワード「admin」でログオンします。

メニュー「User menu」から「Manage Users」を選択します。

Nagiosのログインと同期するために、「Modify User」で「nagiosadmin」を選択し、「Selected Roles」にAdministratorsを加えます。「Modify User」ボタンをクリックします。

Apacheのコンフィグを変更します。

vi /etc/httpd/conf.d/nagvis.conf
AuthName "NagVis Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user

service httpd reload

以上でインストールは完了です。

動作確認

ブラウザから、「http:/<server ip address>/nagvis」にアクセスし、「nagiosadmin」のパスワードを入力してください。サンプルがいくつか入っているので、どのようなことができるか確かめておくといいと思います。

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] NRPE

NRPE (Nagios Remote Plugin Executor)はリモートから他のLinuxホスト上のNagiosプラグインを実行することができます。動作のイメージとしては下記のような感じになりますが、Nagios ServerとNRPE Serverの間にFirewallなどが設置されている場合にプロキシのように動作させることができる便利なAdd-onとなります。このAdd-onを使うことによって、例えばFirewallの向こう側に監視対象が複数あるような場合でもFirewallにはNagios ServerとNRPE Server間の通信tcp 5666のみを開いてやれば良いことになります。また、監視対象のネットワークに直接アクセスできないような場合にもNRPE Serverを経由させ監視することができます。

NRPE Server側の設定

NRPE Serverの設定を行います。NRPEから呼び出すNagiosのプラグインとNRPEをインストールします。rpmforgeでNRPEのrpmが公開されていますので、これを使います。

yum install nagios-plugins
yum install nagios-nrpe.x86_64

NRPEの設定ファイルを編集します。このファイルの中で監視したいプラグインを指定します。

まず、一番重要な項目としてプラグインの引数を指定可能とするか選択します。セキュリティ上は引数を選択させず、このファイルの中に全てのパラメータを指定したほうが良いです。しかし、引数が指定できないため、閾値やホスト名を含めたすべてのパラメータを指定した上で、コンフィグファイルに記載しておく必要があります。

iptablesなどで要求元のホストを絞ることでセキュリティ上のリスクを許容できる場合は引数を指定できたほうが利便性は上がりますので、ネットワークの状況に応じて使い分けてください。

ここでは、リスクを許容して引数を受け付けるように設定を行います。

vi /etc/nagios/nrpe.cfg
server_address=<nrpe server ip>
allowed_hosts=<nagios server ip>
dont_blame_nrpe=1
command[check_http]=/usr/lib64/nagios/plugins/check_http -H $ARG1$ -u $ARG2$ command[check_ping]=/usr/lib64/nagios/plugins/check_ping -H $ARG1$ -w $ARG2$ -c $ARG3$

設定が完了したら、NRPEを起動します。また、iptablesで監視対象のサーバを指定してポートを開放します。

service nrpe start
chkconfig nrpe on
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -s <nagios server address> -m tcp -p tcp --dport 5666 -j ACCEPT service iptables restart 

Nagios Server側の設定

Nagios Server にはcheck_nrpeをインストールします。rpmforgeでは「nagios-plugins-nrpe」として公開されていますので、インストールし動作確認を行います。

yum install nagios-plugins-nrpe.x86_64

/usr/lib64/nagios/plugins/check_nrpe -H <nrpe server ip> -c check_ping -a <target server ip> 500,10% 1000,20%
PING OK - Packet loss = 0%, RTA = 1.64 ms|rta=1.645000ms;500.000000;1000.000000;0.000000 pl=0%;10;20;0

/usr/lib64/nagios/plugins/check_nrpe -H <nrpe server ip> -c check_http -a <target server ip> <url>
HTTP OK: HTTP/1.1 200 OK - 553 bytes in 0.003 second response time |time=0.002690s;;;0.000000 size=553B;;;0

動作確認が済んだら、Nagiosのコマンドコンフィグファイルに登録します。サービスの定義ファイルからは「$ARG1$」にはNRPEのホスト、「$ARG2$」にはコマンド名、 ターゲットサーバ、-aに続く引数として監視対象のホストのIPアドレス、「$ARG3$」にコマンド名の引数が入るように呼び出します。

define command {
 command_name check_nrpe
 command_line $USER1$/check_nrpe -H $ARG1$ -c $ARG2$ -a $HOSTADDRESS$ $ARG3$
}

サービスでは下記のように登録します。

define service {
 host_name <target server>
 service_description HTTP-nrpe
 check_command check_nrpe!<nrpe server ip>!check_http! 500,10% 1000,20%
 <省略>
 register 1
}
VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] Thruk サイドメニューの追加

Thrukの右側のフレームのメニューには任意のセクションとリンクを追加できます。イメージとしては下記のようなイメージになります。公式のドキュメントはこちら

サイドメニューへの新規追加

メニューの追加は「/etc/thruk/menu_local.conf」に記載するルールになっているようです。セクションの追加は「add_section」、リンクの追加は「add_link」で、サブメニューの追加は「add_sub_link」で行います。

ここでは、サンプルとしてNagvisのマップへのリンクを追加してみます。

vi /etc/thruk/menu_local.conf
add_section('name' => 'Nagvis');
add_link('name' => "Overview", 'href' => '/nagvis/frontend/nagvis-js/index.php');
add_sub_link('name' => 'Map-A', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Map-A');
add_sub_link('name' => 'Map-B', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Map-B');
add_sub_link('name' => 'Map-C', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Map-C');
add_sub_link('name' => 'Auto Map', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=AutoMap&act=view&show=__automap');
add_sub_link('name' => 'Rotation Map A', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Map-A&rotation=RotateMap-A&rotationStep=0');
add_sub_link('name' => 'Rotation Map B', 'href' => '/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Map-B&rotation=RotateMap-B&rotationStep=0');
do '/usr/share/thruk/menu.conf';

最後の行は既存のメニューの呼び出しですので、削除しないでください。また、赤字の部分は環境に合わせて書き換えてください。

既存サイドメニューへの追加と削除

既存サイドメニューへの追加は「insert_item」を使います。例として、既存のReportメニューにNSTIを追加します。先ほどのファイルの最後に下記の記述を追加します。

insert_item('Reports', { 'name' => 'NSTI', 'href' => '/nsti/' });

追加後は下記のようになります。

削除には「remove_item」を使います。例えばサブメニューである「Home」と「Documentation」を削除すると、「General」セクションには、サブメニューがなくなりますが、サブメニューがすべてなくなると、セクション自体も削除されます。

remove_item('General', 'Home');
remove_item('General', 'Documentation');
VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] Thruk

Thrukは特に大規模な環境下で威力を発揮するツールです。Nagiosは監視対象が500台くらいまでなら、単体でもなんら問題なく動作可能です。(もちろんNagiosQLなどを併用した場合)。1000台を越えるころから、だんだん遅くなって、2500台を超えるとUIのレスポンスの遅さなどにイライラしてきます。

Thrukではnagiosを複数台立ててMk Livestatusを通してUIを統合することで、単体のNagiosと比較してパフォーマンスが大きく向上しています。Thrukの公式サイトにベンチマークが掲載されています。demoサイトも監視対象数の割りにそこそこのパフォーマンスであることが確認できると思います。また、UIもNagiosよりもずいぶん使いやすくなっているので単体でも便利になっています。

今回は下記のような構成でNagios2台がすでに構築された環境でThrukサーバ を構築してみます。

Nagios が入っているサーバにはMK Livestatusをインストールしておいてください。ネットワーク越しにステータスを取得する必要があるので、xinetdを入れてThrukサーバからの試験まで、済ませておいてください。詳細はMK Livestatusの項目を見てください。

インストール前の準備

SELinuxが動作していると、うまく動かなかったので、無効にして再起動します。

vi /etc/selinux/config
SELINUX=disabled
reboot

また、gdが必要になるのでインストールしておきます。

yum install gd

ThrunkのダウンロードとEPELのリポジトリの追加

Thrukのダウンロードページからrpmパッケージをダウンロードします。rpmが用意されているので、適切なパッケージをダウンロードしてください。

export http_proxy=http://xxx.xxx.xxx.xxx:8080 # プロクシのある環境のみ
wget http://www.thruk.org/files/pkg/v1.28/rhel6/x86_64/thruk-1.28-1.rhel6.x86_64.rpm

で、そのままインストールしようとすると下記のようなエラーが出てインストールできません。

yum install thruk-1.28-1.rhel6.x86_64.rpm
Error: Package: thruk-1.28-1.el6.x86_64 (/thruk-1.28-1.rhel6.x86_64)
Requires: mod_fcgid

「mod_fcgid」のパッケージを探して探して・・・。EPELにありました。いつもDag氏のリポジトリを使っていてそれほど困ったことが無かったので、見落としていました。

Extra Packages for Enterprise Linuxのリポジトリを導入するためのrpmファイルをダウンロードしてインストールします。

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
rpm -ivh epel-release-6-5.noarch.rpm

リポジトリの追加後は問題なくthrukのパッケージがインストール可能になっています。

yum install  thruk-1.28-1.rhel6.x86_64.rpm

インストールが終わったら、EPELのリポジトリは無効にしておきます。

vi /etc/yum.repos.d/epel.repo
[epel]
#enabled=1
enabled=0

念のため、有効になっているリポジトリの一覧を取得して確認しておきましょう。

yum repolist
repo id                        repo name                                  status base                           CentOS-6 - Base                            6,294 
extras                         CentOS-6 - Extras                              4 updates                       CentOS-6 - Updates                            830 

thrukはユーザ「thruk」で動作しますので、ユーザを作っておきます。

useradd thruk

設定

コンフィグファイルをコピーし編集します。上書きしても良いか聞かれますが、どうせコメントしか書いていないファイルですので、構わず上書きしてしまいます。366行目付近から始まる、peerの項目が該当項目になります。今回はローカルにはNagiosは入れませんので、localhostの設定はコメントアウトしてしまいます。もし、ローカルにNagiosが入っている環境であれば、パス等を修正して適切に設定しておいてください。リモートのNagiosサーバの項目を追加します。すぐ下にサンプルがいくつか記載されていますので、真似て記載してみます。

cp /etc/thruk/thruk.conf /etc/thruk/thruk_local.conf
vi /etc/thruk/thruk_local.conf
366 # <peer>
367 # name   = Core
368 # type   = livestatus
369 # <options>
370 # peer          = /var/nagios/rw/live
371 # resource_file = /etc/nagios/resource.cfg
372 # </options>
373 # <configtool>
374 # core_conf      = /etc/nagios/nagios.cfg
375 # obj_check_cmd  = /usr/sbin/nagios -v /etc/nagios/nagios.cfg
376 # obj_reload_cmd = /etc/init.d/nagios reload
377 # </configtool>
378 # </peer>
379 <peer>
380 name   = Nagios01
381 type   = livestatus
382 <options>
383 peer    =xxx.xxx.xxx.xxx:6557 # 1台目のNagiosサーバのIP
384 </options>
385 </peer>
386 <peer>
387 name   = Nagios02
388 type   = livestatus
389 <options>
390 peer    = xxx.xxx.xxx.xxx:6557 # 2台目のNagiosサーバのIP
391 </options>
392 </peer>

もし、httpdサーバがインストールされていないのであればインストールしておきます。また、ログインのためのパスワードファイルを作成しておきます。このまま起動すると、httpdがServerNameを設定しろと文句を言うので、ServerNameだけは設定しておきます。

yum install httpd
htpasswd -c /etc/thruk/htpasswd thrukadmin

vi /etc/httpd/conf/httpd.conf
ServerName xxx.xxx.xxx.xxx:80

service httpd start
chkconfig httpd on

起動と動作確認

ここまで設定が完了したらthrukを起動します。

service thruk start
chkconfig thruk on

failとなって起動しないような場合には、下記のコマンドを打って出力された結果で判断してください。

THRUK_DEBUG=1
/usr/bin/thruk -l

最後にiptableで80をあけて設定は終了です。

vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

service iptables restart

それでは実際にThrukのページ(http://xxx.xxx.xxx.xxx/thruk)にアクセスしてみてください。
Nagiosでアクセスできていた項目はもちろん、ログの日付指定や、MineMapなどを選択することができるようになっているはずです。

実際に追加される機能としては、下記のようなものがあります。

  • ホスト、サービスの一覧画面でステータスやホスト、サービス名などによる高度な検索を行うことができます。
  • ホスト、サービスの一覧画面で一覧をExcelに出力することができる。出力する項目を選択することもできます。
  • ホスト、サービスの一覧画面でダウンタイムやコメントの追加などが可能。時刻指定のUIが改善されている。
  • pnp4nagiosのグラフが詳細画面中に描画される。
  • MineMapがメニューに追加される。
  • イベントログなど履歴画面で日付指定で表示できる。Excelにも出力可能。
  • テーマの切り替え機能が搭載されている。自分で作ることも可能。

他にも色々と便利になっているところがありました。公式サイトでdemoが公開されていますので試してみると分かりやすいかと思います。

 

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] MK Livestatus

MK Livestatusは、監視対象ホストやサービスのステータスを高速で返すAPIをNagiosに追加します。Nagios.orgからもNDOUtilsというツールが提供されていますが、監視対象のサーバ数が増えたり長期間運用していると遅くなったりしてあまり使い勝手が・・・。標準でついてくるstatus.datにいたっては・・・。MK Livestatusは、NagVisThrukなどでも使用されており高速で使い勝手がよいところが特徴です。

動作確認は、CentOS6.2 + Nagios 3.2.3 + mk-livestatus-1.1.12p7 です。
ライセンスは、ソースコードを見るとGPLとなっているようです。

インストール前の準備

ソースからコンパイルして入れるので、makeとgcc、gcc-c++をいれておきます。

yum install gcc make gcc-c++

インストール

MK Livestatusをダウンロードして、展開します。

export http_proxy=http://xxx.xxx.xxx.xxx:8080 #プロキシを使用している場合のみ
wget http://mathias-kettner.de/download/mk-livestatus-1.1.12p7.tar.gz
cd /usr/local/src
tar zvxf mk-livestatus-1.1.12p7.tar.gz
cd mk-livestatus-1.1.12p7

インストールします。makeの引数はCPUのコアの数に応じて変更したほうが良いパフォーマンスが出るようです。

./configure
make -j 8
make install

Nagiosのコンフィグを変更します。broker_moduleとしてmk-livestatusが動作するように変更します。変更後はNagiosを再起動してください。

vi /etc/nagios/nagios.cfg
event_broker_options=-1
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/nagios/rw/live
service nagios restart

ここまでで、インストールは完了です。正常に動作しているか確認するために下記のようなコマンドを打ってください。

/usr/local/bin/unixcat /var/nagios/rw/live
GET hosts # [Enter]を2回打ってください。

どうでしょうか。表示が追いつかないほどの速さで、ホストのステータスとサービスのステータスが表示されたと思います。監視サーバ(Nagios)が単体のサーバである場合には、コレでインストール終了です。このままで、NagVisなどと連携することが可能です。

Thrukなどを使って複数のNagiosを統合管理したい場合やNagvisで複数のNagiosのステータスを取得する必要がある場合は、次の項目まで読み進めてください。

リモートからの要求に応答する(via xinetd)

リモートからの要求にも応答したい場合は、sshやxinetdを使う必要があります。いまさらですが、今回はxinetdを使用することにします。イメージとしては下記のような感じです。

まず、yumでxinetd本体をインストールします。

yum install xinetd

xinetdのコンフィグを記載します。サンプルはMK Livestatusのページに記載されていますので、only_fromの行以外は、そのまま使用することにします。

vi /etc/xinetd.d/livestatus
service livestatus 
{
type            = UNLISTED
port            = 6557
socket_type     = stream
protocol        = tcp
wait            = no
# limit to 100 connections per second. Disable 3 secs if above.
cps             = 100 3
# set the number of maximum allowed parallel instances of unixcat. 
# Please make sure that this values is at least as high as
# the number of threads defined with num_client_threads in 
# etc/mk-livestatus/nagios.cfg
instances       = 500
# limit the maximum number of simultaneous connections from 
# one source IP address
per_source      = 250
# Disable TCP delay, makes connection more responsive
flags           = NODELAY
user            = nagios
server          = /usr/local/bin/unixcat
server_args     = /var/nagios/rw/live
# configure the IP address(es) of your Nagios server here: 
# only_from       = 127.0.0.1 10.0.20.1 10.0.20.2
only_from       = xxx.xxx.xxx.xxx
disable         = no
}

xinetdを起動してみます。ついでにiptablesも開けておきます。

chkconfig xinetd on
service xinetd start
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6557 -j ACCEPT
service iptables restart

リモートからの動作確認

リモート(図のHost-A)からの動作確認にはnetcatを使用します。ソースからインストールしますので、リモートのサーバにもgccとwgetをインストールします。

yum install make gcc wget
export http_proxy=http://xxx.xxx.xxx.xxx:8080 #プロキシを使用している場合のみ

ソースコードを取得して展開します。

wget http://downloads.sourceforge.net/project/netcat/netcat/0.7.1/netcat-0.7.1.tar.gz
cd /usr/local/src
tar xzvf netcat-0.7.1.tar.gz
cd netcat-0.7.1

コンパイルしてインストールします。

./configure
make
make install

それでは実際に接続してみましょう。unixcatの代わりにnetcatを使用する以外は全く同じコマンドを打てば応答があるはずです。

netcat <target nagios server> 6557
GET hosts # [Enter]を2回打ってください。

先ほどと同様の応答があれば、問題なく稼働しているということになります。

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

[Nagios] check_snmp_load.pl

check_snmp_load.plはLinuxやWindows、ネットワーク機器のCPU負荷を監視するプラグインです。現在、下記の機器を監視できるようです。

Windows, Linux/Unix, AS400, Cisco, Cisco ASA5500, Cisco catalyst, HP Procurve, LinkProof, Blucoat, Nokia, Fortinet, Netscreen, HP-UX

上記のスクリプトをダウンロードして、プラグインのフォルダに配置します。実行権限も加えておきます。

mv check_snmp_load.pl /usr/lib64/nagios/plugins/
chmod 755 check_snmp_load.pl

配置したら、実際にテストを行なってみます。–perfparseオプションを付けるのは、パフォーマンスデータを出力しグラフ化するためです。グラフが必要なければ、–perfparseオプションは不要です。

# 対象がWindowsやLinuxの場合
/usr/lib64/nagios/plugins/check_snmp_load.pl -H <ipaddress> \
--community public --type stand --warn 90 --crit 100 --perfparse
 4 CPU, average load 1.0% < 90% : OK | cpu_prct_used=1%;90;95
# 対象がLinuxのロードアベレージの場合
/usr/lib64/nagios/plugins/check_snmp_load.pl -H <ipaddress> \
--community public --type netsl --warn 5,3,1 --crit 10,5,2 --perfparse
 Load : 0.00 0.00 0.00 : OK | load_1_min=0.00;1;4 load_5_min=0.00;2;5 load_15_min=0.00;3;6
# 対象がNetScreen/SSGの場合
/usr/lib64/nagios/plugins/check_snmp_load.pl -H <ipaddress> \ 
--community public --type nsc --warn 90,85,80 --crit 95,90,85 --perfparse
 CPU : 2 4 2 : OK | cpu_5_sec=2%;90;95 cpu_1_min=4%;85;90 cpu_5_min=2%;80;85

typeを変更することで様々な機器に対応します。詳細はヘルプを確認してください。今回はやりませんが、pmp4Nagiosでグラフ化する際に下記のような形でタイプごとにコマンドコンフィグに登録しておくと、Templateを適用しやすいです。

# 対象がWindowsやLinuxの場合のコマンド定義
define command {
command_name  check_snmp_load_stand
command_line  $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ \
--community $ARG1$ --warn $ARG2$ --crit $ARG3$ --type stand --perfparse
register      1
}
# 対象がLinuxのLoadの場合のコマンド定義
define command {
command_name  check_snmp_load_netsl
command_line  $USER1$/org/check_snmp_load.pl -H $HOSTADDRESS$ \
--community $ARG1$ --warn $ARG2$ --crit $ARG3$ --type netsl --perfparse
register      1
}
# 対象がNetScreen/SSGの場合のコマンド定義
define command {
command_name  check_snmp_load_nsc
command_line  $USER1$/org/check_snmp_nsc.pl -H $HOSTADDRESS$ \
--community $ARG1$ --warn $ARG2$ --crit $ARG3$ --type nsc --perfparse
register      1
}

サービスからは、タイプごとに分けたコマンドファイルを呼び出すように設定してやります。

# Windows/Linuxのサンプル
define service {
 ...(省略)...
 check_command check_snmp_load_stand!public!90!95
 ...(省略)...
 }
# NetSNMPのLoad用サンプル
define service {
 ...(省略)...
 check_command check_snmp_load_netsl!public!5,3,1.5!10,5,2
 ...(省略)...
 }
# NetScreen/SSG用のサンプル
define service {
 ...(省略)...
 check_command check_snmp_load_nsc!public!90!95
 ...(省略)...
 }

このプラグインは、特にテンプレートを作らなくても特段見難いとは感じませんでしたので、標準の物を使用することにします。ただ、Loadはグラフが3種類も出てきてしまうので、ちょっとうっとおしいかもしれません。・・・暇があったら作ります。

デフォルトのテンプレートだと下記のような感じです。

あまり負荷もかかっておらず、サンプル期間も短いので参考になるかわかりませんが・・・

 

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)

Postfix 詳細ログの取得方法@Postfixメーリングリスト

[postfix-jp: 4117] Re: 特定のメールが受信できない」から。

「debug_peer_level」というオプションがあることは知っていたのですが、このオプションは特定ドメインにのみ適用するようなことができるんですね。コレは知らなかった・・・。

debug_peer_level = 3
debug_peer_list = .redhat.com

debug_peer_level (デフォルト: 2)
リモートクライアントまたはサーバが debug_peer_list パラメータのパターンにマッチした場合の、冗長ログレベルの増分。

debug_peer_list (デフォルト: empty)
冗長ログレベルを $debug_peer_level で指定された量だけ増加させる、リモートクライアントまたはサーバのホスト名またはネットワークアドレスのパターンのオプションのリスト。
ドメイン名や network/netmask パターン、”/file/name” パターン、 “type:table” 検索テーブルを指定します。 “type:table” 検索からの右側部分の結果は無視されます。
ドメイン名のパターンマッチは parent_domain_matches_subdomains パラメータによって制御されます。
例:
debug_peer_list = 127.0.0.1
debug_peer_list = some.domain
引用元:postfixのページ

VN:F [1.9.17_1161]
Rating: 3.0/5 (1 vote cast)

[Nagios] check_esxi_wbem.pyでESXiのハードウェア監視

ESXiのハードウェアを監視します。対象としては、DellやIBM、HPのサーバなどです。あまりにマイナーなハードウェアだとほとんど監視できませんので、あしからず。

—–

Nasgios Exchangeにも書かれていますが、どうも、ESXi 5.0 u1ではCIMのクエリに対する応答が異常に遅くなるバグがあるようです。プラグインのバグではないとの記載があります。私が試してみたところ応答があるまでに1分30秒以上かかり、結果プラグインの実行がタイムアウトしてしまいます。nagios.cfgのservice_check_timeoutをデフォルトの60秒から300秒程度まで伸ばして、監視間隔を10分など長めに設定すると問題ないようです。

—–

動作確認は、CentOS 6.2 + ESXi 4.1, 4.1 u1, 5.0, 5.0 u1です。

ESX側には、監視用のユーザを作成する必要がありますので、まずは、システム管理者のロールかrootグループに所属するユーザを作成してください。

作成者のサイトか、Nagios Exchangeからcheck_esxi_wbem.pyをダウンロードします。pluginsのディレクトリに移し権限を付与しておきます。

export http_proxy=http://xxx.xxx.xxx.xxx:8080# プロキシが必要な場合だけ
wget http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.py
mv check_esxi_hardware.py /usr/lib64/nagios/plugins
chmod 755 /usr/lib64/nagios/plugins/check_esxi_hardware.py

このスクリプトの動作には、vSphereCLIとpython、pywbemが必要です。
まず、python、pywbemをインストールします。

yum install python pywbem

次にvSphere CLIをインストールします。
ダウンロードには登録が必要です。ログインしたあと、vSphereCLIをダウンロードします。今回は、「VMware-vSphere-CLI-5.0.0-422456.x86_64.tar.gz」をダウンロードしました。

cd /usr/local/src
tar xzvf VMware-vSphere-CLI-5.0.0-422456.x86_64.tar.gz
cd vmware-vsphere-cli-distrib/

インストールの前に色々とパッケージが必要となるので、先にインストールしておきます。また、接続にプロキシが必要な場合はproxyも設定しておきます。(ftpも)

export http_proxy=http://xxx.xxx.xxx.xxx:8080
export ftp_proxy=http://xxx.xxx.xxx.xxx:8080
yum install openssl-devel libxml2-devel libuuid-devel
cpan # ←初回起動時は色々聞いてきます。
 cpan > o conf ftp_proxy http://xxx.xxx.xxx.xxx:8080
 cpan > o conf http_proxy http://xxx.xxx.xxx.xxx:8080
 cpan > install YAML
 cpan > install UUID
 cpan > install LWP::Protocol::https

やっとインストールです。途中何度か質問を投げてくるので、適当に適切に答えます。

./vmware-install.pl
Press enter to display it. [enter]
Do you accept? (yes/no) yes
In which directory do you want to install the executable files?
[/usr/bin] [enter]

それでは実行してみましょう。ユーザとパスワードは先ほど作成したものを使用します。

/usr/lib64/nagios/plugins/check_esx_wbem.py --host=xxx.xxx.xxx.xxx \
--user=monitoring_user --pass=pass --verbose --perfdata
 20120424 00:55:08 Connection to https://xxx.xxx.xxx.xxx
 (省略)
 20120424 00:55:09 Check classe CIM_Processor
 20120424 00:55:10 Element Name = CPUSocket
 20120424 00:55:10 Family = 198
 20120424 00:55:10 CurrentClockSpeed = 2800MHz
 20120424 00:55:10 Element Op Status = 2
 20120424 00:55:10 Check classe CIM_RecordLog
 20120424 00:55:10 Check classe OMC_DiscreteSensor
 20120424 00:55:10 Check classe OMC_Fan
 20120424 00:55:10 Check classe OMC_PowerSupply
 20120424 00:55:10 Check classe VMware_StorageExtent
 20120424 00:55:10 Check classe VMware_Controller
 20120424 00:55:10 Check classe VMware_StorageVolume
 20120424 00:55:10 Check classe VMware_Battery
 20120424 00:55:11 Check classe VMware_SASSATAPort
 OK - Server:

verboseを指定したため、上記のようなちょっと詳細な結果が帰ってくるはずです。。。しかし、さすがに自作パソコンだけあって、FanもPowerSupplyもBatteryも、ほとんど何も監視できていない。CPUくらいか・・・。
ちなみに、普通のサーバ(DellやIBM、HPなど)を使用すれば温度センサーやバッテリーのステータス、PowerSupplyのステータスなど、様々な値が帰ってくるようになります。また、「–perf-data」を指定しているため、温度や回転数など取得できるパフォーマンスデータがあれば、一緒に帰ってきます。

上記スクリプトをNagiosのCommandファイルと、Servicesファイルに追加し監視してください。

 

ちなみに、対応したハードウェアに対して上記スクリプトを実行すると、下記のようなにこれでもかと応答が帰ってきます。ハードウェアの監視としてはコレで十分すぎるくらいではないかと。

Check classe OMC_SMASHFirmwareIdentity
Element Name = System BIOS
VersionString = XXX
Check classe CIM_Chassis
Element Name = Chassis
Manufacturer = HP
SerialNumber = XXXXXXXXXX
Model = ProLiant ML3XX GX
Element Op Status = 0
Check classe CIM_Card
Check classe CIM_ComputerSystem
Element Name = System Board 7:1
Element Op Status = 0
Element Name = System Board 7:2
Element Op Status = 0
Element Name = System Board 7:3
Element Op Status = 0
Element Name = System Board 7:4
Element Op Status = 0
Element Name = System Board 7:5
Element Op Status = 0
Element Name = System Board 7:6
Element Op Status = 0
Element Name = System Board 7:7
Element Op Status = 0
Element Name = System Board 7:8
Element Op Status = 0
Element Name = System Board 7:9
Element Op Status = 0
Element Name = System Board 7:10
Element Op Status = 0
Element Name = System Internal Expansion Board 16:1
Element Op Status = 0
Element Name = System Internal Expansion Board 16:2
Element Op Status = 0
Element Name = System Internal Expansion Board 16:3
Element Op Status = 0
Element Name = System Internal Expansion Board 16:4
Element Op Status = 0
Element Name = System Internal Expansion Board 16:5
Element Op Status = 0
Element Name = System Internal Expansion Board 16:6
Element Op Status = 0
Element Name = System Internal Expansion Board 16:7
Element Op Status = 0
Element Name = <host name>
Element Name = Hardware Management Controller (Node 0)
Element Op Status = 0
Check classe CIM_NumericSensor
Element Name = System Board 9 Power Meter
sensorType = 4 - Current
BaseUnits = 7
Scaled by = 0.010000
Current Reading = 192.000000
Element Op Status = 2
Element Name = System Board 8 Temp 24
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 37.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = System Board 7 Temp 23
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 31.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = System Board 6 Temp 22
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 49.000000
Upper Threshold Critical = 110.000000
Element Op Status = 2
Element Name = Drive Backplane 1 Temp 21
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 25.000000
Upper Threshold Critical = 60.000000
Element Op Status = 2
Element Name = Memory Module 9 Temp 20
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 27.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Processor 3 Temp 19
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 29.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 7 Temp 18
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 29.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 6 Temp 17
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 30.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 5 Temp 16
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 31.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 4 Temp 15
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 32.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 3 Temp 14
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 34.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 2 Temp 13
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 35.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = System Internal Expansion Board 1 Temp 12
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 36.000000
Upper Threshold Critical = 68.000000
Element Op Status = 2
Element Name = Memory Module 8 Temp 11
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 34.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 7 Temp 10
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 30.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 6 Temp 9
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 27.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 5 Temp 8
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 27.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 4 Temp 7
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 25.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 3 Temp 6
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 25.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 2 Temp 5
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 26.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Memory Module 1 Temp 4
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 29.000000
Upper Threshold Critical = 87.000000
Element Op Status = 2
Element Name = Processor 2 Temp 3
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 40.000000
Upper Threshold Critical = 82.000000
Element Op Status = 2
Element Name = Processor 1 Temp 2
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 40.000000
Upper Threshold Critical = 82.000000
Element Op Status = 2
Element Name = External Environment 1 Temp 1
sensorType = 2 - Temperature
BaseUnits = 2
Scaled by = 0.010000
Current Reading = 21.000000
Upper Threshold Critical = 42.000000
Element Op Status = 2
Element Name = System Board 5 Fans
sensorType = 5 - Tachometer
BaseUnits = 65
Scaled by = 0.010000
Current Reading = 0.000000
Element Name = System Board 3 Fan 3
sensorType = 5 - Tachometer
BaseUnits = 65
Scaled by = 0.010000
Current Reading = 25.480000
Element Op Status = 2
Element Name = System Board 2 Fan 2
sensorType = 5 - Tachometer
BaseUnits = 65
Scaled by = 0.010000
Current Reading = 25.480000
Element Op Status = 2
Element Name = System Board 1 Fan 1
sensorType = 5 - Tachometer
BaseUnits = 65
Scaled by = 0.010000
Current Reading = 25.480000
Element Op Status = 2
Element Name = Power Supply 2 Power Supply 2: Presence detecte
sensorType = 11 - Presence
BaseUnits = 7
Scaled by = 0.010000
Current Reading = 95.000000
Element Name = Power Supply 2 Power Supply 2: Failure status
sensorType = 1 - Other
BaseUnits = 7
Scaled by = 0.010000
Current Reading = 95.000000
Element Op Status = 2
Element Name = Power Supply 1 Power Supply 1: Presence detecte
sensorType = 11 - Presence
BaseUnits = 7
Scaled by = 0.010000
Current Reading = 85.000000
Element Name = Power Supply 1 Power Supply 1: Failure status
sensorType = 1 - Other
BaseUnits = 7
Scaled by = 0.010000
Current Reading = 85.000000
Element Op Status = 2
Check classe CIM_Memory
Element Name = Proc 1 Level-1 Cache
Element Op Status = 0
Element Name = Proc 1 Level-2 Cache
Element Op Status = 0
Element Name = Proc 1 Level-3 Cache
Element Op Status = 0
Element Name = Proc 2 Level-1 Cache
Element Op Status = 0
Element Name = Proc 2 Level-2 Cache
Element Op Status = 0
Element Name = Proc 2 Level-3 Cache
Element Op Status = 0
Element Name = Memory
Element Op Status = 2
Check classe CIM_Processor
Element Name = Proc 1
Family = 179
CurrentClockSpeed = 2133MHz
Element Op Status = 2
Element Name = Proc 2
Family = 179
CurrentClockSpeed = 2133MHz
Element Op Status = 15
Check classe CIM_RecordLog
Element Name = IPMI SEL
Element Op Status = 2
Check classe OMC_DiscreteSensor
Element Name = Power Supply 3 Power Supplies
Element Op Status = 2
Element Name = System Chassis 3 Ext. Health LED
Element Name = System Chassis 2 Int. Health LED
Element Name = System Chassis 1 UID Light
Check classe OMC_Fan
Element Name = Fan 3
Element Op Status = 2
Element Name = Fan 2
Element Op Status = 2
Element Name = Fan 1
Element Op Status = 2
Check classe OMC_PowerSupply
Element Name = Power Supply 1
Element Op Status = 2
Element Name = Power Supply 2
Element Op Status = 2
Check classe VMware_StorageExtent
Check classe VMware_Controller
Check classe VMware_StorageVolume
Check classe VMware_Battery
Check classe VMware_SASSATAPort
OK - Server: HP ProLiant ML3XX GX s/n: XXXXXXXXXX System BIOS: xxx 20xx-xx-xx
Performance Data:
P1Pow_0_System_Board_9_Power_Meter=192;0;0
P4Tem_0_Drive_Backplane_1_Temp_21=25;0;60
P4Tem_10_Memory_Module_9_Temp_20=27;0;87
P4Tem_11_Processor_1_Temp_2=40;0;82
P4Tem_12_Processor_2_Temp_3=40;0;82
P4Tem_13_Processor_3_Temp_19=29;0;87
P4Tem_14_System_Board_6_Temp_22=49;0;110
P4Tem_15_System_Board_7_Temp_23=31;0;87
P4Tem_16_System_Board_8_Temp_24=37;0;87
P4Tem_17_System_Internal_Expansion_Board_1_Temp_12=36;0;68
P4Tem_18_System_Internal_Expansion_Board_2_Temp_13=35;0;68
P4Tem_19_System_Internal_Expansion_Board_3_Temp_14=34;0;68
P4Tem_1_External_Environment_1_Temp_1=21;0;42
P4Tem_20_System_Internal_Expansion_Board_4_Temp_15=32;0;68
P4Tem_21_System_Internal_Expansion_Board_5_Temp_16=31;0;68
P4Tem_22_System_Internal_Expansion_Board_6_Temp_17=30;0;68
P4Tem_23_System_Internal_Expansion_Board_7_Temp_18=29;0;68
P4Tem_2_Memory_Module_1_Temp_4=29;0;87
P4Tem_3_Memory_Module_2_Temp_5=26;0;87
P4Tem_4_Memory_Module_3_Temp_6=25;0;87
P4Tem_5_Memory_Module_4_Temp_7=25;0;87
P4Tem_6_Memory_Module_5_Temp_8=27;0;87
P4Tem_7_Memory_Module_6_Temp_9=27;0;87
P4Tem_8_Memory_Module_7_Temp_10=30;0;87
P4Tem_9_Memory_Module_8_Temp_11=34;0;87
P6FanP_0_System_Board_1_Fan_1=25.48%;0;0
P6FanP_1_System_Board_2_Fan_2=25.48%;0;0
P6FanP_2_System_Board_3_Fan_3=25.48%;0;0
P6FanP_3_System_Board_5_Fans=0%;0;0
VN:F [1.9.17_1161]
Rating: 4.0/5 (1 vote cast)

[Nagios] User Password Update

User Password Updateは、NagiosにログオンするためのパスワードをGUIから変更するためのツールです。passwordファイルを書き換えるだけのツールではありますが、ユーザが複数いるような場合は便利に使えるかもしれません。

早速、ダウンロードしてpassword.phpをnagiosのルートフォルダに移動します。パスワードファイルまでのパスを記載しなければならないのと、一部書き換えていたほうが良いと思われる部分があったので、下記の通り書き換えます。

mv password.php /usr/share/nagios/
vi /usr/share/nagios/password.php
35  - $passwdfile='/usr/local/nagios/etc/htpasswd.users';
35  + $passwdfile='/etc/nagios/htpasswd.users';
113 - <TD style="font-weight:bold;"><? echo $_SERVER['PHP_AUTH_USER']; ?></TD>
113 + <TD style="font-weight:bold;"><?php echo $_SERVER['PHP_AUTH_USER']; ?></TD>

次は、nagiosのメニューにpassword.phpへのリンクを追加します。追加先は・・・Configurationの下あたりでいいでしょうか・・・。

vi /usr/share/nagios/side.php
120 + <li><a href="/nagios/password.php" target="<?php echo $link_target;?>">
121 + Change Password</a></li>

ここで、NagiosのWebUIにアクセスしてみます。「Change Password」というリンクをクリックすると、パスワード変更画面が表示されます。

新しいパスワードを入力して、「Password Changed」と表示されればパスワードの変更完了です。別の画面に移動した時に新しいパスワードを聞かれるはずです。

 

 

 

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)