Restart a service if alarm is triggered (service is not down)

Started by stoffmann, July 13, 2020, 12:13:49 PM

Previous topic - Next topic

stoffmann

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

Victor Kirhenshtein

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

rainerh

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

Victor Kirhenshtein

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