I have a the problem to import the invoke-icngacheckhttpstatus
First I have generate the check with:
Get-IcingaCheckCommandConfig -CheckName Invoke-IcingaCheckHTTPStatus -IcingaConfig -OutDirectory 'C:\temp\' -FileName 'icingacheckhttp.conf';
than I copy the conf to the other .conf files on the Icinga Server
After the reload with
icinga2 daemon -C
I got the following error:
[2021-07-13 15:59:34 +0200] information/cli: Icinga application loader (version: 2.12.4-1)
[2021-07-13 15:59:34 +0200] information/cli: Loading configuration file(s).
[2021-07-13 15:59:34 +0200] critical/config: Error: syntax error, unexpected T_IDENTIFIER
Location: in /etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf: 2:7-2:18
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(1):
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(2): bject CheckCommand "Invoke-IcingaCheckHTTPStatus" {
^^^^^^^^^^^^
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(3): import "PowerShell Base"
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(4):
[2021-07-13 15:59:34 +0200] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
[root@SERVER windows-commands]# icinga2 daemon -C
[2021-07-13 16:46:40 +0200] information/cli: Icinga application loader (version: 2.12.4-1)
[2021-07-13 16:46:40 +0200] information/cli: Loading configuration file(s).
[2021-07-13 16:46:40 +0200] critical/config: Error: syntax error, unexpected T_IDENTIFIER
Location: in /etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf: 2:7-2:18
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(1):
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(2): bject CheckCommand "Invoke-IcingaCheckHTTPStatus" {
^^^^^^^^^^^^
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(3): import "PowerShell Base"
/etc/icinga2/zones.d/windows-commands/icingacheckhttpstatus.conf(4):
[2021-07-13 16:46:40 +0200] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
This is my generated conf file:
object CheckCommand "Invoke-IcingaCheckHTTPStatus" {
import "PowerShell Base"
arguments += {
"-StatusCode" = {
value = {{
var arr = macro("$IcingaCheckHTTPStatus_Array_StatusCode$");
if (len(arr) == 0) {
return "@()";
}
return arr.map(
x => if (typeof(x) == String) {
var argLen = len(x);
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
x;
} else {
"'" + x + "'";
}
} else {
x;
}
).join(",");
}}
order = 14
}
"-NoPerfData" = {
set_if = "$IcingaCheckHTTPStatus_Switchparameter_NoPerfData$"
order = 99
}
"-Verbosity" = {
description = "Changes the behavior of the plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: Identical to Verbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
value = "$IcingaCheckHTTPStatus_Int32_Verbosity$"
order = 16
}
"-Content" = {
description = "Used to specify an array of regex-match-strings to match against the content of the webrequest response."
value = {{
var arr = macro("$IcingaCheckHTTPStatus_Array_Content$");
if (len(arr) == 0) {
return "@()";
}
return arr.map(
x => if (typeof(x) == String) {
var argLen = len(x);
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
x;
} else {
"'" + x + "'";
}
} else {
x;
}
).join(",");
}}
order = 13
}
"-ProxyUsername" = {
description = "Used to specify a proxy username as string to authenticate with. Use with: -ProxyPassword & -ProxyServer"
value = "$IcingaCheckHTTPStatus_String_ProxyUsername$"
order = 10
}
"-Username" = {
description = "Used to specify a username as string to authenticate with. Authentication is only possible with 'https://'. Use with: -Password"
value = "$IcingaCheckHTTPStatus_String_Username$"
order = 8
}
"-C" = {
value = "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output "Error: $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable "icinga-powershell-*" )`r`nModule-Path:`r`n$$($$Env:PSModulePath)"; exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckHTTPStatus' "
order = 0
}
"-ThresholdInterval" = {
description = "Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described here: https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/ An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring."
value = "$IcingaCheckHTTPStatus_String_ThresholdInterval$"
order = 100
}
"-Negate" = {
set_if = "$IcingaCheckHTTPStatus_Switchparameter_Negate$"
order = 99
}
"-Password" = {
description = "Used to specify a password as securestring to authenticate with. Authentication is only possible with 'https://'.Use with: -Username"
value = "(ConvertTo-IcingaSecureString '$IcingaCheckHTTPStatus_Securestring_Password$')"
order = 9
}
"-Warning" = {
description = "Used to specify the webrequest response time warning threshold in seconds, everything past that threshold is considered a WARNING."
value = "$IcingaCheckHTTPStatus_Object_Warning$"
order = 2
}
"-ProxyServer" = {
description = "Used to specify a proxy server as string to authenticate with."
value = "$IcingaCheckHTTPStatus_String_ProxyServer$"
order = 12
}
"-ProxyPassword" = {
description = "Used to specify a proxy password as securestring to authenticate with. Use with: -ProxyUsername & -ProxyServer"
value = "(ConvertTo-IcingaSecureString '$IcingaCheckHTTPStatus_Securestring_ProxyPassword$')"
order = 11
}
"-Minimum" = {
value = "$IcingaCheckHTTPStatus_Int32_Minimum$"
order = 15
}
"-VHost" = {
description = "Used to specify a VHost as string."
value = "$IcingaCheckHTTPStatus_String_VHost$"
order = 5
}
"-Critical" = {
description = "Used to specify the webrequest response time critical threshold in seconds, everything past that threshold is considered a CRITICAL."
value = "$IcingaCheckHTTPStatus_Object_Critical$"
order = 3
}
"-Headers" = {
description = "Used to specify headers as Array. Like: -Headers 'Accept:application/json'"
value = {{
var arr = macro("$IcingaCheckHTTPStatus_Array_Headers$");
if (len(arr) == 0) {
return "@()";
}
return arr.map(
x => if (typeof(x) == String) {
var argLen = len(x);
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
x;
} else {
"'" + x + "'";
}
} else {
x;
}
).join(",");
}}
order = 6
}
"-Timeout" = {
description = "Used to specify the timeout in seconds of the webrequest as integer. The default is 10 for 10 seconds."
value = "$IcingaCheckHTTPStatus_Int32_Timeout$"
order = 7
}
"-Url" = {
description = "Used to specify the URL of the host to check http as string. Use 'http://' or 'https://' to actively chose a protocol. Likewise ':80' or any other port number to specify a port, etc."
value = {{
var arr = macro("$IcingaCheckHTTPStatus_Array_Url$");
if (len(arr) == 0) {
return "@()";
}
return arr.map(
x => if (typeof(x) == String) {
var argLen = len(x);
if (argLen != 0 && x.substr(0,1) == "'" && x.substr(argLen - 1, argLen) == "'") {
x;
} else {
"'" + x + "'";
}
} else {
x;
}
).join(",");
}}
order = 4
}
}
vars.IcingaCheckHTTPStatus_Switchparameter_NoPerfData = false
vars.IcingaCheckHTTPStatus_Switchparameter_Negate = false
}
- Director version (System - About):1.8.0
- Icinga Web 2 version and modules (System - About):2.8.2
- Icinga 2 version (
icinga2 --version
): - Operating System and version:redhat 7.8
- Webserver,
- PHP versions: 7.3.20