I created an agent action. If I run it through a script or as object tools, everything works correctly. But if I schedule the action, nothing is executed and an event is logged in the log
2024.10.02 16:03:00.033 *D* [action ] Cannot execute scheduled action
- on node [187]: original event is unavailable
2024.10.03 16:03:00.033 *D* [client.session.0 ] Sending message CMD_NOTIFY (48 bytes)
2024.10.03 16:03:00.038 *D* [scheduler ] AdHocScheduler: sleeping for 3600 seconds
How do you schedule action execution?
I used the NetXMS Client, in the Configuration view I created a One time execution scheduled task. I found a post (https://www.netxms.org/forum/general-support/scheduled-task-execute-action/) that address the same problem, but also has no solution, just a workaround.
This is because scheduled task handler Action.Execute is intended for use by EPP rules for delayed action execution, and it requires reference to existing event. Also note that it is for executing server actions (that are configured on server side under Configuration -> Actions), not for executing agent-side actions (which we sometimes calling "agent commands" or "agent predefined commands" to avoid this confusion).
For now the only workaround to execute agent command by scheduler is to use scheduled script as in post that you've mentioned. I will add new scheduled task handler in 5.1 for direct agent command execution from scheduled tasks.
Best regards,
Victor
Hi Victor, thank you for the explanation. I was thinking that when the execution object (node) can be selected, then the action on the agent side can be executed.
Just added new handler type Agent.ExecuteCommand - it will be available in version 5.1.
Best regards,
Victor