nagios的配置總結(jié)-創(chuàng)新互聯(lián)

所有都是yum安裝:

創(chuàng)新互聯(lián)于2013年成立,先為梁河等服務(wù)建站,梁河等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為梁河企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。
  1.  # vim /etc/nagios/nagios.cfg

添加主機(jī)配置文件到主配置文件

cfg_file=/etc/nagios/objects/localhost.cfg

cfg_file=/etc/nagios/objects/172.16.1.1.cfg

2.  # vim /etc/nagios/objects/commands.cfg

添加 check_nrpe 命令到 commands.cfg

define command{

    command_name   check_nrpe

    command_line   $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

    }

3. 主機(jī)配置模版:

# cat  172.16.10.134.cfg

define host{

    use           linux-server

    host_name        172.16.1.1

    alias          172.16.1.1

    address         172.16.1.1

    }

define service{

    use           generic-service

    host_name        172.16.1.1

    service_description   check_ping

    check_command      check_ping!100.0,20%!200.0,50%

    max_check_attempts    5

    normal_check_interval  1

    }

define service{

    use           generic-service

    host_name        172.16.1.1

    service_description   check_ssh

    check_command      check_ssh

    max_check_attempts    5

    normal_check_interval  1

    notification_interval  60

    }

define service{

    use           generic-service

    host_name        172.16.1.1

    service_description   check_http

    check_command      check_http

    max_check_attempts    5

    normal_check_interval  1

    notification_interval  60

}

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       Root Partition

    check_command          check_local_disk!20%!10%!/

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       Current Users

    check_command          check_local_users!20!50

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       Total Processes

    check_command          check_local_procs!450!500!RSZDT

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       Current Load

    check_command          check_local_load!5.0,4.0,3.0!10.0,6.0,4.0

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       Swap Usage

    check_command          check_local_swap!20!10

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       check_load

    check_command          check_nrpe!check_load

    max_check_attempts        5

    normal_check_interval      1

}

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       check_disk_opt

    check_command          check_nrpe!check_opt

    max_check_attempts        5

    normal_check_interval      1

}

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       port 145

    check_command          check_tcp!145

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       port 110

    check_command          check_tcp!110

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       port 106

    check_command          check_tcp!106

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       port 107

    check_command          check_tcp!107

    }

define service{

    use               generic-service

    host_name            172.16.1.1

    service_description       check_mem

    check_command          check_nrpe!check_mem

    max_check_attempts        5

    normal_check_interval      1

}

[root@local objects]#

客戶端:

[root@local plugins]# vim /etc/nagios/nrpe.cfg

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10

command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20

command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1

command[check_opt]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/all--data-data01

command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z

command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200

command[check_mem]=/usr/lib64/nagios/plugins/check_mem.sh -w 150 -c 100

# cat /usr/lib64/nagios/plugins/check_mem.sh

#!/bin/bash

TOTAL=`free -m | head -2 |tail -1 |gawk '{print $2}'`

# Free memory

FREE=`free -m | head -2 |tail -1 |gawk '{print $4}'`

# to calculate free percent

# use the expression  free * 100 / total

FREETMP=`expr $FREE \* 100`

PERCENT=`expr $FREETMP / $TOTAL`

echo "$FREE MB ($PERCENT%) Free Memory"

exit 0

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

文章名稱:nagios的配置總結(jié)-創(chuàng)新互聯(lián)
文章路徑:http://bm7419.com/article20/cdisjo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、App設(shè)計(jì)、電子商務(wù)、網(wǎng)站收錄、網(wǎng)站設(shè)計(jì)公司靜態(tài)網(wǎng)站

廣告

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

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