windows下监控特定进程数量并通过钉钉告警
windows
以下脚本实现通过再windows下检测指定进程数量,如果超过指定数量并通过钉钉告警,如下:
脚本
@echo off
tasklist | find /C "chrome.exe" > D:\temp.txt
set /p num= < D:\temp.txt
set cnum=10
if %num% geq %cnum% (
curl -H "Content-Type: application/json" -d "{'msgtype':'text','text': {'content':'VPN Test 1'}}" -s "https://oapi.dingtalk.com/robot/send?access_token=xxxx"
)
del /F D:\temp.txt
计划任务
通过添加计划任务来实现每分钟检测一次,并实现内容告警
如何添加计划任务请参考:https://www.cnblogs.com/amylis_chen/archive/2012/07/14/2591492.html