Skip to content

Feature: use dynamic parameters for plugins e.g. "$env:computername" #580

Description

@tectumopticum

Expected Behavior

When using the "Invoke-IcingaCheckHTTPStatus"-plugin I'd like to fill the "-Url"-parameter dynamically, e.g. with the name of the host on which the plugin is executed. So something like
Invoke-IcingaCheckHTTPStatus -Url http://$($env:computername):0815/config/v1/status
should be expanded to
Invoke-IcingaCheckHTTPStatus -Url http://local_examplehost:0815/config/v1/status

Another idea is using timestamps, e.g.
Invoke-IcingaCheckHTTPStatus -Url http://local_examplehost:0815/config/v1/event_log?start=(Get-Date).AddMinutes(-5).ToString("yyy-mm-ddTHH:mm:ss")&end=(Get-Date).ToString("yyy-mm-ddTHH:mm:ss")
which should resolve the current date/time as end-parameter and looks back for 5 minutes as the start-parameter in the Url.
Invoke-IcingaCheckHTTPStatus -Url http://local_examplehost:0815/config/v1/event_log?start=2022-07-04T13:25:00&end=2022-07-04T13:30:00

Current Behavior

after configuring this in Director with http://$$($$env:computername):57412/config/v1/status , it doesn't work, because the config-data from Director is rendered with single-quotes around all parameters:

HTTP Status Code: Cannot bind parameter 'Uri'. Cannot convert value "[http://$($env:computername):57412/config/v1/status] to type "System.Uri". Error: "Invalid URI: The hostname could not be parsed."

Possible Solution

I have in mind that it might be a security-risk if any command will be executed by expansion. I don't have a simple solution for that.

Context

  • such a feature could be helpful when each plugin-call needs a changed parameter. Best example is a webservice or api where you query data by timestamp

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions