Scenario simulation: Some domestic companies need to run certain window programs (ie. .exe) to support important business operations. Once these important window programs are interrupted, it will cause huge economic losses or affect work efficiency, and the consequences are so serious. Therefore, I want to monitor the status of multiple programs through Zabbix. Once these important window programs are interrupted, an alarm will be generated to notify the operation and maintenance personnel to repair them. Prepare two bat scripts in advance, finde.bat (make the exe program to be monitored automatically discovered), check_exe_status.bat (get the status of the monitored exe program) The contents of the findexe.bat script are as follows @echo off setlocal enabledelayedexpansion set /an=0 set /a n1=0 for %%i in (%*) do (set /a n+=1) @echo {"data":[ for %%a in (%*) do ( set /a n1+=1 @echo {"{#SERVERNAME}":"%%a" if !n1! neq !n! ( @echo }, ) else ( @echo } ) ) echo ]} The contents of the check_exe_status.bat script are as follows @echo off tasklist|findstr ^%1 >/NUL 2>&1 if %errorlevel% == 0 ( echo "running" ) else ( echo "norunning" ) Note that tasklist|findstr ^%1 >/NUL 2>&1 is used to check whether the monitoring program exe is running. Step 2 – Create a monitoring template Click Add to create a template Then in the check_exe_status template just now, create an automatic discovery rule The key value in the figure is findexe. The parameters in the key value are the multiple processes that the customer wants to monitor, enclosed in double quotes and separated by spaces. findexe[“firefox.exe chrome.exe xxxlll.exe”] If there are other exe programs to monitor, just separate them with spaces and fill in the blanks. Then, under this automatic discovery rule, create a new monitoring item prototype. The value of {#SERVERNAME} in the prototype is fixed and defined in the first step of findexe.bat. Step 3 – Configure custom keys in zabbix_agent.conf Customize the script path, and the custom key value must be consistent with the template name Restart zabbix_agent Step 4 – Verify multiple exe program status Three exe program names are automatically discovered, among which xxxll.exe is a non-existent exe. To verify the effect, now close the firefox.exe program and see if its latest data will be displayed as norunning. Verification successful. This is the end of this article about how to use Zabbix combined with bat scripts to monitor the status of multiple applications. For more information about Zabbix combined with bat scripts, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: javascript realizes 10-second countdown for payment
>>: Solution to nacos not being able to connect to mysql
1. In Windows system, many software installations...
Traceroute allows us to know the path that inform...
1. Display effect: 2, html structure <div clas...
1. When to execute setUp We all know that vue3 ca...
question CSS fixed positioning position:fixed is ...
Definition of Float Sets the element out of the n...
Use ktl tool to synchronize data from mysql to my...
<br />Before browsers can handle the next ge...
The paging effect is implemented in the vue proje...
Table of contents Slow query basics: optimizing d...
The centos8 distribution is released through the ...
Take MySQL 5.7.19 installation as an example, fir...
Table of contents 1. Download MySQL 2. Unzip the ...
First, let's introduce several common operati...
Why is the title of the article “Imitation Magnif...