News:

We really need your input in this questionnaire

Main Menu

Using script for DCI parameter

Started by adimitrov, June 26, 2017, 10:12:33 AM

Previous topic - Next topic

adimitrov

Hello Team,

I am using external parameter for DCI and script for custom attribute.

Now i am trying to use the custom attribute and node_ip variables in my templates, so i won't have to give the parameters on each DCI manually.

I am trying the following:

RStatus(%{script:CustomAttributeSetScript}, %{node_primary_ip})

The admin guide says that i cannot use the custom variable directly and i must get it from the script with syntax as above. Unfortunately this is the part i am failing on.

Any advice on what is wrong with my syntax will be highly appreciated.

Best Regards,
Adrian

Tursiops

Hi Adrian,

I set something similar up a while ago: a DCI assigned via template using a script to fetch the custom attribute I needed.

And I think that's part of your issue: The script is not interpreted "live" every time the DCI is called - it is only interpreted when it is applied via a template.
Once applied, the actual DCI parameter on your node will then no longer reference the script, but will contain the value that the custom attribute had at the time the template was assigned. Changing the custom attribute later on, no longer changes the DCI parameter. In other words, the potential flexibility of changing a DCI parameter "on the fly" isn't really there.

I have not tested if this is still true with the latest version, but that's how it worked back when I had a go at it. If that's still the case, it's probably worth checking if there is an open feature request.

Cheers

adimitrov

Hello Tursiops, team,

Thanks for the input mate. I saw your old post and tried this, unfortunately it is still not working even if i re-apply it on the device from the template.

Here is how it looks on the device itself:

RStatus(, 172.20.4.254)

So it is either not cool with my syntax or something else that i am missing. I am pretty sure the script is working as i am using it in another configurations.

As regards to changing the parameter "on the fly" It will be a nice feature, but in my case it would not be needed.

If you have any further advice i will be glad to hear.

Best regards,
Adrian

Tursiops

Hi Adrian,

Your result being RStatus(, 172.20.4.254) makes it look like the script is not returning any result or you have a typo in the script name.

I dug out the old script/DCI I used and confirmed this still works:
Script Name: Attribute::Get::VeeamGuestName
Script: return VeeamGuestName@$node;
DCI Parameter: Software.Veeam.BackupStatus('%{script:Attribute::Get::VeeamGuestName}','Backup','Status')

That results in the actual DCI on nodes matching the template to look like this (with ATTRIBUTE being the content of the custom attribute):
Software.Veeam.BackupStatus('ATTRIBUTE','Backup','Status')

Hope that helps somewhat.

Cheers

adimitrov

Hello Tursiops, team,

You made me think about it and i suppose you are right, in the script we are setting the value of the custom attribute, but doesn't "return" a value. Maybe this is the issue. This is not my script and since it is working I assumed the fault is not in it. Unfortunately i will not have time to check this today, but i am pretty sure you solved my issue. I will update when it is done!

Thanks very much for the time spent and the help!

Best regards,
Adrian

adimitrov

Hey Tursiops,

As expected putting "return" statement in the script solved my issue. It is working like a charm now.

Again, thanks for the help!

Wish you all the best.