Nagios監控Windows Server 2008配置方法_win伺服器

來源:互聯網
上載者:User

1.安裝NSClient++

訪問http://nsclient.org/nscp/下載NSClient++,這裡我使用的是NSClient++-0.3.9-x64的msi安裝包。下載之後直接安裝,過程中會提示輸入Nagios監控伺服器位址和密碼。地址填寫正確,密碼不用設定。Nagios監控伺服器事先在監控Linux伺服器時候已經搭建好,以後再和大家分享。
安裝如下圖所示:

2.配置NSClient++

編輯安裝目錄下的NES.ini檔案,開啟NSClient++的連接埠。方法為找到:
[NSClient]
;port=12489
去掉port前的“;”就可以啟用12489連接埠。

我的是安裝在伺服器的program files下的NSClient++-Win32-0.3.9目錄中。在cmd中執行:
cd C:\Program files\NSClient++-Win32-0.3.5
netstat -an | more
查看12489連接埠是否正常監聽在。
因為安裝時候需要的模組已經勾選了,所以設定檔中不用再作設定。否則可以通過去掉每個模組前的;來啟用該模組。

到這裡即完成了Windows Server 2008上的配置。接下來我們設定Nagios監控伺服器。

3.Nagios監控伺服器設定

vi /usr/local/nagios/etc/nagios.cfg
搜尋找到:
# Definitions for monitoring a Windows machine
# cfg_file=/usr/local/nagios/etc/objects/windows.cfg
將第二行的#去掉開啟Nagios監控的Windows模組,然後儲存。

接著編輯
# vi /usr/local/nagios/etc/objects/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.0.2 ; IP address of the host
}
設定被監控主機名稱和被監控的Windows伺服器位址。

接下來搜尋各種監控的服務並設定:
# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name winserver
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
監控NSClient版本。

# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name winserver
service_description Uptime
check_command check_nt!UPTIME
}

監控伺服器線上時間。

# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name winserver
service_description CPU Load
check_command check_nt!CPULOAD!-l 20,30,50
}

監控伺服器CPU負載。

# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name winserver
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
監控伺服器的記憶體佔用。

# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
use generic-service
host_name winserver
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
監控系統C盤的磁碟佔用。

部署好之後在Nagios中顯示如下:

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.