NetXMS Support Forum

Please login or register.

Login with username, password and session length

Author Topic: How to send automatic powershell commands when certain alarms go off.  (Read 76 times)

brawlerbear5

  • Newbie
  • *
  • Posts: 1
    • View Profile

Good Afternoon,

I am new to NetXMS so I am hoping someone can point me in the right direction, I would like to be able to lets say: Server-A has SQL process "a" running. If that process was to unexpected stop, the netxms agent would execute a power-shell command to restart that service as soon as that warning came out.

Thank You for any help in this matter in advance!  :) :) :) :)
Logged

Tursiops

  • Sr. Member
  • ****
  • Posts: 345
    • View Profile
Re: How to send automatic powershell commands when certain alarms go off.
« Reply #1 on: January 30, 2019, 02:46:37 am »

Hi,

If I understand correctly you want to monitor the state of MSSQL services (e.g. different instances) under Windows?

We use instance discovery for that. Agent List with List name System.Services.
An instance discovery filter script picks up any service that starts with "MSSQL$" in the name (excluding SQLEXPRESS) or is called "MSSQLSERVER" (default instance).
To restart the service if it fails, a threshold is triggered if the service is not running.
That threshold generates an event that in turn executes a Server Action via Event Processing Policies.
That action is a script (inside the NetXMS script library).
The script pulls out the service name from the parameters passed to it and executes a pre-configured action on the agent itself which effectively comes down to running "net start <servicename>".

The restart part can obviously be used for any service, not just MSSQL. :)

Hope that helps get you started.

Cheers
Logged