Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

How to monitor a service of windows where service name changes on every restart zabbix?

Monitoring a Windows service with a changing name using Zabbix can be complex due to the changing service name. One approach is to use Zabbix’s LLD (Low-Level Discovery) feature along with scripting to dynamically discover and monitor the changing service.

Method – 1

Here’s a step-by-step guide:

Create a PowerShell Script:

Write a PowerShell script that discovers the service name each time it’s executed. The script should output JSON in a specific format that Zabbix understands for LLD.


$services = Get-Service | Where-Object { $_.Status -eq "Running" } | Select-Object -Property DisplayName

$discoveryResult = @()
foreach ($service in $services) {
    $discoveryResult += @{
        "{#SERVICE_NAME}" = $service.DisplayName
    }
}

$discoveryResult | ConvertTo-Json
Code language: PHP (php)

  1. Configure LLD Rule in Zabbix: In Zabbix, create a discovery rule that uses the PowerShell script to discover the running services. Define a LLD rule that processes the JSON output from the script.
  2. Create Item Prototypes: Once services are discovered, you can create item prototypes based on the discovered services. These item prototypes will monitor the status of each service.
  3. Create Trigger Prototypes: Similarly, create trigger prototypes for each item prototype to raise alerts based on the service status.
  4. Configure Host: Set up a Zabbix host for the Windows machine you’re monitoring. Associate the discovery rule and item prototypes with this host.
  5. Schedule Discovery: Configure a schedule for the discovery rule so that Zabbix runs the PowerShell script at regular intervals.

With this setup, Zabbix will dynamically discover the running services and monitor them accordingly, even if the service name changes on every restart.

Method – 2

There are a few ways to monitor a service of Windows where the service name changes on every restart in Zabbix.

One way is to use the service.active item key. The service.active item key returns the name of the service that is currently running. So, if the service name changes, the Zabbix item will also change.

To do this, you can create a Zabbix item that monitors the service using the service.active item key. In the Params field, specify the name of the service that you want to monitor.

You can also create a Zabbix trigger that is based on the service.active item. The trigger will be triggered if the service name changes.

Method -3

Another way to monitor a service of Windows where the service name changes on every restart in Zabbix is to use the service.info item key. The service.info item key returns the current name of the service. So, if the service name changes, the Zabbix item will also change.

To do this, you can create a Zabbix item that monitors the service using the service.info item key. In the Params field, specify the name of the service that you want to monitor.

You can also create a Zabbix trigger that is based on the service.info item. The trigger will be triggered if the service name changes.

Finally, you can also use the service.state item key to monitor a service of Windows where the service name changes on every restart in Zabbix. The service.state item key returns the state of the service as a number. The following values are possible:

  • 0: The service is not running.
  • 1: The service is running.
  • 2: The service is starting.
  • 3: The service is stopping.

You can use the service.state item key to create a Zabbix trigger that monitors the state of the service and generates an alert if the state changes.

Can you use regular expression in service name?

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

What is a GitHub App?

๐Ÿง  What is a GitHub App? A GitHub App is a first-class actor in the GitHub ecosystem. Unlike OAuth apps which act on behalf of a user,…

Read More

Team Foundation Server 2015 Installation Guide (SQL Express + Update 3)

Install Team Foundation Server 2015 using the original Microsoft download paths, with clear guidance for online, offline, and ISO-based setup. This revised guide also includes an installation workflow, command example, and practical pitfalls to avoid.

Read More

How to Access a Running Docker Container Shell: docker exec vs docker attach

Need a shell inside a running container that is already in detached mode? This updated guide shows the correct workflow, compares docker exec and docker attach, and explains when SSH does and does not make sense.

Read More

Host Your Own NuGet Feed: Local Source vs NuGet.Server vs NuGetGallery

Learn how to host a private NuGet feed using three practical approaches: a local folder source, NuGet.Server, and NuGetGallery. This revised guide includes setup steps, command examples, and a workflow diagram to help you choose the right model.

Read More

Publish NuGet Packages to NuGet.org: CLI Steps, Workflow, and CI Example

Learn how to publish a NuGet package to NuGet.org using either nuget.exe or the dotnet CLI. This revised guide includes a workflow diagram, command comparison, and a CI-friendly example.

Read More

How to Create NuGet Packages with nuget.exe (Assembly, .nuspec, and .csproj Methods)

Learn three practical ways to build NuGet packages using nuget.exe: from an existing assembly, from a convention-based folder layout, or directly from a Visual Studio project. This guide includes commands, folder conventions, token behavior, and common pitfalls.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x