Feature: use dynamic parameters for plugins e.g. "$env:computername"
@LordHepipud ci sta già lavorando.
Dal 21/11/2022.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- PowerShell
- Stelle
- 86
- Fork
- 34
- Merge medio
- 1h 31m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Icinga/icinga-powershell-framework
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
Icinga/icinga-powershell-framework#888 · 1 commento ·
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 70/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Icinga/icinga-powershell-framework#883 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100