Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa97d37

Browse files
ronnybremerLordHepipud
authored andcommitted
Added parameter IncludeDays to limit the number of backup history records to be evaluated
1 parent8df5421 commitaa97d37

8 files changed

+40
-13
lines changed

‎config/director/Invoke-IcingaCheckMSSQLBackupStatus.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎config/director/Mssql_Bundle.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎config/icinga/Invoke-IcingaCheckMSSQLBackupStatus.conf‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ object CheckCommand "Invoke-IcingaCheckMSSQLBackupStatus" {
135135
}}
136136
order = 17
137137
}
138+
"-Verbosity" = {
139+
description = "Changes the behavior of the plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: Identical to Verbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
140+
value = "$IcingaCheckMSSQLBackupStatus_Object_Verbosity$"
141+
order = 20
142+
}
138143
"-TotalBackupSizeCritical" = {
139144
description = "Critical threshold for the total backupsize which represent a count of all backups"
140145
value = "$IcingaCheckMSSQLBackupStatus_Object_TotalBackupSizeCritical$"
@@ -145,9 +150,9 @@ object CheckCommand "Invoke-IcingaCheckMSSQLBackupStatus" {
145150
value = "$IcingaCheckMSSQLBackupStatus_Int32_SqlPort$"
146151
order = 18
147152
}
148-
"-Verbosity" = {
149-
description = "Changes thebehavior ofthe plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: IdenticaltoVerbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
150-
value = "$IcingaCheckMSSQLBackupStatus_Object_Verbosity$"
153+
"-IncludeDays" = {
154+
description = "Specifies thenumber ofdays to read the backup history from MSSQL. Over time, the history table can get quite large and if there is no maintenance task in placetoshrink it, this script could time out. By default the entire history is evaluated."
155+
value = "$IcingaCheckMSSQLBackupStatus_Object_IncludeDays$"
151156
order = 19
152157
}
153158
"-LastBackupAgeCritical" = {

‎config/icinga/Mssql_Bundle.conf‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ object CheckCommand "Invoke-IcingaCheckMSSQLBackupStatus" {
271271
}}
272272
order = 17
273273
}
274+
"-Verbosity" = {
275+
description = "Changes the behavior of the plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: Identical to Verbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
276+
value = "$IcingaCheckMSSQLBackupStatus_Object_Verbosity$"
277+
order = 20
278+
}
274279
"-TotalBackupSizeCritical" = {
275280
description = "Critical threshold for the total backupsize which represent a count of all backups"
276281
value = "$IcingaCheckMSSQLBackupStatus_Object_TotalBackupSizeCritical$"
@@ -281,9 +286,9 @@ object CheckCommand "Invoke-IcingaCheckMSSQLBackupStatus" {
281286
value = "$IcingaCheckMSSQLBackupStatus_Int32_SqlPort$"
282287
order = 18
283288
}
284-
"-Verbosity" = {
285-
description = "Changes thebehavior ofthe plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: IdenticaltoVerbose 2, but prints in addition the check package configuration e.g (All must be [OK])"
286-
value = "$IcingaCheckMSSQLBackupStatus_Object_Verbosity$"
289+
"-IncludeDays" = {
290+
description = "Specifies thenumber ofdays to read the backup history from MSSQL. Over time, the history table can get quite large and if there is no maintenance task in placetoshrink it, this script could time out. By default the entire history is evaluated."
291+
value = "$IcingaCheckMSSQLBackupStatus_Object_IncludeDays$"
287292
order = 19
288293
}
289294
"-LastBackupAgeCritical" = {

‎doc/31-Changelog.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1313

1414
###Enhancements
1515

16+
*[42](https://github.com/Icinga/icinga-powershell-mssql/pull/42) Adds option for`IncludeDays` to reduce the amount of backup data generated[ronnybremer]
1617
*[46](https://github.com/Icinga/icinga-powershell-mssql/pull/46) Updates configuration and dependencies for Icinga for Windows v1.10.0
1718
*[47](https://github.com/Icinga/icinga-powershell-mssql/pull/47) Adds new performance data handling for Icinga for Windows v1.10.0 and provides basic Grafana dashboards and Icinga Web integration
1819

‎doc/plugins/01-Invoke-IcingaCheckMSSQLBackupStatus.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ No special permissions required.
3737
| SqlPort| Int32| false| 1433| The port of the MSSQL server/instance to connect to with the provided credentials|
3838
| IntegratedSecurity| SwitchParameter| false| False| Allows this plugin to use the credentials of the current PowerShell session inherited by the user the PowerShell is running with. If this is set and the user the PowerShell is running with can access to the MSSQL database you will not require to provide username and password|
3939
| NoPerfData| SwitchParameter| false| False| Disables the performance data output of this plugin|
40+
| IncludeDays| Object| false|| Specifies the number of days to read the backup history from MSSQL. Over time, the history table can get quite large and if there is no maintenance task in place to shrink it, this script could time out. By default the entire history is evaluated.|
4041
| Verbosity| Object| false| 0| Changes the behavior of the plugin output which check states are printed: 0 (default): Only service checks/packages with state not OK will be printed 1: Only services with not OK will be printed including OK checks of affected check packages including Package config 2: Everything will be printed regardless of the check state 3: Identical to Verbose 2, but prints in addition the check package configuration e.g (All must be[OK])|
4142
| ThresholdInterval| String||| Change the value your defined threshold checks against from the current value to a collected time threshold of the Icinga for Windows daemon, as described[here](https://icinga.com/docs/icinga-for-windows/latest/doc/service/10-Register-Service-Checks/). An example for this argument would be 1m or 15m which will use the average of 1m or 15m for monitoring.|
4243

‎plugins/Invoke-IcingaCheckMSSQLBackupStatus.psm1‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
and password
7878
.PARAMETERNoPerfData
7979
Disables the performance data output of this plugin
80+
.PARAMETERIncludeDays
81+
Specifies the number of days to read the backup history from MSSQL. Over time, the history table can get quite
82+
large and if there is no maintenance task in place to shrink it, this script could time out. By default the entire
83+
history is evaluated.
8084
.PARAMETERVerbosity
8185
Changes the behavior of the plugin output which check states are printed:
8286
0 (default): Only service checks/packages with state not OK will be printed
@@ -116,12 +120,13 @@ function Invoke-IcingaCheckMSSQLBackupStatus
116120
[int]$SqlPort=1433,
117121
[switch]$IntegratedSecurity=$FALSE,
118122
[switch]$NoPerfData,
123+
$IncludeDays=$null,
119124
[ValidateSet(0,1,2,3)]
120125
$Verbosity=0
121126
)
122127

123128
$SqlConnection=Open-IcingaMSSQLConnection-Username$SqlUsername-Password$SqlPassword-Address$SqlHost-IntegratedSecurity:$IntegratedSecurity-Port$SqlPort;
124-
$BackupSet=Get-IcingaMSSQLBackupOverallStatus-SqlConnection$SqlConnection-IncludeDatabase$IncludeDatabase;
129+
$BackupSet=Get-IcingaMSSQLBackupOverallStatus-SqlConnection$SqlConnection-IncludeDatabase$IncludeDatabase-IncludeDays$IncludeDays;
125130
$InstanceName=Get-IcingaMSSQLInstanceName-SqlConnection$SqlConnection;
126131
$CheckPackage=New-IcingaCheckPackage-Name ([string]::Format('MSSQL Backup ({0})',$InstanceName))-OperatorAnd-Verbose$Verbosity;
127132

‎provider/mssql/Get-IcingaMSSQLBackupOverallStatus.psm1‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
the user the PowerShell is running with. If this is set and the user the PowerShell is
3939
running with can access to the MSSQL database you will not require to provide username
4040
and password
41+
.PARAMETERIncludeDays
42+
Specifies the number of days to read the backup history from MSSQL. Over time, the history table can get quite
43+
large and if there is no maintenance task in place to shrink it, this script could time out. By default the entire
44+
history is evaluated.
4145
.INPUTS
4246
System.Array
4347
.OUTPUTS
@@ -56,7 +60,8 @@
5660
[securestring]$SqlPassword,
5761
[string]$SqlHost="localhost",
5862
[int]$SqlPort=1433,
59-
[switch]$IntegratedSecurity=$FALSE
63+
[switch]$IntegratedSecurity=$FALSE,
64+
$IncludeDays=$null
6065
);
6166

6267
[bool]$NewSqlConnection=$FALSE;
@@ -82,10 +87,15 @@
8287
DATEDIFF(MI, msdb.dbo.backupset.backup_start_date, msdb.dbo.backupset.backup_finish_date) AS last_backup_duration_min
8388
FROM msdb.dbo.backupmediafamily
8489
INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
85-
LEFT JOIN sys.databases ON sys.databases.name = msdb.dbo.backupset.database_name WHERE sys.databases.source_database_id IS NULL
86-
ORDER BY
90+
LEFT JOIN sys.databases ON sys.databases.name = msdb.dbo.backupset.database_name
91+
WHERE sys.databases.source_database_id IS NULL";
92+
93+
if ($null-ne$IncludeDays) {
94+
$Query=$Query+" AND msdb.dbo.backupset.backup_start_date >= DATEADD(day, -"+$IncludeDays+", GETDATE())";
95+
}
96+
$Query=$Query+" ORDER BY
8797
msdb.dbo.backupset.database_name,
88-
msdb.dbo.backupset.backup_finish_date"
98+
msdb.dbo.backupset.backup_finish_date";
8999

90100
$SqlCommand=New-IcingaMSSQLCommand-SqlConnection$SqlConnection-SqlQuery$Query;
91101
$Data=Send-IcingaMSSQLCommand-SqlCommand$SqlCommand;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp