標籤:windows nsclient++ 郵件警示
上節內容實現了使用NRPE+Nagios-plugin外掛程式對遠程Linux伺服器及相關服務的監控,這節將主要介紹如何使用Nagios實現對遠程windows主機的監控配置。
一、被監控端安裝NSClient++
下載NSClinet++:https://nchc.dl.sourceforge.net/project/nscplus/nscplus/NSClient%2B%2B%200.4.1/NSCP-0.4.1.73-x64.msi
被監控的windows主機下載並安裝相關NSClinet++軟體,按照提示進行安裝即可。
並放開NSClinet++的連接埠12489以及添加共用檔案和印表機的預定義策略否則則顯示主機狀態為down,而服務為OK的局面;
二、Nagios監控端配置
[[email protected] objects]# /usr/local/nagios/libexec/check_nt -H 192.168.31.20 -p 12489 -V UPTIMEcheck_nt v2.2.1 (nagios-plugins 2.2.1)[[email protected] ~]# vim /usr/local/nagios/etc/nagios.cfg cfg_file=/usr/local/nagios/etc/objects/windows.cfg ;添加window監控模板[[email protected] objects]# vim windows.cfg define host{ use windows-server ; Inherit default values from a template host_name winserver ; The name we‘re giving to this host alias My Windows Server ; A longer name associated with the host address 192.168.31.20 ; IP address of the host (被監控的windows主機地址) }[[email protected] objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg [[email protected] objects]# service nagios restart
web端監控驗證
三、配置nagios的郵件警示
nagios郵件警示可以直接使用系統內建的sendmail工具進行設定,具體操作如下
[[email protected] objects]# yum -y install sendmail[[email protected] objects]# service sendmail restart[[email protected] objects]# chkconfig sendmail on[[email protected] objects]# vim /usr/local/nagios/etc/objects/contacts.cfg
define contact{ contact_name nagiosadmin ; Short name of user use generic-contact ; Inherit default values from generic-contact template (defined above) alias Nagios Admin ; Full name of user email 52*****[email protected] ; <<***** 設定自己的郵箱地址即可S ****** }
檢查設定檔如果沒有錯誤則重啟nagios服務即可,可通過停止已經監控的某個服務查看能夠否收到郵件,收件匣如果沒有的話可以查看下是否在垃圾箱恢複即可,郵件內容大致如下。
***** Nagios *****Notification Type: PROBLEMHost: winserverState: DOWNAddress: 192.168.31.20Info: (Host Check Timed Out)Date/Time: Mon Nov 6 23:57:42 CST 2017
到此介紹完了nagios服務對windows系統和郵件警示的發送配置
本文出自 “小熊營運” 部落格,請務必保留此出處http://maoxiaoxiong.blog.51cto.com/11705634/1980788
監控之--Nagios監控遠程windows主機及郵件警示功能的配置