国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Win服務器 > 正文

怎么用Nagios監(jiān)測Windows服務器?

2024-09-10 00:01:47
字體:
來源:轉載
供稿:網(wǎng)友
  監(jiān)控主機配置:redhatlinuxas4,nagios3
  被監(jiān)控主機:WindowsServer2008R2Enterprise,nsclient++0.4.4.172
  Nagios是一款開源的免費網(wǎng)絡監(jiān)視工具,其功能強大,靈活性強。能有效監(jiān)控Windows、Linux和Unix的主機狀態(tài),交換機路由器等網(wǎng)絡設置,打印機等。nagios監(jiān)控windows系統(tǒng)有三種實現(xiàn)方式:SNMP、NSClient++、NRPE。
  下面介紹使用NSClient++方式來監(jiān)控Windows:
在windows下安裝nsclient++,運行NSCP-0.4.0.172-x64.msi安裝文件,一步一步往下走,其中需要設置nagios監(jiān)控主機IP和NSClient密碼(值當使用check_nt時使用)。
Allowed hosts:填寫nagios監(jiān)控主機IP。
NSClient Password:當使用命令check_nt時需要設置密碼,根據(jù)自己情況設置。
Module to load:根據(jù)自己的需要選擇相應的模塊。
安裝完畢以后,打開windows服務管理器,查看nsclient服務是否啟動,然后在nagios監(jiān)控主機上面進行相關的配置,主要涉及兩個配置文件nagios.cfg和windows.cfg。
1、 因為nagios是模塊化調用,先到配置文件打開windows相關模塊,編輯nagios.cfg文件:
  [root@localhostetc]#ls
  cgi.cfghtpasswdnagios.cfgnrpe.cfgobjectsobjects.bakobjects.tarresource.cfg
  [root@localhostetc]#pwd
  /usr/local/nagios/etc
  [root@localhostetc]#vinagios.cfg
  將#cfg_file=/usr/local/nagios/etc/objects/windows.cfg該行前面的#注釋去掉即可。
 
2、修改windows.cfg配置文件,需要修改define host和define service兩部分:
  #DefineahostfortheWindowsmachinewe'llbemonitoring
  #Changethehost_name,alias,andaddresstofityoursituation
  definehost
  {usewindows-server;Inheritdefaultvaluesfromatemplate
  host_namevideo4-beijing;Thenamewe'regivingtothishost被監(jiān)控主機的主機名
  aliasvideo4-beijing;Alongernameassociatedwiththehost
  contact_groupssa;
  address10.12.4.169;IPaddressofthehost被監(jiān)控主機的IP}
  #CreateaserviceformonitoringCPUload
  #Changethehost_nametomatchthenameofthehostyoudefinedabove
  defineservice
  {usegeneric-service
  host_namevideo4-beijing
  service_descriptionCPULoad
  check_commandcheck_nt!CPULOAD!-l5,80,90
  contact_groupssa}
  #Createaserviceformonitoring
  #Changethehost_nametomatchthenameofthehostyoudefinedabove
  defineservice
  {usegeneric-service
  host_namevideo4-beijing
  service_descriptionMemoryUsage
  check_commandcheck_nt!MEMUSE!-w80-c90
  contact_groupssa}
  #CreateaserviceformonitoringC:/diskusage
  #Changethehost_nametomatchthenameofthehostyoudefinedabove
  defineservice
  {usegeneric-service
  host_namevideo4-beijing
  service_descriptionC:/DriveSpace
  check_commandcheck_nt!USEDDISKSPACE!-lc-w80-c90
  contact_groupssa}
 
3、修改完相關的配置文件以后,執(zhí)行如下命令檢查配置文件是否正確:
  [root@localhostobjects]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
 
4、遇到的問題,在檢查配置文件時錯誤信息如下:
  Checkingservices...
  Error:Contactgroup'admins'specifiedinservice'C:/DriveSpace'forhost'video4-beijing'isnotdefinedanywhere!
  Error:Contactgroup'admins'specifiedinservice'Explorer'forhost'video4-beijing'isnotdefinedanywhere!
  Error:Contactgroup'admins'specifiedinservice'MemoryUsage'forhost'video4-beijing'isnotdefinedanywhere!
  Checked14services.
  Checkinghosts...
  Error:Contactgroup'admins'specifiedinhost'video4-beijing'isnotdefinedanywhere!
  Checked7hosts.
  Checkinghostgroups...
  Checked2hostgroups.
  Checkingservicegroups...
  Checked0servicegroups.
  Checkingcontacts...
  Checked1contacts.
  Checkingcontactgroups...
  Checked1contactgroups.
  Checkingserviceescalations...
  Checked0serviceescalations.
  Checkingservicedependencies...
  Checked0servicedependencies.
  Checkinghostescalations...
  Checked0hostescalations.
  Checkinghostdependencies...
  Checked0hostdependencies.
  Checkingcommands...
  Checked25commands.
  Checkingtimeperiods...
  Checked5timeperiods.
  Checkingforcircularpathsbetweenhosts...
  Checkingforcircularhostandservicedependencies...
  Checkingglobaleventhandlers...
  Checkingobsessivecompulsiveprocessorcommands...
  Checkingmiscsettings...
  TotalWarnings:0
  TotalErrors:4
  ***>Oneormoreproblemswasencounteredwhilerunningthepre-flightcheck...
  Checkyourconfigurationfile(s)toensurethattheycontainvalid
  directivesanddatadefintions.Ifyouareupgradingfromaprevious
  versionofNagios,youshouldbeawarethatsomevariables/definitions
  mayhavebeenremovedormodifiedinthisversion.Makesuretoread
  theHTMLdocumentationregardingtheconfigfiles,aswellasthe
  'WhatsNew'sectiontofindoutwhathaschanged.
  以上問題的原因是因為一開始在windows.cfg文件中定義host和service時沒有增加contact_groupssa這個字段,host和service默認所在的contact_group為admins,而我的nagios監(jiān)控主機contacts.cfg文件中配置的contactgroup為sa。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 久治县| 岳普湖县| 海南省| 湘潭县| 沙田区| 珠海市| 临西县| 正蓝旗| 余庆县| 福安市| 屏南县| 藁城市| 上林县| 江阴市| 洛扎县| 定州市| 米脂县| 汉源县| 绍兴市| 铁力市| 微博| 竹北市| 紫阳县| 广平县| 罗山县| 辽阳县| 萨嘎县| 建德市| 醴陵市| 西昌市| 罗田县| 淳化县| 新晃| 翼城县| 黄骅市| 河池市| 延边| 于都县| 唐山市| 永城市| 和静县|