Inthisarticle,l’llexplainhowtomonitorremotewindowsmachineandthevariousservicerunningonthewindowsserverusingnagiosmonitoringserver.Followingthreesectionsarecoveredinthisarticle.
I.Overview
II.4stepstoinstallnagiosonremotewindowshost
1InstallNSClient++ontheremotewindowsserver
2ModifytheNSClient++Service
3ModifytheNSC.ini
4StarttheNSClient++Service
III.6configurationstepsonnagiosmonitoringserver
5Verifycheck_ntcommandandwindows-servertemplate
6Uncommentwindows.cfgin/usr/local/nagios/etc/nagios.cfg
7Modify/usr/local/nagios/etc/objects/windows.cfg
8Definewindowsservicesthatshouldbemonitored.
9EnablePasswordProtection
10VerifyConfigurationandRestartNagios.
I.Overview
.
FollowingthreestepswillhappenonaveryhighlevelwhenNagios(installedonthenagios-server)monitorsaservice(fore.g.diskspaceusage)ontheremoteWindowshost.
11Nagioswillexecutecheck_ntcommandonnagios-serverandrequestittomonitordiskusageonremotewindowshost.
12Thecheck_ntonthenagios-serverwillcontacttheNSClient++serviceonremotewindowshostandrequestittoexecutetheUSEDDISKSPACEontheremotehost.
13TheresultsoftheUSEDDISKSPACEcommandwillbereturnedbackbyNSClient++daemontothecheck_ntonnagios-server.
Followingflowsummarizestheaboveexplanation:
NagiosServer(check_nt)—–>Remotehost(NSClient++)—–>USEDDISKSPACE
NagiosServer(check_nt)<—–Remotehost(NSClient++)<—–USEDDISKSPACE(returnsdiskspaceusage)
II.4stepstosetupnagiosonremotewindowshost
.
1.InstallNSClient++ontheremotewindowsserver
DownloadNSCP0.3.1(NSClient++-Win32-0.3.1.msi)fromNSClient++Project.NSClient++isanopensourcewindowsservicethatallowsperformancemetricstobegatheredbyNagiosforwindowsservices.GothroughthefollowingfiveNSClient++installationstepstogettheinstallationcompleted.
(1)NSClient++WelcomeScreen
(2)LicenseAgreementScreen
(3)SelectInstallationoptionandlocation.Usethedefaultoptionandclicknext.
(4)ReadytoInstallScreen.ClickonInstalltogetitstarted.
(5)InstallationcompletedScreen.
2.ModifytheNSClient++Service
GotoControlPanel->AdministrativeTools->Services.Doubleclickonthe“NSClientpp(Nagios)0.3.1.142008-03-12w32″serviceandselectthecheck-boxthatsays“Allowservicetointeractwithdesktop”asshownbelow.
3.ModifytheNSC.ini
(1)ModifyNSC.inianduncomment*.dll:EdittheC:/ProgramFiles/NSClient++/NSC.inifileanduncommenteverythingunder[modules]exceptRemoteConfiguration.dllandCheckWMI.dll
[modules]
;#NSCLIENT++MODULES
;#AlistwithDLLstoloadatstartup.
;YouwillneedtoenablesomeoftheseforNSClient++towork.
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;**
;*NOTICE!!!-YOUHAVETOEDITTHIS*
;**
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
;CheckWMI.dll
;
;RemoteConfigurationISANEXTREMEARLYIDEASODONTUSEFORPRODUCTIONENVIROMNEMTS!
;RemoteConfiguration.dll
;NSCAAgentisanewbetamoduleusewithcare!
NSCAAgent.dll
;LUAscriptmoduleusedtowriteyourown"checkdeamon"(sortof)earlybeta.
LUAScript.dll
;Scripttocheckexternalscriptsand/orinternalaliases,earlybeta.
CheckExternalScripts.dll
;CheckotherhoststhroughNRPEextremebetaandprobablyabitdangerous!
NRPEClient.dll
(2)ModifyNSC.inianduncommentallowed_hosts.EdittheC:/ProgramFiles/NSClient++/NSC.inifileandUncommentallowed_hostundersettingsandaddtheip-addressofthenagios-server.
;#ALLOWEDHOSTADDRESSES
;Thisisacomma-delimitedlistofIPaddressofhoststhatareallowedtotalktothealldaemons.
;Ifleavethisblankanyonecanaccessthedeamonremotly(NSClientstillrequiresavalidpassword).
;Thesyntaxishostorip/maskso192.168.0.0/24willallowanyoneonthatsubnetaccess
allowed_hosts=192.168.1.2/255.255.255.0
Note:allowed_hostislocatedunder[Settings],[NSClient]and[NRPE]section.Makesuretochangeallowed_hostunder[Settings]forthispurpose.
(3)ModifyNSC.inianduncommentport.EdittheC:/ProgramFiles/NSClient++/NSC.inifileanduncommenttheport#under[NSClient]section
;#NSCLIENTPORTNUMBER
;ThisistheporttheNSClientListener.dllwilllistento.
port=12489
(4)ModifyNSC.iniandspecifypassword.YoucanalsospecifyapasswordthenagiosserverneedstousetoremotelyaccesstheNSClient++agent.
[Settings]
;#OBFUSCATEDPASSWORD
;Thisisthesameasthepasswordoptionbuthereyoucanstorethepasswordinanobfuscatedmanner.
;*NOTICE*obfuscationis*NOT*thesameasencryption,someonewithaccesstothisfilecanstillfigureoutthe
;password.Itsjustabithardertodoitatfirstglance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;#PASSWORD
;Thisisthepassword(-s)thatisrequiredtoaccessNSClientremotely.Ifyouleavethisblankeveryonewillbeabletoaccessthedaemonremotly.
password=My2Secure$Password
4.StarttheNSClient++Service
StarttheNSClient++serviceeitherfromtheControlPanel->Administrativetools->Services->Select“NSClientpp(Nagios)0.3.1.142008-03-12w32″andclickonstart(or)Clickon“Start->AllPrograms->NSClient++->StartNSClient++(Win32).PleasenotethatthiswillstarttheNSClient++asawindowsservice.
LaterifyoumodifyanythingintheNSC.inifile,youshouldrestartthe“NSClientpp(Nagios)0.3.1.142008-03-12w32″fromthewindowsservice.
III.6configurationstepsonnagiosmonitoringserver
.
1.Verifycheck_ntcommandandwindows-servertemplate
Verifythatthecheck_ntisenabledunder/usr/local/nagios/etc/objects/commands.cfg
#'check_nt'commanddefinition
definecommand{
command_namecheck_nt
command_line$USER1$/check_nt-H$HOSTADDRESS$-p12489-v$ARG1$$ARG2$
}
Verifythatthewindows-servertemplateisenabledunder/usr/local/nagios/etc/objects/templates.cfg
#Windowshostdefinitiontemplate-ThisisNOTarealhost,justatemplate!
definehost{
namewindows-server;Thenameofthishosttemplate
usegeneric-host;Inheritdefaultvaluesfromthegeneric-hosttemplate
check_period24x7;Bydefault,Windowsserversaremonitoredroundtheclock
check_interval5;Activelychecktheserverevery5minutes
retry_interval1;Schedulehostcheckretriesat1minuteintervals
max_check_attempts10;Checkeachserver10times(max)
check_commandcheck-host-alive;Defaultcommandtocheckifserversare"alive"
notification_period24x7;Sendnotificationoutatanytime-dayornight
notification_interval30;Resendnotificationsevery30minutes
notification_optionsd,r;Onlysendnotificationsforspecifichoststates
contact_groupsadmins;Notificationsgetsenttotheadminsbydefault
hostgroupswindows-servers;HostgroupsthatWindowsserversshouldbeamemberof
register0;DONTREGISTERTHIS-ITSJUSTATEMPLATE
}
2.Uncommentwindows.cfgin/usr/local/nagios/etc/nagios.cfg
#DefinitionsformonitoringaWindowsmachine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
3.Modify/usr/local/nagios/etc/objects/windows.cfg
Bydefaultasamplehostdefinitionforawindowsserverisgivenunderwindows.cfg,modifythistoreflecttheappropriatewindowsserverthatneedstobemonitoredthroughnagios.
#DefineahostfortheWindowsmachinewe'llbemonitoring
#Changethehost_name,alias,andaddresstofityoursituation
definehost{
usewindows-server;Inheritdefaultvaluesfromatemplate
host_nameremote-windows-host;Thenamewe'regivingtothishost
aliasRemoteWindowsHost;Alongernameassociatedwiththehost
address192.168.1.4;IPaddressoftheremotewindowshost
}
4.Definewindowsservicesthatshouldbemonitored.
Followingarethedefaultwindowsservicesthatarealreadyenabledinthesamplewindows.cfg.Makesuretoupdatethehost_nameontheseservicestoreflectthehost_namedefinedintheabovestep.
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionNSClient++Version
check_commandcheck_nt!CLIENTVERSION
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionUptime
check_commandcheck_nt!UPTIME
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionCPULoad
check_commandcheck_nt!CPULOAD!-l5,80,90
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionMemoryUsage
check_commandcheck_nt!MEMUSE!-w80-c90
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionC:/DriveSpace
check_commandcheck_nt!USEDDISKSPACE!-lc-w80-c90
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionW3SVC
check_commandcheck_nt!SERVICESTATE!-dSHOWALL-lW3SVC
}
defineservice{
usegeneric-service
host_nameremote-windows-host
service_descriptionExplorer
check_commandcheck_nt!PROCSTATE!-dSHOWALL-lExplorer.exe
}
5.EnablePasswordProtection
IfyouspecifiedapasswordintheNSC.inifileoftheNSClient++configurationfileontheWindowsmachine,you’llneedtomodifythecheck_ntcommanddefinitiontoincludethepassword.Modifythe/usr/local/nagios/etc/commands.cfgfileandaddpasswordasshownbelow.
definecommand{
command_namecheck_nt
command_line$USER1$/check_nt-H$HOSTADDRESS$-p12489-sMy2Secure$Password-v$ARG1$$ARG2$
}
6.VerifyConfigurationandRestartNagios.
Verifythenagiosconfigurationfilesasshownbelow.
[nagios-server]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
TotalWarnings:0
TotalErrors:0
Thingslookokay-Noseriousproblemsweredetectedduringthepre-flightcheck
Restartnagiosasshownbelow.
[nagios-server]#/etc/rc.d/init.d/nagiosstop
Stoppingnagios:.done.
[nagios-server]#/etc/rc.d/init.d/nagiosstart
Startingnagios:done.
VerifythestatusofthevariousservicesrunningontheremotewindowshostfromtheNagioswebUI(http://nagios-server/nagios)asshownbelow.
相关推荐
CentOS配置Nagios监控平台,监控Linux客户端,Windows客户端详细配置,以及如何设置微信报警
nagios监控linux主机、web等各种服务,并实现飞信自动报警
Finally, you will get a deep understanding of SELinux and you will learn how to work with Docker operating-system virtualization and how to monitor your IT infrastructure with Nagios. By the end of ...
利用Nagios监控linuxwindows及飞信报警总结,值得学习
Nagios监控Linux主机(NRPE安装与应用)很少看到的
Linux下Nagios的安装与配置,详细说明开源软件Nagios的部署
Finally, you will get a deep understanding of SELinux and you will learn how to work with Docker operating-system virtualization and how to monitor your IT infrastructure with Nagios. By the end of ...
-Nagios飞信linux短信报警脚本配置.
linux下的nagios网络监视器的安装与部署
nagios监控windows64位插件
This book focuses on the new features of Nagios and will teach readers to secure their systems in a much improved manner. What you will learn from this book : * Understand system monitoring and how...
nagios客户端,windows
NSClient nagios监控windows主机客户端
生成Nagios配置文件 在社交网站上关注我,以获取更多更新和问题 此脚本用于在一分钟内生成Nagios Core配置文件。 有关更多详细信息,请参见下面的URL Nagios课程概述 ...NRPE安装-Linux中的Nagios客户端
nagios 检测磁盘空间
Nagios在Windows下的应用 图文并茂~非常好理解~
本文档详细介绍了nagios监控Windows的配置文档! 从NSClient++软件下载、安装、以及配置文件修改均有介绍,图文并茂哦!
在windows服务器内安装NSClient++的监控引擎
Nagios配置
Monitor-nagios.part2.rar Monitor-nagios.part2.rar