2019-09-29 12:25:40 -04:00
|
|
|
function Get-IcingaAgentFeatures()
|
|
|
|
|
{
|
|
|
|
|
$Binary = Get-IcingaAgentBinary;
|
|
|
|
|
$ConfigResult = Start-IcingaProcess -Executable $Binary -Arguments 'feature list';
|
|
|
|
|
|
2021-02-19 04:09:42 -05:00
|
|
|
if ($ConfigResult.ExitCode -ne 0) {
|
|
|
|
|
return @{
|
|
|
|
|
'Enabled' = @();
|
|
|
|
|
'Disabled' = @();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-04 08:48:32 -04:00
|
|
|
$DisabledFeatures = (
|
|
|
|
|
$ConfigResult.Message.SubString(
|
|
|
|
|
0,
|
|
|
|
|
$ConfigResult.Message.IndexOf('Enabled features')
|
|
|
|
|
)
|
|
|
|
|
).Replace('Disabled features: ', '').Replace("`r`n", '').Replace("`r", '').Replace("`n", '');
|
2019-09-29 12:25:40 -04:00
|
|
|
|
2020-08-04 08:48:32 -04:00
|
|
|
$EnabledFeatures = (
|
|
|
|
|
$ConfigResult.Message.SubString(
|
|
|
|
|
$ConfigResult.Message.IndexOf('Enabled features'),
|
|
|
|
|
$ConfigResult.Message.Length - $ConfigResult.Message.IndexOf('Enabled features')
|
|
|
|
|
)
|
|
|
|
|
).Replace('Enabled features: ', '').Replace("`r`n", '').Replace("`r", '').Replace("`n", '');
|
2019-09-29 12:25:40 -04:00
|
|
|
|
|
|
|
|
return @{
|
|
|
|
|
'Enabled' = ($EnabledFeatures.Split(' '));
|
|
|
|
|
'Disabled' = ($DisabledFeatures.Split(' '));
|
|
|
|
|
}
|
|
|
|
|
}
|