icinga2借助check_wmi_plus.pl监控Windows服务器

简介:

icinga2借助check_wmi_plus.pl监控Windows服务器



Windows端:


1、确保services里的Windows Management Instrumentation服务是start的(一般均为start)

2、将账号加入本地的Distributed COM Users、Perfromance Log Users、Performance Monitor Users组

3、固定WMI端口为TCP 24158步骤(默认是不固定的),TCP 135(RPC端口)也要开:


以管理员身份运行cmd——net stop winmgmt /y——winmgmt /standalonehost——net start winmgmt——net stop winmgmt——net start winmgmt


Windows 2003不能固定WMI的端口,Windows 2008及以上才可以,默认为1024-65535之间随机




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


抓取Windows 2003系统用户连接数:

# /usr/lib64/nagios/plugins/check_wmi_plus.pl -H 10.0.0.3 -A /etc/check_wmi_plus/wmi.auth -m checkts -s sessions2003




集成到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博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/1915428如需转载请自行联系原作者

yangzhimingg
相关文章
|
1月前
|
弹性计算 监控 数据可视化
ecs自定义监控
ecs自定义监控
22 1
|
1月前
|
Arthas 弹性计算 运维
阿里云ECS监控服务
阿里云ECS监控服务
401 2
|
25天前
|
弹性计算 运维 监控
ECS资源监控
ECS资源监控涉及CPU、内存、磁盘I/O、网络流量、系统负载和进程的关键指标,通过云服务商控制台、监控服务、API与SDK、运维工具进行实时监控和告警设置。支持历史数据查询、事件监控,以及使用Windows资源监视器和Linux系统工具进行操作系统层面监控。全面监控确保ECS实例稳定运行、资源有效利用和问题及时处理。如需特定云服务商的指导,请询问。
28 3
|
22天前
|
Shell Windows
Windows服务器 开机自启动服务
Windows服务器 开机自启动服务
13 0
|
28天前
|
弹性计算 运维 监控
ecs监控与评估
阿里云ECS提供全面的监控与评估解决方案,包括云监控服务(实时资源指标、告警)、ECS实例详情页(运行状态查看)、资源负载评估(综合性能得分)、ECS Insight(多维度分析)、报警配置、流量管理优化(负载均衡、CDN)。这些工具帮助用户有效管理资源、识别潜在风险、优化性能,确保云服务稳定高效。
17 1
|
29天前
|
Linux 数据安全/隐私保护 Docker
linux和windows中安装emqx消息服务器
linux和windows中安装emqx消息服务器
27 0
|
1月前
|
监控 JavaScript 安全
监控内网电脑软件设计与实现:基于Node.js的服务器端架构分析
在当今信息技术高度发达的时代,监控内网电脑的需求日益增长。企业需要确保网络安全,个人用户也需要监控家庭网络以保护隐私和安全。本文将介绍一种基于Node.js的服务器端架构,用于设计和实现监控内网电脑软件。
90 0
|
1月前
|
存储 Windows
windows server 2019 云服务器看不见硬盘的解决方案
windows server 2019 云服务器看不见硬盘的解决方案
|
25天前
|
Ubuntu JavaScript 关系型数据库
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
在阿里云Ubuntu 20.04服务器上部署Ghost博客的步骤包括创建新用户、安装Nginx、MySQL和Node.js 18.x。首先,通过`adduser`命令创建非root用户,然后安装Nginx和MySQL。接着,设置Node.js环境,下载Nodesource GPG密钥并安装Node.js 18.x。之后,使用`npm`安装Ghost-CLI,创建Ghost安装目录并进行安装。配置过程中需提供博客URL、数据库连接信息等。最后,测试访问前台首页和后台管理页面。确保DNS设置正确,并根据提示完成Ghost博客的配置。
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
|
28天前
|
存储 弹性计算 数据可视化
要将ECS中的文件直接传输到阿里云网盘与相册(
【2月更文挑战第31天】要将ECS中的文件直接传输到阿里云网盘与相册(
415 4

热门文章

最新文章