2021-11-25 07:07:48 -05:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Creates all environment variables for Icinga for Windows for the
|
|
|
|
|
PowerShell session
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Creates all environment variables for Icinga for Windows for the
|
|
|
|
|
PowerShell session
|
|
|
|
|
.EXAMPLE
|
|
|
|
|
New-IcingaEnvironmentVariable;
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
function New-IcingaEnvironmentVariable()
|
|
|
|
|
{
|
2021-12-09 11:42:06 -05:00
|
|
|
if ($null -eq $Global:Icinga) {
|
|
|
|
|
$Global:Icinga = @{ };
|
2021-11-25 07:07:48 -05:00
|
|
|
}
|
|
|
|
|
|
2023-05-09 06:57:40 -04:00
|
|
|
if ($Global:Icinga.ContainsKey('CacheBuilding') -eq $FALSE) {
|
|
|
|
|
$Global:Icinga.Add('CacheBuilding', $FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-25 07:07:48 -05:00
|
|
|
# Session specific configuration for this shell
|
2021-12-09 11:42:06 -05:00
|
|
|
if ($Global:Icinga.ContainsKey('Private') -eq $FALSE) {
|
|
|
|
|
$Global:Icinga.Add('Private', @{ });
|
|
|
|
|
|
|
|
|
|
$Global:Icinga.Private.Add('Daemons', @{ });
|
2023-07-27 10:15:29 -04:00
|
|
|
$Global:Icinga.Private.Add('Documentation', @{ });
|
2021-12-09 11:42:06 -05:00
|
|
|
$Global:Icinga.Private.Add('Timers', @{ });
|
2022-01-27 09:11:39 -05:00
|
|
|
$Global:Icinga.Private.Add('ProgressStatus', @{ });
|
2024-04-01 12:31:34 -04:00
|
|
|
$Global:Icinga.Private.Add(
|
|
|
|
|
'RepositoryStatus',
|
|
|
|
|
@{
|
|
|
|
|
'FailedRepositories' = @{ };
|
|
|
|
|
}
|
|
|
|
|
);
|
2021-12-09 11:42:06 -05:00
|
|
|
|
|
|
|
|
$Global:Icinga.Private.Add(
|
|
|
|
|
'Scheduler',
|
|
|
|
|
@{
|
2025-01-29 08:45:53 -05:00
|
|
|
'CheckCommand' = '';
|
2021-12-09 11:42:06 -05:00
|
|
|
'CheckData' = @{ };
|
|
|
|
|
'ThresholdCache' = @{ };
|
|
|
|
|
'CheckResults' = @();
|
2024-08-19 10:13:24 -04:00
|
|
|
'PerformanceData' = '';
|
2021-12-09 11:42:06 -05:00
|
|
|
'PluginException' = $null;
|
|
|
|
|
'ExitCode' = $null;
|
2024-08-19 10:13:24 -04:00
|
|
|
'PerfDataWriter' = @{
|
2025-01-29 08:45:53 -05:00
|
|
|
'Cache' = @{ };
|
|
|
|
|
'Storage' = (New-Object System.Text.StringBuilder);
|
|
|
|
|
'Daemon' = @{ };
|
|
|
|
|
'MetricsOverTime' = '';
|
2024-08-19 10:13:24 -04:00
|
|
|
}
|
2021-12-09 11:42:06 -05:00
|
|
|
}
|
|
|
|
|
);
|
2022-01-25 05:25:01 -05:00
|
|
|
|
|
|
|
|
$Global:Icinga.Private.Add(
|
|
|
|
|
'PerformanceCounter',
|
|
|
|
|
@{
|
|
|
|
|
'Cache' = @{ };
|
|
|
|
|
}
|
|
|
|
|
);
|
2021-11-25 07:07:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Shared configuration for all threads
|
2021-12-09 11:42:06 -05:00
|
|
|
if ($Global:Icinga.ContainsKey('Public') -eq $FALSE) {
|
|
|
|
|
$Global:Icinga.Add('Public', [hashtable]::Synchronized(@{ }));
|
2021-11-25 07:07:48 -05:00
|
|
|
|
2021-12-09 11:42:06 -05:00
|
|
|
$Global:Icinga.Public.Add('Daemons', @{ });
|
|
|
|
|
$Global:Icinga.Public.Add('Threads', @{ });
|
|
|
|
|
$Global:Icinga.Public.Add('ThreadPools', @{ });
|
2022-03-18 15:58:56 -04:00
|
|
|
$Global:Icinga.Public.Add('ThreadAliveHousekeeping', @{ });
|
2021-11-25 07:07:48 -05:00
|
|
|
}
|
2021-12-09 11:42:06 -05:00
|
|
|
|
|
|
|
|
# Session specific configuration which should never be modified by users!
|
|
|
|
|
if ($Global:Icinga.ContainsKey('Protected') -eq $FALSE) {
|
|
|
|
|
$Global:Icinga.Add('Protected', @{ });
|
|
|
|
|
|
2022-05-24 07:11:25 -04:00
|
|
|
$Global:Icinga.Protected.Add('DeveloperMode', $FALSE);
|
2021-12-09 11:42:06 -05:00
|
|
|
$Global:Icinga.Protected.Add('DebugMode', $FALSE);
|
|
|
|
|
$Global:Icinga.Protected.Add('JEAContext', $FALSE);
|
|
|
|
|
$Global:Icinga.Protected.Add('RunAsDaemon', $FALSE);
|
|
|
|
|
$Global:Icinga.Protected.Add('Minimal', $FALSE);
|
2022-03-18 15:58:56 -04:00
|
|
|
$Global:Icinga.Protected.Add('ThreadName', '');
|
2022-03-17 04:31:32 -04:00
|
|
|
$Global:Icinga.Protected.Add('GarbageCollector', @{ });
|
2024-03-14 12:16:09 -04:00
|
|
|
$Global:Icinga.Protected.Add(
|
|
|
|
|
'Environment', @{
|
2024-04-02 14:43:53 -04:00
|
|
|
'Icinga Service' = @{
|
|
|
|
|
'Status' = '';
|
|
|
|
|
'Present' = $FALSE;
|
|
|
|
|
'Name' = 'icinga2';
|
|
|
|
|
'DisplayName' = 'icinga2';
|
|
|
|
|
'User' = 'NT Authority\NetworkService';
|
|
|
|
|
'ServicePath' = '';
|
|
|
|
|
};
|
|
|
|
|
'PowerShell Service' = @{
|
|
|
|
|
'Status' = '';
|
|
|
|
|
'Present' = $FALSE;
|
|
|
|
|
'Name' = 'icingapowershell';
|
|
|
|
|
'DisplayName' = 'icingapowershell';
|
|
|
|
|
'User' = 'NT Authority\NetworkService';
|
|
|
|
|
'ServicePath' = '';
|
|
|
|
|
};
|
|
|
|
|
'FetchedServices' = $FALSE;
|
2024-03-14 12:16:09 -04:00
|
|
|
}
|
|
|
|
|
);
|
2021-11-25 07:07:48 -05:00
|
|
|
}
|
|
|
|
|
}
|