nagios 監(jiān)控自身
創(chuàng)新互聯(lián)公司是專業(yè)的金山網(wǎng)站建設(shè)公司,金山接單;提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行金山網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!定義監(jiān)控命令 commands.cfg
vim /usr/local/nagios/etc/objects/commands.cfg
#local_server check-host-alive command definition
define command{
command_name xxx #定義監(jiān)控的名字(自定義)
command_line xxx #定義命令具體實(shí)現(xiàn)的功能 $USER1$ = /usr/local/nagios/libexec/ 變量在/usr/local/nagios/etc/resource.cfg中定義
}
#local_server check-host-alive command definition
define command{
command_name check-host-alive
command_line $USER1$/ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
定義監(jiān)控對(duì)象 localhost.cfg
Localhost.cfg相當(dāng)于是一個(gè)監(jiān)控LINUX主機(jī)的模板,如果需要監(jiān)控其他LINUX主機(jī),可以把這個(gè)文件復(fù)制一份進(jìn)行修改。
cp localhost.cfg linux.cfg
vim linux.cfg
define host {
use 監(jiān)控使用的模板
host_name 被監(jiān)控主機(jī)的主機(jī)名
alias 被監(jiān)控主機(jī)別名
address 被監(jiān)控主機(jī)IP地址
}
define host{
use linux-server
host_name localhost
alias localhost
address 127.0.0.1
}
use linux-server:加載linux-server的配置(linux-server已在templates.cfg中定義)
use local-service:加載local-service的配置(已在templates.cfg中定義)
查看templates.cfg:
define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24x7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (max)
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
check_periaod 24X7: 檢測(cè)的時(shí)間段為24X7,24X7在timeperiod.cfg
contact_groups admins:發(fā)通知給admins組,admins組在contacts.cfg中定義
加載監(jiān)控對(duì)戲那個(gè)配置文件 nagios.cfg
vim /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
檢查配置語(yǔ)法是否有誤
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
啟動(dòng)nagios和httpd服務(wù)
service httpd restart
service nagios restart
chkconfig httpd on
chkconfig nagios restart
配置登錄頁(yè)面認(rèn)證用戶
進(jìn)入WEB頁(yè)面查看
http://ip/nagios
自定義監(jiān)控項(xiàng)目
自定義監(jiān)控對(duì)象
監(jiān)控/boot分區(qū)
首先查看commands.cfg
定義監(jiān)控的分區(qū)
vim localhost.cfg
define service{
use local-service
host_name localhost
service_description Boot Partition 在nagios Services 中顯示的名稱
check_command check_local_disk!50%!40%!/boot
notifications_enabled 1 是否開(kāi)啟提醒功能。1為開(kāi)啟,0為禁用
}
重啟nagios
service nagios restart
notifications_enabled
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.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ān)控自身-創(chuàng)新互聯(lián)
標(biāo)題來(lái)源:http://aaarwkj.com/article20/ccohco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、商城網(wǎng)站、App設(shè)計(jì)、響應(yīng)式網(wǎng)站、微信小程序、品牌網(wǎng)站建設(shè)
聲明:本網(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)
猜你還喜歡下面的內(nèi)容