nagiosモニタnginx状態(check_)nginx.sh)
1、サーバーとモニタされたホストの取り付けコンポーネント
yum install bc
コンパイルインストールnrpe(教程参照:http://2860664.blog.51cto.com/2850664/1559056)
以下はモニタホストの設定です。
2、モニタスクリプトのcheckをダウンロードします。nginx.shは、モニタされたホストの/usr/local/nagios/libexecディレクトリにアップロードされます。
ダウンロード先:http://exchange.nagios.org/components/com_mtree/atachment.php?link_id=622&cf_id=24
スクリプトの実行権限を与える
chmod+x /usr/local/nagios/libexec/checnginx.sh
3、vi/usr/local/nagios/etc/nrpe.cfg 追加
command[check_]nginx=/usr/local/nagios/libexec/checnginx.sh-H www.xx. com-P 80-p/usr/local/nginx/logs/-n nginx.pid-s nginx_status-w 15000-c 20000
その中の赤色はあなたの監視するウェブサイトです。
緑色はnginx.pidの保存経路で、nginx.com nfに追加できます。pid /usr/local/inx/logs/inx.pid;設定を行います。
4、テストスクリプトの実行
cd /usr/local/nagios/libexec
./checknginx.sh-H www.xx. com-P 80-p/usr/local/nginx/logs/-n nginx.pid-s nginx_status-w 15000-c 20000
OK-inx is running.1 requests per second,1 connections per second(1.00 requests per connection)|'reqpsc'=1'conpspec'=1'conpreq'=1.00)
以下はモニタホスト設定です。
5、vi/usr/local/nagios/etc/nagios.cfg 追加
cfg_file=/usr/local/nagios/etc/object/nginx.cfg
6、タッチ /usr/local/nagios/etc/object/nginx.cfg
vi /usr/local/nagios/etc/object/nginx.cfg (注意モニタ端のIPを修正します。内容は以下の通りです。
私は分割線******************************************************************************です。
とりあえずここに書いて、明日は整理します。
yum install bc
コンパイルインストールnrpe(教程参照:http://2860664.blog.51cto.com/2850664/1559056)
以下はモニタホストの設定です。
2、モニタスクリプトのcheckをダウンロードします。nginx.shは、モニタされたホストの/usr/local/nagios/libexecディレクトリにアップロードされます。
ダウンロード先:http://exchange.nagios.org/components/com_mtree/atachment.php?link_id=622&cf_id=24
スクリプトの実行権限を与える
chmod+x /usr/local/nagios/libexec/checnginx.sh
3、vi/usr/local/nagios/etc/nrpe.cfg 追加
command[check_]nginx=/usr/local/nagios/libexec/checnginx.sh-H www.xx. com-P 80-p/usr/local/nginx/logs/-n nginx.pid-s nginx_status-w 15000-c 20000
その中の赤色はあなたの監視するウェブサイトです。
緑色はnginx.pidの保存経路で、nginx.com nfに追加できます。pid /usr/local/inx/logs/inx.pid;設定を行います。
4、テストスクリプトの実行
cd /usr/local/nagios/libexec
./checknginx.sh-H www.xx. com-P 80-p/usr/local/nginx/logs/-n nginx.pid-s nginx_status-w 15000-c 20000
OK-inx is running.1 requests per second,1 connections per second(1.00 requests per connection)|'reqpsc'=1'conpspec'=1'conpreq'=1.00)
以下はモニタホスト設定です。
5、vi/usr/local/nagios/etc/nagios.cfg 追加
cfg_file=/usr/local/nagios/etc/object/nginx.cfg
6、タッチ /usr/local/nagios/etc/object/nginx.cfg
vi /usr/local/nagios/etc/object/nginx.cfg (注意モニタ端のIPを修正します。内容は以下の通りです。
私は分割線******************************************************************************です。
define host{
use linux-server
host_name nginx
alias nginx
address IP
}
define service{
use generic-service
host_name nginx
service_description check-swap
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name nginx
service_description check-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name nginx
service_description check-disk
check_command check_nrpe!check_sda1
}
define service{
use generic-service
host_name nginx
service_description check-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name nginx
service_description otal_procs
check_command check_nrpe!check_total_procs
}
define service{
use generic-service ; Name of service template to use
host_name nginx
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use generic-service
host_name nginx
service_description nginx_status
check_command check_nrpe!check_nginx!ip!80!/usr/local/nginx/sbin/nginx!nginx.pid!nginx_status!/tmp!15000!20000
notifications_enabled 0
}
私も分割線*********************************************************************************です。とりあえずここに書いて、明日は整理します。