watch service and start automatically

Started by rainerh, August 24, 2022, 10:00:10 AM

Previous topic - Next topic

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

Filipp Sudanov

In action properties you need to specify hostname/ip address of the machine where your netxms agent is running. This is made so for greater flexibility, as event may be coming from one node, but you might need to execute the action on another system, for example.

You can use %a macro in "Remote host" field - in this case IP address of node where the event is coming from will be used.

rainerh

Thank you very much  :) :D
No it works fine

I have the problem to add this line to agent config file

ActionShellExec = StartFileWaveService:"C:\Windows\system32\net.exe" start FileWaveWinClient

To all of my clients.
Only to add, not to send each client the same config file

Please help and thank you so much
Rainer

Filipp Sudanov

Have a look at "Agent policies" in templates. One of the option is "Agent configuration" policy, where you can specify agent config lines. When template is added to a node, these config lines will be sent to agent and will start working after agent restart.

rainerh

I have made a Template with automatic bind to all clients with running service I need (FileWaveWinClient)
In this Template I choose Agent Policies and created a new "Agent Configuration" policy called StartFileWaveClientService
I only inserted this (1) line:
ActionShellExec = StartFileWaveService:"C:\Windows\system32\net.exe" start FileWaveWinClient
(see AgentPolicy.png)
For test I removed 2 clients and poll "Automatic bind"
The 2 (test) clients added automatically to this Template

Until now every thing works perfect - thank you

But the agent config file at the new clients is not modified and the line I need is not in agent´s config file
I waited a long time

Thank you
Rainer


Filipp Sudanov

Yes, I did not mention this - config policies are not actually modifying the main agent config file. Each policy confiig is kept in a separate file in config_ap under agent's DataDirectory (by default C:\Windows\System32\ config\systemprofile\ AppData\Local\nxagentd on windows). When agent starts it reads these files. In recent agent versions it dumps actual configuration into it's log file, so your line should be visible there.

rainerh

I was looking for a bug that isn't a bug at all. The system is already working fine. I just thought that this line is added after agent restart. You can check the success quite simply by reading out the "Supported actions" on the client, and the desired one is there

Many many Thanks for this perfect support
Rainer  :D :D :D :D :D