icinga2借助check_wmi_plus.pl监控Windows服务器
Windows端:
1、确保services里的Windows Management Instrumentation服务是start的(一般均为start)
2、将账号加入本地的Distributed COM Users、Perfromance Log Users、Performance Monitor Users组
icinga2 服务器端:
check_wmi_plus.pl下载网址:
http://www.edcint.co.nz/checkwmiplus/?q=downloads
将下载下来的check_wmi_plus.v1.60.tar.gz解压,将里面的check_wmi_plus.pl拷到/usr/lib64/nagios/plugins/下,etc目录下的check_wmi_plus拷到服务器的/etc/下
# cp /etc/check_wmi_plus/check_wmi_plus.conf.sample /etc/check_wmi_plus/check_wmi_plus.conf
# vi /etc/check_wmi_plus/check_wmi_plus.conf
$base_dir=‘/etc/check_wmi_plus‘;
$ignore_my_outdated_perl_module_versions=1;
:wq
安装perl模块支持:
# cpan Number::Format
# cpan Config::IniFiles
# cpan YAML
# cpan DateTime
wmic下载网址(需要调用wmic命令):
http://rpm.pbone.net/index.php3/stat/4/idpl/21769667/dir/opensuse/com/wmic-1.3.13-8.1.x86_64.rpm.html
# rpm -i wmic-1.3.13-8.1.x86_64.rpm
直接带用户名、密码方式:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -u zhi.yang@ming.com -p xxxxx -m checkcpu -w 80 -c 90
在文件里写好账号、密码方式:
# vi /etc/check_wmi_plus/wmi.auth
username=zhi.yang
password=xxxx
domain=ming.com
:wq
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkcpu -w 80 -c 90
抓取Windows CPU:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkcpu -w 80 -c 90
抓取Windows diskIO:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkio -s logical -a D:
抓取Windows D盘使用情况:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkdrivesize -w 80 -c 90 -a D:
抓取Windows内存使用情况:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkmem -w 80 -c 90
抓取Windows网络情况(发送和接收,Local Area Connection指本地连接1):
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checknetwork -a ‘Local Area Connection‘
抓取Windows 用户连接数:
# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkts -s sessions
集成到icinga2:
# vi /etc/icinga2/conf.d/templates.conf
object CheckCommand "win-users" {
import "plugin-check-command"
command = [ PluginDir + "/check_wmi_plus.pl" ]
arguments = {
"-H" = "$address$"
"-A" = "$wmiauthdir$"
"-m" = "$mode$"
"-s" = "$sessions$"
}
}
:wq
# vi /etc/icinga2/conf.d/services.conf
apply Service "win_users" {
import "generic-service"
check_command = "win-users"
vars.wmiauthdir="/etc/check_wmi_plus/wmi.auth"
vars.mode="checkts"
vars.sessions="sessions"
vars.perf = true
assign where host.vars.os == "RDBJ"
:wq
# service icinga2 restart
集成到grafana略(生成graph即可)
本文出自 “linux” 博客,请务必保留此出处http://yangzhiming.blog.51cto.com/4849999/1915428
icinga2借助check_wmi_plus.pl监控Windows服务器
原文地址:http://yangzhiming.blog.51cto.com/4849999/1915428