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
This article mainly introduces the case of Vue en...
Building an image is a very important process in ...
After VMware is abnormally shut down, it prompts ...
Table of contents background Function Purpose Ide...
Install the unzipped version of Mysql under win10...
1. I downloaded QT5.13 version before, but after ...
This article summarizes the principles and usage ...
This article example shares the specific code of ...
This article shares the specific code of the js n...
Win2008 R2 zip format mysql installation and conf...
Table of contents 1. What is grub encryption 2. g...
Table of contents 1. Demand 2. Implementation 3. ...
It is very easy to delete a table in MySQL, but y...
The topic I want to share with you today is: &quo...
This tutorial shares the detailed steps of instal...