NetXMS Support Forum

English Support => General Support => Topic started by: Beda on January 29, 2015, 01:21:44 PM

Title: Object Tools for Conditions
Post by: Beda on January 29, 2015, 01:21:44 PM
Hello,
first, thank you for your great software and continuous development and support.

Maybe this should be a feature request, but I'm not sure that I don't miss already existing way how to do what I want, so I've chosen a General Support section. What I want to achieve is this:

In a Network Map I would want to represent an abstract device whose state is computed from more physical (and virtual) machines by a SNMP polling. I would want to represent the device by 1 icon (i.e. by 1 object), hence a Condition seems to be the right object for me so far.
But I would also want to be able to call a predefined Object Tool (on a predefined Node) from a right-click pop-up menu of the icon in the Map, which forces me to use an object of type Node instead of the Condition.

So far I've used a hack of the management console (I modified its sources), so I'm able to "chain" a Condition with a Node using the Condition's Custom Attribute with the ID of the Node. My modified console then displays a Tools item in a pop-up menu of the Condition. But I think that this modification does not correspond with an intended use of Condition objects, so I would want to ask:
Title: Re: Object Tools for Conditions
Post by: Victor Kirhenshtein on January 29, 2015, 01:36:27 PM
Hi!

If it is not relevant on what exact node you are calling object tool (server command for example), you can create new node with no IP address and use DCI to set it's status.

Best regards,
Victor
Title: Re: Object Tools for Conditions
Post by: Beda on January 30, 2015, 11:22:06 AM
Thank you for your immediate response.

Unfortunately, in my case it is important on which node the Tool is called, because it is a SNMP table tool.

The Condition has an advantage of being able to compute its status based on values from multiple objects, which I need.
But I'd also want to display predefined Object Tool on a predefined node in a pop-up menu of the condition.

The first solution which came on my mind is adding 2 optional parameters to each Object Tool:
Tools without these parameters would work as today.
Do you think this solution could be consistent with current concept of the NetXMS?
Could this be achieved in a less complicated way?
Title: Re: Object Tools for Conditions
Post by: tomaskir on January 30, 2015, 12:03:42 PM
You can do all you need to do already on a node object.
Use what Victor said and:

1) Create a NXSL script that calculates the object status as needed.
- NXSL scripts can calculate whatever based on any number of inputs from other nodes, etc...
2) Create a script DCI and deduce node status from the status of this script DCI.
- Victor described this

Tools already support all you need in multiple ways:

1) create a tool that is hard-coded with all details you need.
- filter this tool for the node object you created above
2) Use custom attributes in the tool which would specify what is executed and how
- assign needed attributes to the node object you created above

etc...
Title: Re: Object Tools for Conditions
Post by: Beda on February 02, 2015, 01:11:42 PM
Thank you, you helped me a lot.
The first part is clear, now I am able to set a status of the node based on other nodes.
But I'm afraid that I don't fully understand the second part. How can I hard-code a target node to the Object Tool?
Title: Re: Object Tools for Conditions
Post by: tomaskir on February 02, 2015, 01:54:02 PM
Example, a ping "Local Command" tool:

Normally you would use this as command:
ping %OBJECT_IP_ADDR%

But nothing is stopping you from creating a hard-coded command like this:
ping 1.2.3.4

Or using node's custom attributs like this:
ping %CUSTOM_ATTR_NAME%

You can then set custom attributes on the node as needed... even modify those from within NXSL scripts, so the tool does a different thing under different node statuses... etc...

See this:
https://www.netxms.org/documentation/adminguide/objects.html#object-tools
Look into the "Macro Substitution" section, particularly the last sentance.
Title: Re: Object Tools for Conditions
Post by: Beda on February 02, 2015, 02:56:56 PM
OK, this looks like a very powerful tool.
Unfortunately I'd want to create a SNMP Table tool which (according to the admin-guide) doesn't support neither macro substitution nor setting a target IP.
And without the target IP setting I can't predefine a SNMP Table tool which is independent on IP of the selected node.