I have configured the plugin for MSSQL (using Icinga for windows) - Invoke-IcingaCheckMSSQLBackupStatus
I created a service check to check the backup Status.
I leave all the Threshold empty in Command end service definition.
But the check report these error regarding the “Status”.
Seems that some threshold are defined (even in wrong way!)
How can correct this ?
THX
can you post the inspect output?
maybe your template has some defaults?
picoroma
(PiCo)
April 10, 2025, 9:26am
3
Here the detail of the “Inspect”:
‘C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe’ ‘-NoProfile’ ‘-NoLogo’ ‘-ExecutionPolicy’ ‘ByPass’ ‘-C’ ‘try { Use-Icinga -Minimal; } catch { Write-Output ‘'‘The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check Introduction - Icinga for Windows for further details’'’; Write-Output ‘'‘Error:’'’ $($_.Exception.Message)Components:r
n$( Get-Module -ListAvailable ‘'‘icinga-powershell-*’'’ )r
n’'‘Module-Path:’'‘r
n$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command ‘'‘Invoke-IcingaCheckMSSQLBackupStatus’'’ ’ ‘-IncludeDatabase’ ‘@(’'‘MYDB’'’,‘'‘master’'’,‘'‘model’'’,‘'‘msdb’'’)’ ‘-SqlUsername’ ‘’'‘.\ICINGA’'‘’ ‘-SqlPassword’ ‘(ConvertTo-IcingaSecureString ‘'‘MYPSWD’'’)’ ‘-Verbosity’ ‘1’ ‘-IntegratedSecurity’
picoroma
(PiCo)
April 14, 2025, 10:52am
4
Can be possible that these thresholds, are the default one - embedded into the plugin itself ?
Good Catch:
<#
.SYNOPSIS
MSSQL plugin which checks for total backupsize, average backupsize, last backup age,
last backup log age, last backup execution time, database status of a given database
.DESCRIPTION
MSSQL plugin which checks for total backupsize, average backupsize, last backup age,
last backup execution time, database status of a given database
More Information on https://github.com/Icinga/icinga-powershell-mssql
.FUNCTIONALITY
MSSQL plugin which checks for total backupsize, average backupsize, last backup age,
last backup execution time, database status of a given database
.EXAMPLE
PS>Invoke-IcingaMSSQLBackupOverallStatus -SqlUsername 'username' -SqlPassword (ConvertTo-IcingaSecureString 'password') -SqlHost 'example.com';
[OK] Check package "MSSQL Backup"
| 'status'=0;6;5 'size'=10110976b;; 'execution_time'=0s;; 'age'=144000s;; 'average_size'=3370325.333333b;; 'status'=0;6;5 'size'=12664832b;;
'execution_time'=0s;; 'age'=493200s;; 'average_size'=6332416b;; 'status'=0;6;5 'size'=33445888b;; 'execution_time'=0s;; 'age'=144000s;; 'average_size'=16722944b;;
.EXAMPLE
PS>Get-IcingaMSSQLBackupOverallStatus -IntegratedSecurity -SqlHost 'example.com' -IncludeDatabase 'ExampleDatabase','AnotherDatabase';
[OK] Check package "MSSQL Backup"
| 'status'=0;6;5 'size'=12664832b;; 'execution_time'=0s;; 'age'=493200s;; 'average_size'=6332416b;; 'status'=0;6;5 'size'=10110976b;;
This file has been truncated. show original
[ValidateSet(‘Online’, ‘Restoring’, ‘Recovering’, ‘Recovering_Pending’, ‘Suspect’, ‘Emergency’, ‘Offline’, ‘Copying’, ‘Offline_Secondary’)]
$DatabaseStatusWarning = ‘Offline’,
[ValidateSet(‘Online’, ‘Restoring’, ‘Recovering’, ‘Recovering_Pending’, ‘Suspect’, ‘Emergency’, ‘Offline’, ‘Copying’, ‘Offline_Secondary’)]
$DatabaseStatusCritical = ‘Emergency’,
WarnIfMatch($MSSQLProviderEnums.MSSQLDatabaseStateName[$DatabaseStatusWarning])
CritIfMatch($MSSQLProviderEnums.MSSQLDatabaseStateName[$DatabaseStatusCritical])
The default for the last check is warnung for offline and critical for emergency
So I assume all you databases are offline.
Best Regards
Nicolas
picoroma
(PiCo)
April 14, 2025, 1:24pm
6
NO! My DB are not OFFLINE. I think that the “5” and "6 " thresholds are wrong reported as the default value.
These are the same value that are presetn in ALL example into the plugin documenation…
But I do not find where this value are passed to the command.
My DB are not OFFLINE, of course!
Anyway my status FINAL is not WARNING nor CRITICAL. It is “Status = UNknown” because:
Status: Warning threshold range “6” is greater than Critical threshold range “5”
picoroma
(PiCo)
April 14, 2025, 2:06pm
7
There is a ISSUE opened here:
opened 08:23AM - 12 Mar 25 UTC
`icinga-powershell-mssql` on version `1.5.0`.
Since using the new `icinga-power… shell-framework` on version `v1.13.2`. The check finishes as `UNKNOWN`.
This can be reproduced with the command (no parameters have been changed):
`Invoke-IcingaCheckMSSQLBackupStatus -SqlUsername Icinga2 -SqlPassword (ConvertTo-IcingaSecureString 'password') -Verbosity 2`
Output:
```
[UNKNOWN] MSSQL Backup (MSSQLSERVER) [UNKNOWN] db1, db2, db3, db4, db5, ....
\_ [UNKNOWN] db1
\_ [OK] Age: 1h
\_ [OK] Average Size: 38.82GiB
\_ [OK] Execution Time: 0us
\_ [OK] Log age: 0us
\_ [OK] Size: 40.68TiB
\_ [UNKNOWN] Status: Warning threshold range "6" is greater than Critical threshold range "5"
\_ [UNKNOWN] db2
\_ [OK] Age: 1h
\_ [OK] Average Size: 30.75GiB
\_ [OK] Execution Time: 2m
\_ [OK] Log age: 0us
\_ [OK] Size: 30.75GiB
\_ [UNKNOWN] Status: Warning threshold range "6" is greater than Critical threshold range "5"
\_ [UNKNOWN] db3
\_ [OK] Age:1h
\_ [OK] Average Size: 1001.43MiB
\_ [OK] Execution Time: 0us
\_ [OK] Log age: 0us
\_ [OK] Size: 978.93GiB
\_ [UNKNOWN] Status: Warning threshold range "6" is greater than Critical threshold range "5"
\_ [UNKNOWN] db4
\_ [OK] Age: 1h
\_ [OK] Average Size: 13.17GiB
\_ [OK] Execution Time: 0us
\_ [OK] Log age: 0us
\_ [OK] Size: 12.88TiB
\_ [UNKNOWN] Status: Warning threshold range "6" is greater than Critical threshold range "5"
\_ [UNKNOWN] db5
\_ [OK] Age: 1h
\_ [OK] Average Size: 1.60GiB
\_ [OK] Execution Time: 0us
\_ [OK] Log age: 0us
\_ [OK] Size: 1.57TiB
\_ [UNKNOWN] Status: Warning threshold range "6" is greater than Critical threshold range "5"
.....
```
Performance data for state: `dbX::ifw_mssqlbackupstatus::state=0;6;5;;`
Greetz