Icinga / Icinga/icinga-powershell-framework
Feature: use dynamic parameters for plugins e.g. "$env:computername"
@LordHepipud is already working on this.
Since Nov 21, 2022.
- Dominant language
- PowerShell
- Stars
- 87
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.