check_mk
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| check_mk [2020/10/05 12:47] – edvc | check_mk [Unbekanntes Datum] (aktuell) – Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
|---|---|---|---|
| Zeile 13: | Zeile 13: | ||
| New-NetFirewallRule -DisplayName " | New-NetFirewallRule -DisplayName " | ||
| Copy-Item ' | Copy-Item ' | ||
| + | </ | ||
| + | |||
| + | <file cmd edvc-check_mk_plugins.cmd> | ||
| + | copy " | ||
| + | copy " | ||
| + | copy " | ||
| + | copy " | ||
| + | copy " | ||
| + | copy " | ||
| + | </ | ||
| + | |||
| + | [[https:// | ||
| + | <file ps1 check_wsb.ps1> | ||
| + | <# | ||
| + | .SYNOPSIS | ||
| + | Check Windows Server Backup last scheduled job status. | ||
| + | .DESCRIPTION | ||
| + | Check Windows Server Backup and returns Nagios output and code. | ||
| + | PARAMETER Hours | ||
| + | Number of hours since now to check for backup jobs. | ||
| + | Default 48. | ||
| + | .OUTPUTS | ||
| + | OK: All last backups jobs within $Hours successful. | ||
| + | CRITICAL: Backup job failed. | ||
| + | .EXAMPLE | ||
| + | .\check_wsb.ps1 -Hours 96 | ||
| + | .NOTES | ||
| + | Author: | ||
| + | Date: | ||
| + | #> | ||
| + | Param( | ||
| + | [Parameter(Mandatory=$false, | ||
| + | [ValidateNotNullOrEmpty()] | ||
| + | [int]$Hours=48 | ||
| + | ) | ||
| + | |||
| + | #Load PSSnapin for Windows 2008 / R2 | ||
| + | $OperatingSystemVersion = (Get-WmiObject win32_operatingsystem).version | ||
| + | if (($OperatingSystemVersion -match " | ||
| + | Add-PSSnapin windows.serverbackup | ||
| + | } | ||
| + | |||
| + | # Get backup status | ||
| + | try{ | ||
| + | $BackupSummary = Get-WBSummary -ErrorAction Stop | ||
| + | }catch{ | ||
| + | Write-Output " | ||
| + | $host.SetShouldExit(3) | ||
| + | } | ||
| + | if ($BackupSummary){ | ||
| + | # Check last backup | ||
| + | $LastSuccessfulBackupTime = ($BackupSummary.LastSuccessfulBackupTime).Date | ||
| + | # If there is a last backup | ||
| + | If ($LastSuccessfulBackupTime){ | ||
| + | # Get number of backup versions | ||
| + | $PerfmonOutput = " | NumberOfVersions=$($BackupSummary.NumberOfVersions);;;;" | ||
| + | # If last backup has been performed in time and its result is ok. | ||
| + | If ( (($BackupSummary.LastSuccessfulBackupTime).Date -ge (get-date).AddHours(-$($Hours))) -and $BackupSummary.LastBackupResultHR -eq ' | ||
| + | Write-Output "OK: last backup date $($BackupSummary.LastSuccessfulBackupTime). $($BackupSummary.NumberOfVersions) versions stored.$($PerfmonOutput)" | ||
| + | $host.SetShouldExit(0) | ||
| + | } | ||
| + | # If last backup has not been performed in time or its result is not ok. | ||
| + | Else{ | ||
| + | if ($BackupSummary.DetailedMessage){ | ||
| + | Write-Output " | ||
| + | } | ||
| + | else{ | ||
| + | Write-Output " | ||
| + | } | ||
| + | $host.SetShouldExit(2) | ||
| + | } | ||
| + | } | ||
| + | else{ | ||
| + | Write-Output " | ||
| + | $host.SetShouldExit(2) | ||
| + | } | ||
| + | } | ||
| + | else{ | ||
| + | Write-Output " | ||
| + | $host.SetShouldExit(3) | ||
| + | } | ||
| </ | </ | ||
check_mk.1601902066.txt.gz · Zuletzt geändert: (Externe Bearbeitung)
