主頁 > 知識(shí)庫 > nagios服務(wù)端配置及客戶的安裝配置步驟分享[圖文]

nagios服務(wù)端配置及客戶的安裝配置步驟分享[圖文]

熱門標(biāo)簽:硅谷的囚徒呼叫中心 服務(wù)器配置 美團(tuán) 百度競(jìng)價(jià)點(diǎn)擊價(jià)格的計(jì)算公式 電話機(jī)器人搭建 解決方案 家政服務(wù)網(wǎng)絡(luò) 外呼系統(tǒng)

1.上面我講了一些nagios服務(wù)端的安裝和簡(jiǎn)單的配置,現(xiàn)在來講一下服務(wù)端監(jiān)控多臺(tái)服務(wù)器的以及被監(jiān)控端的安裝配置。

2.nagios 服務(wù)端的配置

(1).首先默認(rèn)安裝好后,nagios就創(chuàng)建好了一個(gè)分組和一些服務(wù),這個(gè)文件就是localhost.cfg文件?,F(xiàn)在我們要?jiǎng)?chuàng)建自己的文件

把nagios.cfg里面的定義localhost.cfg這個(gè)注釋掉,然后在開啟hostgroup.cfg,host.cfg,services.cfg這三個(gè)文件。我把這三個(gè)文件

放在conf目錄下便于管理。

注:這些文件及相關(guān)目錄原先是沒有的,要自己創(chuàng)建并授權(quán)給它們

(2).要?jiǎng)?chuàng)建自己的組就先要在contacts.cfg里面定一個(gè)自己的聯(lián)系人。

Linux-servers是我自己建的聯(lián)系人各聯(lián)系組。

注:如果不建這個(gè)聯(lián)系人和組,在后面的hostgroup.cfg里面不能定義自己的主機(jī)組員。

(3).現(xiàn)在來建自己的監(jiān)控主機(jī)、監(jiān)控服務(wù),監(jiān)控組。

先講一下他們?nèi)叩年P(guān)系,監(jiān)控組(hostgroup.cfg)包含了監(jiān)控主機(jī)(host.cfg)包含了監(jiān)控服務(wù)(services.cfg)

hostgroup.cfg-gt;host.cfg-gt;services.cfg

只要有一個(gè)不在就會(huì)報(bào)錯(cuò)。

檢查nagios.cfg這個(gè)文件的報(bào)錯(cuò)信息是

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

可以看到你哪里配置錯(cuò)了,我也是通過這個(gè)來排錯(cuò)的。

1.hostgroup.cfg

define hostgroup {
hostgroup_name Linux-servers
alias Linux-servers
members CentOS
}

2.host.cfg

define host {
host_name CentOS
alias server,host-pnp
address 192.168.1.8
contact_groups Linux-servers
check_command check-host-alive
max_check_attempts 5
notification_interval 10
notification_period 24x7
notification_options d,u,r
}

3.services.cfg

define service {
host_name CentOS
use local-service,srv-pnp
service_description CPU
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups Linux-servers
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_cpu
}
define service {
host_name CentOS
use local-service,srv-pnp
service_description CPU_load
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups Linux-servers
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_load
}

//services.cfg 這里只給出了兩個(gè),其它的按自己的需要添加就行了。

重啟nagios之后先檢查一下有沒有錯(cuò)誤了,沒有的話就重啟一下

service nagios restart

上面的圖是我配好后的結(jié)果,現(xiàn)在來配置被監(jiān)控端。

3.nagios 被監(jiān)控端的配置。

(1).安裝nagios-plugins

如果后面的configure沒有檢查到mysql這一項(xiàng),看一下mysql-devel有沒有安裝,沒有安裝一下。

tar –xvf nagios-plugins-1.4.15.tar.gz

cd nagios-plugins-1.4.15

./configure

make make install

(2).安裝nrpe

tar –xvf nrpe-2.12.tar.gz

cd nrpe-2.12

./configure

make all

make install-plugin

make install-daemon

make install-daemon-config

make install-xinetd //這個(gè)是用xinetd來管理nrpe的啟動(dòng)和關(guān)閉的,可以加上也可以不加上。

(3).到些被監(jiān)控的軟件裝好了,還要裝一下snmp來收集數(shù)據(jù),安裝和配置net-snmp我已經(jīng)在前面說過了,這里就不說了。

現(xiàn)在來配置一下監(jiān)控項(xiàng)(nrpe.cnf)

log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=192.168.1.7

dont_blame_nrpe=1
debug=1
command_timeout=30
connection_timeout=300

command[check_http]=/usr/local/nagios/libexec/check_http -I localhost -u /index.php -t 60
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 5% -c 3% -A -i '/dev/shm'
command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M -b -6
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh
command[check_mem]=/usr/local/nagios/libexec/check_mem.sh
command[check_ips]=/usr/local/nagios/libexec/ip_conn.sh 400 600
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,8 -c 30,25,20
command[check_ftp]=/usr/local/nagios/libexec/check_ftp 127.0.0.1 -w 10 -c 60

這里有幾個(gè)是沒有的要自己去網(wǎng)上找,然后下載下來放到/usr/local/nagios/libexec/下面并給執(zhí)行權(quán)限,擁有者nagios。(check_traffic.sh,check_cpu.sh,

check_mem.sh,ip_conn.sh)

(4)監(jiān)控mysql數(shù)據(jù)庫和遠(yuǎn)程主機(jī)還需要在服務(wù)端的"commands.cfg"配置一下。

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

define command {
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -unagdb -pwww -d nagdb
}

define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health -hostname $HOSTADDRESS$ -username nagdb -password www -warning $ARG1$ -critical $ARG2$ -mode threads-connected
}

隨便找一個(gè)位置放到commands.cfg文件里就行了。

到此就配置完了。

標(biāo)簽:南昌 北海 烏蘭察布 撫州 邢臺(tái) 臨沂 韶關(guān) 防城港

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《nagios服務(wù)端配置及客戶的安裝配置步驟分享[圖文]》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266