Recently responsible for monitoring the deployment of Zabbix, need to complete the local server to monitor the running status of remote virtual machine (CPU, open process, etc.), share with you my implementation method.
(1) First, the batch processing of the process that records the Zabbix client needs to be realized: zabbix_task.bat;
Zabbix_task.bat content is as follows:
@echo off
Chcp 65001
tasklist/v |findstr "%username%" > C:/zabbix_temp.txt #进程路径根据个人习惯设置
Pause
(2) Second, the implementation of real-time monitoring the remote Process batch processing, using the VBS script call script 1 to implement a timed refresh process, the script named: Zabbix_monitor.vbs
Local computer remotely Create a remote computer's scheduled task program (when each login automatically run script zabbix_monitor.vbs), real-time monitoring of the computer process
Zabbix_monitor.vbs content is as follows:
Set ws = CreateObject ("Wscript.Shell")
Do
Ws.run Left (Wscritp.scritpfullname,instrrev (WScript. ScriptFullName, "\")-1) & "\zabbix_task.bat", vbhide
Wscript.Sleep 5000
Loop
(3) Finally, implement filtering filtering Zabbix the process script that the server needs to monitor: Zabbix_tasklist.bat
@echo off
Setlocal enabledelayedexpansion
Chcp 65001
echo {
echo "Data": [
for/f "tokens = 9*"%%i in (C:\zabbix_temp.txt)
Do
Set "Str=%%j"
Set "str=!str:\=\\!"
If "!str!" = = "!STR: N/a =!" "If"!str! " = = "!str:wnd=! "If"!str! " = = "!str:n/a=! "If"!str! " = = "!str:mci=! "If"!str! " = = "!str:dwn=! "If"!str! " = = "!str:taskeng=! "If"!str! " = = "!str:ksafetray=! "If"!str! " = = "!str:6ebf21d6ba1f=! "If"!str! " = = "!str:jusched=! "If"!str! " = = "!str:hwuvpupgrade=! "If"!str! " = = "!str:spes=! "If"!str! " = = "!str:windows update=! "If"!str! " = = "!str:cmd.exe=! "If"!str! " = = "!str:sysfader=! "
echo {"{#TASK_NAME}": "!str!"},
)
echo {"{#TASK_NAME}": "NULL"}
Echo
Echo
}
PS: Local Computer access remote PC to create a scheduled task program, you can use the batch Schtask command to complete access to the remote computer
Windows Zabbix Monitoring remote process Implementation mechanism