Forum Discussion

R_P's avatar
7 years ago

Use of per collector http proxy settings for PropertySource scripts using Groovy HTTP helper methods.

I have created a Groovy script based PropertySource, that uses a REST call to contact an external site using the included HTTP helper methods in order to fill some information fields. This works fine in itself.

The issue I have is the need to set the proxy details on the object after it is instantiated in the script.

As far as I know, the collector properties/settings are not exposed in any way to a scripted PropertySource, despite the script running locally on the collector. Nor does the HTTP connection use the existing proxy as set on the collector.

Unless I am missing something, it seems exceptionally convoluted to get those details, and then propagate them into property fields for all devices on that collector. to then be able to reference them properly inside the script.

Is there any way to call the equivalent of getHostProps(), but for the collector properties? This would also be useful in cases of say, independent customer sites that use separate API keys for the same script.

1 Reply

Replies have been turned off for this discussion
  • 25 minutes ago, R_P said:

    I have created a Groovy script based PropertySource, that uses a REST call to contact an external site using the included HTTP helper methods in order to fill some information fields. This works fine in itself.

    The issue I have is the need to set the proxy details on the object after it is instantiated in the script.

    As far as I know, the collector properties/settings are not exposed in any way to a scripted PropertySource, despite the script running locally on the collector. Nor does the HTTP connection use the existing proxy as set on the collector.

    Unless I am missing something, it seems exceptionally convoluted to get those details, and then propagate them into property fields for all devices on that collector. to then be able to reference them properly inside the script.

    Is there any way to call the equivalent of getHostProps(), but for the collector properties? This would also be useful in cases of say, independent customer sites that use separate API keys for the same script.

     

    I did however find a workaround, but it involves reading in the agent.conf from the local filesystem on the collector itself to get the proxy information , not ideal but works for testing.