1. Home
  2. Knowledge Base
  3. Getting Started & How to (EN)
  4. How can I start/stop a Windows service/process through a Software Agent?

How can I start/stop a Windows service/process through a Software Agent?

To be able to raise a service/process in Windows® from the Pandora FMS server you will have to have a Software Agent installed in the machine.

For it, once installed, you will have to monitor the service/process and depending on the execution to be done, you will have to generate a script or directly through a special configuration of the agent.

1.- Stop a service/process.

We will have to generate a Data server module in order to obtain information about the process/service to be executed and, inside this monitoring, to put a jump condition through which a script that stops the service/process will be executed. The following example would be to obtain the output of a script, and if the output is less than 20, a second script would be executed:

module_begin
module_name CPU_Usage_Condition
module_type generic_data
module_exec "C:\scripts\script.bat"
module_condition < 20 "C:\scripts\script2.bat"
module_end

2.- Lifting a service/process.

In addition to the previous option, there is the Windows® watchdog service, where you can monitor whether the service/process has been down and the software agent itself will try to raise the service in question. The following example would be to monitor the Windows® Schedule service:

module_begin
module_name ServiceSched
module_type generic_proc
module_service Schedule
module_description Service Task scheduler
module_async yes
module_watchdog yes
module_end
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support