harumaki.net

インフラ屋の覚書や、ラーメン食べある記とか。

[nagios] nagios plugin downtime_sched(ダウンタイムスケジューラ)

   


以前設定した、Recurring scheduleのアップデート版”downtime_sched”のインストール。
前回インストール後に全然アップデートしてなかった。
ちゃんとチェックしとかないとな~

– プラグインの公式サイト
Nagios Exchange:downtime_sched

1)ダウンロードと展開

# wget https://exchange.icinga.org/exchange/downtime_sched%3A+recurring+downtime+scheduler/files/2/downtime-3.2.tar.gz
# tar -zxvf downtime-3.2.tar.gz
# cd downtime-3.2
# ll
total 52
-rw-r--r-- 1 quaduser quaduser   410 Sep  1  2010 crontab
-rwxr-xr-x 1 quaduser quaduser 15446 Sep  1  2010 downtime_job.pl
-rwxr-xr-x 1 quaduser quaduser 16991 Sep  1  2010 downtime_sched.cgi
-rw-r--r-- 1 quaduser quaduser  2326 Sep  1  2010 README
-rw-r--r-- 1 quaduser quaduser   561 Sep  1  2010 side.html
-rw-r--r-- 1 quaduser quaduser   278 Sep  1  2010 side.php

2)ファイルの配置

# cp -p downtime_job.pl /usr/lib64/nagios/plugins/
# cp -p downtime_sched.cgi /usr/lib64/nagios/cgi-bin/

3)downtime_job.pl編集

ファイルは/usr/lib64/nagios/plugins/downtime_job.pl

– 編集内容

32c32
< my($NAGDIR) = "/u02/nagios" ;  # Nagios root directory
---
> my($NAGDIR) = "/usr/sbin/nagios" ;  # Nagios root directory
40,41c40,41
< my($CFGFILE) =   "$NAGDIR/etc/schedule.cfg";  # my configuration file
< my($CMDFILE) =   "$NAGDIR/log/rw/nagios.cmd"; # Nagios CMD file
---
> my($CFGFILE) =   "/etc/nagios/schedule.cfg";  # my configuration file
> my($CMDFILE) =   "/var/spool/nagios/cmd/nagios.cmd"; # Nagios CMD file
43c43
< $OBJECTS = "$NAGDIR/log/objects.cache"        # Nagios 2/3 objects file
---
> $OBJECTS = "/var/log/nagios/objects.cache"        # Nagios 2/3 objects file
46c46
< $STATUSDAT = "$NAGDIR/log/status.dat"         # Nagios status file
---
> $STATUSDAT = "/var/log/nagios/status.dat"         # Nagios status file
48c48
< $RETENTIONDAT = "$NAGDIR/log/retention.dat"   # Nagios retained status file
---
> $RETENTIONDAT = "/var/log/nagios/retention.dat"   # Nagios retained status file
51c51
< $DOWNDAT =   "$NAGDIR/log/downtime.dat"       # Nagios 2 existing downtime
---
> $DOWNDAT =   "/var/log/nagios/downtime.dat"       # Nagios 2 existing downtime
55,57c55,57
< $STATUSLOG = "$NAGDIR/log/status.log";    # Nagios status log file
< $HGCFG =     "$NAGDIR/etc/hostgroups.cfg";# hostgroup definitions
< $DOWNLOG =   "$NAGDIR/log/downtime.log";  # existing sched downtime
---
> $STATUSLOG = "/var/log/nagios/status.log";    # Nagios status log file
> $HGCFG =     "/etc/nagios/objects/hostgroups.cfg";# hostgroup definitions
> $DOWNLOG =   "/var/log/nagios/downtime.log";  # existing sched downtime

4)downtime_sched.cgi編集

– 編集内容

20,22c20,22
< my($NAGIOS) = "/u02/nagios";
< my($CFGFILE) = "$NAGIOS/etc/schedule.cfg"; # My config file!
< my($CMDCGI) = "/nagios/cgi-bin/cmd.cgi";
---
> my($NAGIOS) = "/usr/local/nagios";
> my($CFGFILE) = "/etc/nagios/schedule.cfg"; # My config file!
> my($CMDCGI) = "/usr/lib64/nagios/cgi-bin/cmd.cgi";
25c25
< my($STATUSLOG) = "$NAGIOS/log/status.log";# if defined, check validity
---
> my($STATUSLOG) = "/var/log/nagios/status.log";# if defined, check validity
27c27
< my($OBJECTS) = "$NAGIOS/log/objects.cache";# if defined, use nagios2 cache
---
> my($OBJECTS) = "/var/log/nagios/objects.cache";# if defined, use nagios2 cache

5)schedule.cfg作成

cgi経由でhttpdプロセスが更新するので、オーナーはhttpdプロセスの実行ユーザーを指定。

# touch /etc/nagios/schedule.cfg
# chown apache:nagios /etc/nagios/schedule.cfg
# chmod 664 /etc/nagios/schedule.cfg

ここまで設定すれば、利用可能。
nagiosを再起動して動作確認へ。

Nagios統合監視[実践]リファレンス (Software Design plus)
株式会社エクストランス 佐藤 省吾 Team-Nagios
技術評論社
売り上げランキング: 398,071
Nagios Core Administration Cookbook
Packt Publishing (2013-01-25)

 - infra, nagios, サーバー監視, 作業ログ , ,