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

posted @ 2020-12-01 17:10  quicksand.F  阅读(350)  评论(0编辑  收藏  举报