Suggestion - Apply template to containers
-
@tomaskir said in Suggestion - Apply template to containers:
This is already entirely possible.
Simply use auto-bind scripts...
Here is an example:parents = GetNodeParents($node); foreach(p : parents) { // if the node has a parent with this name if (p->name == "Something") { // auto-bind node return true; } // otherwise do not auto-bind the node return false;Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I delete something? (I'm talking about deletion by clicking with mouse's right button and then selecting delete, because that's how the operators will probably do it).
If this is possible almost ALL my problems can be resolved by configuring this! ;D -
Hi,
how delete is involved here? I thought that original question was about applying template. Do you need to apply template to all nodes in the system or only some of them?
Best regards,
Victor -
Sorry, sorry, sorry. I mixed my posts and am embarassed now. :-[
@jhuliagraziella said in Suggestion - Apply template to containers:
Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I delete something? (I'm talking about deletion by clicking with mouse's right button and then selecting delete, because that's how the operators will probably do it).
If this is possible almost ALL my problems can be resolved by configuring this! ;DCorrection:
Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I try to apply a template? (I'm talking about applying a template by clicking with mouse's right button and then selecting apply and selecting the nodes I want to apply, because that's how the operators will probably do it).
If this is possible almost ALL my problems can be resolved by configuring this! ;DI organized my node in containers to make it easier to see, but when applying templates this way of organizing really slows my job, because I have to open every container and select just the nodes I want and that way mistakes happen easily: I gotta be careful not to select nodes that shouldn't have the template applied and if I accidentaly select something that isn't a node (like a container) I get the following error:
Cannot apply data collection template: Invalid object ID
Invalid object IDWhat I wanted was: if i tried to apply a template to a container, all container's children nodes that are "aplliable" would be.
-
-
@tomaskir said in Suggestion - Apply template to containers:
As I said before, use auto-bind script on the template.
What you want is already possible, just use the script that I gave you a few posts ago.
It will bind the nodes under the folder to the template during a configuration poll.
I didn't want to use scripts because then an operator would have troubles when trying to change something... And I imagine the changes needed to turn possible what I asked for are not very complicated, but no problem!

Thank you very much for your help! -
@tomaskir said in Suggestion - Apply template to containers:
This is already entirely possible.
Simply use auto-bind scripts...
Here is an example:parents = GetNodeParents($node); foreach(p : parents) { // if the node has a parent with this name if (p->name == "Something") { // auto-bind node return true; } // otherwise do not auto-bind the node return false;I am having a problem with this script. I have copied and pasted it into a template on the Automatic Apply Rules section. I changed "Something" to the name of one of my containers, and when I ran a poll Configuration (full) on one of my nodes that is in that container, the node did not get added to the template.
I noticed that there is an uneven number of "}" and put them in various places with no luck. My guess is I am having a simple syntax issue. Should this script work exactly as posted?
Thanks
-
-
-
Try setting "CheckTrustedNodes" to 0 in Server Configuration and restarting the server.
Here is a Wiki article on the topic:
https://wiki.netxms.org/wiki/SG:Security_Issues -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login