[root@scientific ~]# tar zxvf nagios_down-0.2.tar.gz ← nagios_down展開
[root@scientific ~]# cp nagios_down.php /usr/local/nagios/bin/ ← nagios_down.phpを所定のディレクトリへコピー
[root@scientific ~]# rm -f nagios_down.* ← 展開したファイルを削除
[root@scientific ~]# rm -f nagios_down-0.2.tar.gz ← ダウンロードしたファイルを削除
[root@scientific ~]# vi /usr/local/nagios/bin/nagios_down.php ← nagios_down.php編集
define(NAGIOSCMD, "/usr/local/groundwork/nagios/var/spool/nagios.cmd");
↓
define(NAGIOSCMD, "/usr/local/nagios/var/rw/nagios.cmd"); ← nagios.cmdパス変更
[root@scientific ~]# vi /etc/php.ini ← php設定ファイル編集
※nagios_down実行時下記エラーメッセージ出力時対処
PHP Notice: Use of undefined constant NAGIOSCMD - assumed 'NAGIOSCMD' in /usr/local/nagios/bin/nagios_down.php on line 13
PHP Notice: Use of undefined constant VERSION - assumed 'VERSION' in /usr/local/nagios/bin/nagios_down.php on line 18
PHP Notice: Use of undefined constant VERDATE - assumed 'VERDATE' in /usr/local/nagios/bin/nagios_down.php on line 19
PHP Notice: Undefined variable: duration in /usr/local/nagios/bin/nagios_down.php on line 131
error_reporting = E_ALL & ~E_DEPRECATED
↓
error_reporting = E_ALL & ~E_NOTICE ← 通知メッセージを出力しないようにする
※nagios_down実行時下記エラーメッセージ出力時対処
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /usr/local/nagios/bin/nagios_down.php on line 140
PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /usr/local/nagios/bin/nagios_down.php on line 146
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
;date.timezone =
↓
date.timezone = Asia/Tokyo ← TIMEZONEを設定
[root@scientific ~]# vi /usr/local/nagios/bin/nagios_down.php ← nagios_down.php編集
※nagios_down実行時下記エラーメッセージ出力時対処
PHP Deprecated: Function ereg() is deprecated in /usr/local/nagios/bin/nagios_down.php on line 189
if ( ereg("^all$", $service) )
↓
if ( preg_match("/^all$/", $service) ) ← 非推奨関数eregを推奨関数preg_matchへ変更
[root@scientific ~]# vi /etc/cron.d/nagios ← nagios_down用cron設定ファイル新規作成
01 00 * * * root /usr/bin/php /usr/local/nagios/bin/nagios_down.php -h localhost -s "Current Load" -f -b "04:00 now" -e "07:00 now" -a "Nagios Admin" -c "Server Maintenance"
← 毎日4:00〜7:00はlocalhostのCPU負荷監視を行なわない※左記は例
|
|