News:

We really need your input in this questionnaire

Main Menu

Action

Started by pouya.moradian, October 11, 2015, 04:42:02 PM

Previous topic - Next topic

pouya.moradian

Hi,

Is there any way to get data from action ?
Is there any way to pass argument to action functions?
There is a Boolean return value for each action function in java sub agent, what is it for?
And also there is some parameter (String action, String[] args) what is it for?

with best regards
Pouya

Victor Kirhenshtein

Hi,

no you cannot get data from action. You can pass arguments to action - in server configuration you specify them separated by spaces (like in normal command line). When action is called, String[] args will contain those arguments. Boolean return value is to indicate if action was executed successfully.

Best regards,
Victor

pouya.moradian

Hi,

Thanks for your reply,

I defined action in object tool, is it right? because i saw an action configuration in configuration menu strip.
Also i used {DeviceActionName arg1 arg2} in agent's command field in object tool but on execute i got : Cannot execute action on node {NodeName}: Communication failure

With Best Regards
Pouya

Victor Kirhenshtein

Hi,

did you define action correctly in subagent? Can you show code registering your action?

Best regards,
Victor

pouya.moradian

#4
Hi,

Here is my action code in some class that extends the Plugin, the other part of code are same as the sample code in  ..\netxms-snapshot-develop\src\agent\subagents\java\sample\
All of my parameters and  actions work fine in this class but passing parameter to actions is not possible and the action.txt file only contain "Action has been executed" !

Thanks

Victor Kirhenshtein

Code seems to be correct. Try to check with nxget that action was registered:

nxget -l agent_ip_addr Agent.ActionList

Also, make sure you are using correct action name in object tool. You can also execute agent action from command line using nxaction command.

Best regards,
Victor

pouya.moradian

The Action is already registered (as it name appear in node's supported action list),
but there is no nxaction binary fine in ..\NetXMS\bin in client side !
I'm using 2.0 RC 1 agent.

With best regards,
Pouya

Victor Kirhenshtein

Hi,

nxaction is a server side tool.

Best regards,
Victor

pouya.moradian

#8
Hi

You're right that's server side, And i can see my action is registered here !


[root@netxmslinux bin]# nxget -l 192.168.11.84 Agent.ActionList
Agent.Restart 2 "CORE"
System.Restart 2 "WinNT"
System.Shutdown 2 "WinNT"
DeviceLogAction 2 "JAVA"

Each time i use nxaction some error occur : Required argument(s) missing.
Can i have some example for using nxaction ?

My command is :
nxaction DeviceLogAction -a 'none' -e 0 -K /usr/local/var/lib/netxms/.server_key -p 4700 -w 5 -W 30

I Also tried to check each one of these option by removing them,
and it does not work.

Thanks for your reply,
Pouya

Victor Kirhenshtein

You have to specify agent address in command line as well (before action name).

Best regards,
Victor

pouya.moradian

Hi

Thanks a lot, it works fine.
the full format of action execution command is like:

nxaction NodeIP ActionName ParameterHere  -a 'none' -e 0 -K /usr/local/var//lib/netxms/.server_key -p 4700 -w 10 -W 30

it may help someone else.