2019-07-18 11:54:39 -04:00
|
|
|
<#
|
|
|
|
|
# This script will provide 'Enums' we can use within our module to
|
|
|
|
|
# easier access constants and to maintain a better overview of the
|
|
|
|
|
# entire components
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
[hashtable]$IcingaExitCode = @{
|
2020-08-04 09:13:04 -04:00
|
|
|
Ok = 0;
|
|
|
|
|
Warning = 1;
|
|
|
|
|
Critical = 2;
|
|
|
|
|
Unknown = 3;
|
2019-07-18 11:54:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[hashtable]$IcingaExitCodeText = @{
|
2019-08-22 04:43:00 -04:00
|
|
|
0 = '[OK]';
|
|
|
|
|
1 = '[WARNING]';
|
|
|
|
|
2 = '[CRITICAL]';
|
|
|
|
|
3 = '[UNKNOWN]';
|
2019-07-18 11:54:39 -04:00
|
|
|
};
|
|
|
|
|
|
2020-05-13 10:53:15 -04:00
|
|
|
[hashtable]$IcingaExitCodeColor = @{
|
|
|
|
|
0 = 'Green';
|
|
|
|
|
1 = 'Yellow';
|
|
|
|
|
2 = 'Red';
|
|
|
|
|
3 = 'Magenta';
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-18 11:54:39 -04:00
|
|
|
[hashtable]$IcingaMeasurementUnits = @{
|
2021-05-29 08:25:06 -04:00
|
|
|
's' = 'seconds';
|
|
|
|
|
'ms' = 'milliseconds';
|
|
|
|
|
'us' = 'microseconds';
|
|
|
|
|
'%' = 'percent';
|
|
|
|
|
'B' = 'bytes';
|
|
|
|
|
'KB' = 'Kilobytes';
|
|
|
|
|
'MB' = 'Megabytes';
|
|
|
|
|
'GB' = 'Gigabytes';
|
|
|
|
|
'TB' = 'Terabytes';
|
|
|
|
|
'c' = 'counter';
|
|
|
|
|
'Kbit' = 'Kilobit';
|
|
|
|
|
'Mbit' = 'Megabit';
|
|
|
|
|
'Gbit' = 'Gigabit';
|
|
|
|
|
'Tbit' = 'Terabit';
|
|
|
|
|
'Pbit' = 'Petabit';
|
|
|
|
|
'Ebit' = 'Exabit';
|
|
|
|
|
'Zbit' = 'Zettabit';
|
|
|
|
|
'Ybit' = 'Yottabit';
|
2019-07-18 11:54:39 -04:00
|
|
|
};
|
|
|
|
|
|
2021-01-21 09:16:43 -05:00
|
|
|
<##################################################################################################
|
|
|
|
|
################# Service Enums ##################################################################
|
|
|
|
|
##################################################################################################>
|
|
|
|
|
|
|
|
|
|
[hashtable]$ServiceStartupTypeName = @{
|
|
|
|
|
0 = 'Boot';
|
|
|
|
|
1 = 'System';
|
|
|
|
|
2 = 'Automatic';
|
|
|
|
|
3 = 'Manual';
|
|
|
|
|
4 = 'Disabled';
|
|
|
|
|
5 = 'Unknown'; # Custom
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[hashtable]$ServiceWmiStartupType = @{
|
|
|
|
|
'Boot' = 0;
|
|
|
|
|
'System' = 1;
|
|
|
|
|
'Auto' = 2;
|
|
|
|
|
'Manual' = 3;
|
|
|
|
|
'Disabled' = 4;
|
|
|
|
|
'Unknown' = 5; # Custom
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-18 11:54:39 -04:00
|
|
|
<#
|
|
|
|
|
# Once we defined a new enum hashtable above, simply add it to this list
|
|
|
|
|
# to make it available within the entire module.
|
|
|
|
|
#
|
|
|
|
|
# Example usage:
|
|
|
|
|
# $IcingaEnums.IcingaExitCode.Ok
|
|
|
|
|
#>
|
2021-02-16 10:10:00 -05:00
|
|
|
if ($null -eq $IcingaEnums) {
|
|
|
|
|
[hashtable]$IcingaEnums = @{
|
|
|
|
|
IcingaExitCode = $IcingaExitCode;
|
|
|
|
|
IcingaExitCodeText = $IcingaExitCodeText;
|
|
|
|
|
IcingaExitCodeColor = $IcingaExitCodeColor;
|
|
|
|
|
IcingaMeasurementUnits = $IcingaMeasurementUnits;
|
|
|
|
|
#services
|
|
|
|
|
ServiceStartupTypeName = $ServiceStartupTypeName;
|
|
|
|
|
ServiceWmiStartupType = $ServiceWmiStartupType;
|
|
|
|
|
}
|
2019-07-18 11:54:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Export-ModuleMember -Variable @( 'IcingaEnums' );
|