NetXMS Support Forum

English Support => General Support => Topic started by: stoffmann on July 13, 2020, 12:13:49 PM

Title: Restart a service if alarm is triggered (service is not down)
Post by: stoffmann on July 13, 2020, 12:13:49 PM
Hello,

I'm monitoring a webservice using NetXMS and want to restart the windows service that's responsible for this webservice, in case of a returnvalue other then HTTP 200.
The monitoring already works fine and I get notified when the returnvalue is different to 200.
The service itself is running when I check it, but it delivers no results anymore.
So I restart in manually at the moment to fix this.

How can I make NetXMS do the net stop/net start commands?

Best regards

Stefan
Title: Re: Restart a service if alarm is triggered (service is not down)
Post by: Victor Kirhenshtein on July 14, 2020, 02:42:26 PM
Hi,

you can define action in agent configuration file on that machine:


ActionShellExec = RestartService:net stop svcname && net start svcname


(I'm not sure if command is actually correct, but you should get an idea).

then define server side action of type "execute command on remote node", enter RestartService as command name, and add this new action in EPP to be executed on web service error event.

Best regards,
Victor
Title: Re: Restart a service if alarm is triggered (service is not down)
Post by: rainerh on August 23, 2022, 04:59:40 PM
Hello,
i want to watch a service called FileWaveWinClient.
The Alarm works fine, but the Server action does not work.

In agent´s config file I added this line:
ActionShellExec = StartFileWaveService:"C:\Windows\system32\net.exe" start FileWaveWinClient

I tried also:
ActionShellExec = StartFileWaveService:net start FileWaveWinClient

In Actions Configuration I added
Name: Start_FileWaveWinClient_Service
Type: Execute command on remote node via agent
Remote host <empty>
Agents´s action: StartFileWaveService
(See attachment "Action Configuration.png")

I create a Event Processing Policy
Events: ... Process not running
Alarm - this configuration works fine. The Alarm is working
Server Actions: Start_FileWaveWinClient_Service - does not work
(See attachment "Event Processing Policy.png")

The Alarm works fine, but the Server action does not work.

Thank you
Rainer
Title: Re: Restart a service if alarm is triggered (service is not down)
Post by: Victor Kirhenshtein on September 05, 2022, 09:54:52 AM
You should put either %a (to use IP address) or #%i (to refer to current node by ID) in "remote host" field.

Best regards,
Victor