監(jiān)控windows主機(jī)
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比徐水網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式徐水網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋徐水地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。監(jiān)控windows主機(jī)通過snmp或者nsclient++來監(jiān)控
Nsclient++可以監(jiān)控windows主機(jī)的cpu、內(nèi)存、磁盤空間、進(jìn)程、服務(wù)
Nsclient++也支持nrpe所以也可以通過nrpe來監(jiān)控
NSCA主動(dòng)與nagios發(fā)送檢測,nagios端也需要NSCA daemon
通常使用check_nt,也是最簡單,功能最少的。
安裝NSClient
Allowed hosts:
Nagios所在的主機(jī)地址,我這里是192.168.102.128
Password:密碼
是否允許常見插件
是否允許check_nt
是否允許check_nrpe
關(guān)閉防火墻之后
上圖為安裝之后查看端口,12489監(jiān)控0.0.0.0,即check_nt與nsclient++通信的端口
5666為nrpe所使用的端口
想要nagios監(jiān)控windows
要安裝check_nt
[root@localhostnagios-cn-3.2.0]# cd /usr/local/nagios/libexec/
[root@localhostlibexec]#ls
[root@localhost libexec]# ./check_nt –h 查看幫助。
[root@localhost libexec]# ./check_nt -H 192.168.102.132(被監(jiān)控主機(jī)ip) -p 12489 -v UPTIME
System Uptime - 0 day(s) 1 hour(s) 35 minute(s) 查看當(dāng)前windows主機(jī)的啟動(dòng)時(shí)間
[root@localhostlibexec]# ./check_nt -H 192.168.102.132 -p 12489 -v CPULOAD -w 80 -c 90 -l5,80,90
CPU Load2% (5 min average) | '5 min avgLoad'=2%;80;90;0;100
查看當(dāng)前windows主機(jī)的cpu使用情況。
[root@localhostlibexec]# ./check_nt -H 192.168.102.132 -p 12489 -v USEDDISKSPACE -w 80 -c 90-l C
C:\ -total: 14.65 Gb - used: 9.72 Gb (66%) - free 4.93 Gb (34%) | 'C:\ UsedSpace'=9.72Gb;11.72;13.18;0.00;14.65
檢測C盤的利用率
計(jì)劃進(jìn)行監(jiān)控
[root@localhostobjects]# cd /etc/nagios/objects/
[root@localhostobjects]# ls
commands.cfg localhost.cfg switch.cfg timeperiods.cfg
contacts.cfg printer.cfg templates.cfg windows.cfg
[root@localhost objects]# vim commands.cfg 在個(gè)加入新的命令。
definecommand{
command_name check_nt
command_line $USER1$/check_nt -H$HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}【源文件已經(jīng)有了】
[root@localhost objects]# vim windows.cfg 定義主機(jī)
修改:
可以用vim命令:
.,$s@winserver@winhost@g
. , $s @winserver @winhost @g
當(dāng)前行最后一行搜索 winserver 用其替換前面 go
【修改主機(jī)名,可以不進(jìn)行修改】
[root@localhost objects]# vim windows.cfg
# Createa service for monitoring the W3SVC service
# Changethe host_name to match the name of the host you defined above
defineservice{
use generic-service
host_name winhost
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -lW3SVC
}
# Createa service for monitoring the Explorer.exe process
# Changethe host_name to match the name of the host you defined above
defineservice{
use generic-service
host_name winhost
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -lExplorer.exe
}
"windows.cfg" 145L, 4005C 134,0-1 底端
最后啟用此配置文件:
[root@localhostobjects]# cd ..
[root@localhostnagios]# vim nagios.cfg
# You canspecify individual object config files as shown below:
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
cfg_file=/etc/nagios/objects/windows.cfg 添加
重啟之前,檢查語法錯(cuò)誤。
[root@localhost nagios]# /usr/local/nagios/bin/nagios -v/etc/nagios/nagios.cfg
Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and CommunityContributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config fileokay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Warning: Duplicate definition found for command 'check_nt' (configfile '/etc/nagios/objects/ ommands.cfg', starting on line 241)
Error: Could not add object property in file'/etc/nagios/objects/commands.cfg' on line 242.【有問題了】
Error processing objectconfig files!
***> One or more problems was encountered while processing theconfig files...
Check your configurationfile(s) to ensure that they contain valid
directives and datadefintions. If you are upgrading from aprevious
version of Nagios, youshould be aware that some variables/definitions
may have been removed ormodified in this version. Make sure toread
the HTML documentationregarding the config files, as well as the
'Whats New' section tofind out what has changed.
檢查原因是那里重復(fù)了。
再進(jìn)行檢測
[root@localhost nagios]# /usr/local/nagios/bin/nagios -v/etc/nagios/nagios.cfg
Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and CommunityContributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config fileokay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file'/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/windows.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Read object config filesokay...
Running pre-flight check on configuration data...
Checking services...
Checked 26 services.
Checking hosts...
Checked 12 hosts.
Checking host groups...
Checked 3 host groups.
Checking service groups...
Checked 2 servicegroups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contactgroups.
Checking service escalations...
Checked 0 serviceescalations.
Checking service dependencies...
Checked 0 servicedependencies.
Checking host escalations...
Checked 0 hostescalations.
Checking host dependencies...
Checked 0 hostdependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 timeperiods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during thepre-flight check
沒有錯(cuò)誤。
[root@localhost nagios]# service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
重啟服務(wù),加載新的配置文件。
最后:
對(duì)多臺(tái)windows主機(jī)進(jìn)行監(jiān)控:
#cp windows.cfg winserver.cfg
然后修改ip
再把definegroup的注釋掉
添加到監(jiān)控計(jì)劃中。
重啟服務(wù)。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
分享題目:nagios監(jiān)控windows-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://muchs.cn/article34/peppe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計(jì)、商城網(wǎng)站、Google、網(wǎng)站內(nèi)鏈、建站公司、網(wǎng)站營銷
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容