-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-IcingaCheckCommandConfig: provide vars.ifw_api_arguments in each command #633
Conversation
…command to properly support just importing the ifw-api command. That command e.g. takes DSL/JSON arrays [], not PS ones @(). Similar with strings. Therefore set vars.ifw_api_arguments as ifw-api expects.
Simply using the original command arguments initially sounded like a nice plan, but as it turned out, many of the arguments would need special handling to provide different values depending on how the check is executed. So I think it absolutely makes sense to simply provide the arguments separately. My main question for @LordHepipud: does this, i.e. not supporting any functions/lambdas but just macro strings in all of
Is any of this due to limitations of the C++ implementation?
For this one, I understand the implications, this probably means that you don't generate |
Ok, these are actually two questions, with a big difference:
At least the array I think. But I'd like @LordHepipud to confirm that it's just fine or to reason that behaviour in the current renderers, so that I know what, what for and how to resolve.
This couldn’t even that. I mean, I could just C&P the order... only to waste space and traffic. |
Are the first two trying to say that this config
would result in the following JSON (no {"-String":""} I'm just trying to understand the implications if what you've stated as inconsistencies here and if any of this is something I should look into when reviewing the C++ part. By the way, I still have no idea about that SecureString thing so far, but I guess that's a pure PowerShell thing as there is no such thing in Icinga 2 or JSON.
I think you understood this differently than what I was trying to say. The only thing that Icinga 2 ifw-api could theoretically do if we would do massive changes to how we generate JSON, would be to allow you to change whether |
Yes, I think so. |
Another thing for the "Things to consider while reviewing" list: arrays containing just a single item are passed as a string instead of an array (see also Icinga/icinga2#9062 (comment)). For the one single thing I tested, this worked though. |
I see this was clever, but not smart: Icinga/icinga2#9062 (comment) @LordHepipud Any suggestions how this one shall pass security strings? |
The SecureString handling is fine. The issue, that the new code in this case is rendering the arguments with For example: It should only be I updated the code on my test system, generated the new config and everything works as expected now. |
Only SecureString args? Not all types? |
All arguments are meant to not have the leading For the config, I will enforce the generation without |
FYI: the example in the documentation includes the { '-Core': 0 } And the single quotes actually make this invalid JSON and GitHub renders it in a nice red (the PS daemon accepts it though). |
|
||
## Icinga Communication to API | ||
|
||
With Icinga 2.14.0 and later, you can enable the Icinga Agent to natively communicate with the Icinga for Windows API, allowing checks being executed without having to start a PowerShell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I guess this will be the link to our docs:
https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#ifw-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://icinga.com/docs/icinga-2/snapshot/doc/10-icinga-template-library/#ifw-api
already works thanks to @bobapple
Thanks! |
to properly support just importing the ifw-api command. That command e.g. takes DSL/JSON arrays [], not PS ones @(). Similar with strings. Therefore set vars.ifw_api_arguments as ifw-api expects.
closes #629
TODO
To keep things simple, I've implied a few inconsistencies: