Customplug(一)

Monitoring plugin:

成都創(chuàng)新互聯(lián)專注于涼州企業(yè)網(wǎng)站建設(shè),自適應(yīng)網(wǎng)站建設(shè),購物商城網(wǎng)站建設(shè)。涼州網(wǎng)站建設(shè)公司,為涼州等地區(qū)提供建站服務(wù)。全流程按需求定制制作,專業(yè)設(shè)計,全程項目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

[root@RHEL5 ~]# cd /usr/local/nagios/
[root@RHEL5 nagios]# mkdir customexec
[root@RHEL5 nagios]# vi customexec/check_procs.sh

#!/bin/sh
#Author:zhai_kang,20131024
COUNT=`ps -ef | grep -v grep | grep $2 | wc -l`
PROC=`expr $COUNT - 2`
if [[ $PROC -ge $6 ]]
then
        line=`echo "Critical - PROC=$PROC"`
        RC=2
elif [[ $PROC -ge $4 ]]
then
        line=`echo "Warning - PROC=$PROC"`
        RC=1
elif [[ $PROC -ge 1 ]]
then
        line=`echo "OK - PROC=$PROC"`
        RC=0
else
        line=`echo "Unknown - PROC=null"`
        RC=3
fi
echo $line \| proc=$PROC
exit $RC

[root@RHEL5 nagios]# chown -R nagios:nagios customexec/
[root@RHEL5 nagios]# chmod +x customexec/check_procs.sh


Set the path to the plugins:
[root@RHEL5 nagios]# vi /etc/nagios/resource.cfg

#Add by Kingcraft
$USER5$=/usr/local/nagios/customexec

Integration of the PNP4Nagios and Nagios:
[root@RHEL5 nagios]# vi /etc/nagios/nagios.cfg

process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

[root@RHEL5 nagios]# vi /etc/nagios/objects/templates.cfg

#Add by Kingcraft
define host{
    name            host-pnp
    register        0
    action_url      /pnp4nagios/graph?host=$HOSTNAME$
    }
define service{
    name            srv-pnp
    register        0
    action_url      /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
    }

Define the monitoring command:
[root@RHEL5 nagios]# vi /etc/nagios/objects/commands.cfg

define command{
    command_name   process-host-perfdata
    command_line   /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
define command{
    command_name   process-service-perfdata
    command_line      /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command{
        command_name    check_procs
        command_line    $USER5$/check_procs.sh -a $ARG1$ -w $ARG2$ -c $ARG3$
        }

Definition monitor file:
[root@RHEL5 nagios]# vi /etc/nagios/Linuxhosts/localhost.cfg

# Define a host for the local machine
define host{
        use                     linux-server,host-pnp
        host_name               Monitor
        alias                   Monitor
        address                 172.17.10.4
        }
define service{
        use                     local-service,srv-pnp
        host_name               Monitor
        service_description     check_procs
        check_command           check_procs!ndo2db!4!6
        }

Syntax checking && restart nagios:
[root@RHEL5 nagios]# /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
[root@RHEL5 nagios]# service nagios restart


Verification:

Custom plug(一)

當前名稱:Customplug(一)
路徑分享:http://muchs.cn/article36/ispspg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、企業(yè)建站、品牌網(wǎng)站設(shè)計、網(wǎng)站建設(shè)網(wǎng)站排名、網(wǎng)站設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)