mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Merge pull request #439 from Icinga:fix/move_performance_counter_to_private
Fix: Moves PerformanceCounter to private space Moves PerformanceCounter to private space from previous public, which caused some problems.
This commit is contained in:
commit
45d189756e
6 changed files with 29 additions and 23 deletions
|
|
@ -27,6 +27,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#418](https://github.com/Icinga/icinga-powershell-framework/pull/418) Fixes crash on wrong variable usage introduced by [#411](https://github.com/Icinga/icinga-powershell-framework/pull/411)
|
||||
* [#421](https://github.com/Icinga/icinga-powershell-framework/issues/421) Fixes experimental state of `API Check` feature by removing that term and removing the requirement to install `icinga-powershell-restapi` and `icinga-powershell-apichecks`
|
||||
* [#436](https://github.com/Icinga/icinga-powershell-framework/pull/436) Fixes a lookup error for existing plugin documentation files, which caused files not being generated properly in case a similar name was already present on the system
|
||||
* [#439](https://github.com/Icinga/icinga-powershell-framework/pull/439) Moves PerformanceCounter to private space from previous public, which caused some problems
|
||||
|
||||
### Enhancements
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,12 @@ Everything which should be stored while a daemon is running internally or within
|
|||
|
||||
The following entries are set by default within the `Private` space:
|
||||
|
||||
| Category | Description |
|
||||
| --- | --- |
|
||||
| Timers | All created timers by using `Start-IcingaTimer` are stored under this environment variable |
|
||||
| Scheduler | Once plugins are executed, performance data, check results and exit codes are stored in this section, in case the PowerShell instance is set to run as daemon |
|
||||
| Daemons | This is a place where all daemon data should be added and stored, separated by a namespace for each module as entry. This data is **not** shared between other daemons |
|
||||
| Category | Description |
|
||||
| --- | --- |
|
||||
| Timers | All created timers by using `Start-IcingaTimer` are stored under this environment variable |
|
||||
| Scheduler | Once plugins are executed, performance data, check results and exit codes are stored in this section, in case the PowerShell instance is set to run as daemon |
|
||||
| Daemons | This is a place where all daemon data should be added and stored, separated by a namespace for each module as entry. This data is **not** shared between other daemons |
|
||||
| PerformanceCounter | A space to share all PerformanceCounter information between threads, which counters are already created for internal usage |
|
||||
|
||||
#### Example Data
|
||||
|
||||
|
|
@ -84,12 +85,11 @@ There is no manual configuration required to share the information, as Icinga fo
|
|||
|
||||
The following entries are set by default within the `Public` space:
|
||||
|
||||
| Category | Description |
|
||||
| --- | --- |
|
||||
| ThreadPools | A list of all thread pools available to create new thread limits for certain background daemons |
|
||||
| Daemons | A place to store shared information for each single daemon within a namespace, making data accessible to other threads |
|
||||
| Threads | A list of all started and available threads running by Icinga for Windows |
|
||||
| PerformanceCounter | A space to share all PerformanceCounter information between threads, which counters are already created for internal usage |
|
||||
| Category | Description |
|
||||
| --- | --- |
|
||||
| ThreadPools | A list of all thread pools available to create new thread limits for certain background daemons |
|
||||
| Daemons | A place to store shared information for each single daemon within a namespace, making data accessible to other threads |
|
||||
| Threads | A list of all started and available threads running by Icinga for Windows |
|
||||
|
||||
##### Example Data
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ function New-IcingaEnvironmentVariable()
|
|||
'ExitCode' = $null;
|
||||
}
|
||||
);
|
||||
|
||||
$Global:Icinga.Private.Add(
|
||||
'PerformanceCounter',
|
||||
@{
|
||||
'Cache' = @{ };
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
# Shared configuration for all threads
|
||||
|
|
@ -42,12 +49,6 @@ function New-IcingaEnvironmentVariable()
|
|||
$Global:Icinga.Public.Add('Daemons', @{ });
|
||||
$Global:Icinga.Public.Add('Threads', @{ });
|
||||
$Global:Icinga.Public.Add('ThreadPools', @{ });
|
||||
$Global:Icinga.Public.Add(
|
||||
'PerformanceCounter',
|
||||
@{
|
||||
'Cache' = @{ };
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
# Session specific configuration which should never be modified by users!
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ function Add-IcingaPerformanceCounterCache()
|
|||
$Instances
|
||||
);
|
||||
|
||||
if ($Global:Icinga.Public.PerformanceCounter.Cache.ContainsKey($Counter)) {
|
||||
$Global:Icinga.Public.PerformanceCounter.Cache[$Counter] = $Instances;
|
||||
if ($Global:Icinga.Private.PerformanceCounter.Cache.ContainsKey($Counter)) {
|
||||
$Global:Icinga.Private.PerformanceCounter.Cache[$Counter] = $Instances;
|
||||
} else {
|
||||
$Global:Icinga.Public.PerformanceCounter.Cache.Add(
|
||||
$Global:Icinga.Private.PerformanceCounter.Cache.Add(
|
||||
$Counter, $Instances
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,12 @@ function Get-IcingaPerformanceCounterCacheItem()
|
|||
$Counter
|
||||
);
|
||||
|
||||
if ($Global:Icinga.Public.PerformanceCounter.Cache.ContainsKey($Counter)) {
|
||||
return $Global:Icinga.Public.PerformanceCounter.Cache[$Counter];
|
||||
if ([string]::IsNullOrEmpty($Counter)) {
|
||||
return $null;
|
||||
}
|
||||
|
||||
if ($Global:Icinga.Private.PerformanceCounter.Cache.ContainsKey($Counter)) {
|
||||
return $Global:Icinga.Private.PerformanceCounter.Cache[$Counter];
|
||||
}
|
||||
|
||||
return $null;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ function New-IcingaPerformanceCounterArray()
|
|||
# for each session to speed up the loading. This cold be something like
|
||||
# this:
|
||||
#
|
||||
# $Global:Icinga.Public.PerformanceCounter.Cache += $CounterResult;
|
||||
# $Global:Icinga.Private.PerformanceCounter.Cache += $CounterResult;
|
||||
|
||||
# Above we initialise ever single counter and we only require a sleep once
|
||||
# in case a new, yet unknown counter was added
|
||||
|
|
|
|||
Loading…
Reference in a new issue