Zabbix combined with bat script to achieve multiple application status monitoring method

Zabbix combined with bat script to achieve multiple application status monitoring method

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)
Step 1 – Prepare the bat script:

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

insert image description here

Click Add to create a template

Then in the check_exe_status template just now, create an automatic discovery rule

insert image description here

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.

insert image description here

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

insert image description here

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

insert image description here

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.

insert image description here

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:
  • Python script implements Zabbix multi-line log monitoring process analysis
  • Use Python script zabbix custom key to monitor oracle connection status
  • How to use python script to implement monitoring report in ZABBIX3.2
  • The implementation principle of Zabbix dynamic execution monitoring collection script

<<:  javascript realizes 10-second countdown for payment

>>:  Solution to nacos not being able to connect to mysql

Recommend

How to use Vue's idea to encapsulate a Storage

Table of contents background Function Purpose Ide...

Installation tutorial of mysql5.7.21 decompression version under win10

Install the unzipped version of Mysql under win10...

Detailed steps for installing, configuring and uninstalling QT5 in Ubuntu 14.04

1. I downloaded QT5.13 version before, but after ...

Summary of MySQL view principles and usage examples

This article summarizes the principles and usage ...

Vue implements small notepad function

This article example shares the specific code of ...

js native waterfall flow plug-in production

This article shares the specific code of the js n...

Win2008 R2 mysql 5.5 zip format mysql installation and configuration

Win2008 R2 zip format mysql installation and conf...

Introduction to encryption of grub boot program in Linux

Table of contents 1. What is grub encryption 2. g...

Vue implements fuzzy query-Mysql database data

Table of contents 1. Demand 2. Implementation 3. ...

How to delete a MySQL table

It is very easy to delete a table in MySQL, but y...

What is a MySQL tablespace?

The topic I want to share with you today is: &quo...

Linux installation MySQL tutorial (binary distribution)

This tutorial shares the detailed steps of instal...