Windows Server 2008 R2 NRPE


#1

Hello, I’m new on Nagios. I installed Nagios 4.4.3 on Ubuntu 18.04 and I want monitoring a Windows server 2008 R2. I install Nsclient++ version 0.5.2.35 and I try it also with version 0.5.2.33. From server nagios I recived info like CPU load, diskspace(check_net work fine)… but I want check Windows Backup. To check the Backup of windwos I use this script:

$returnStateOK = 0 $returnStateWarning = 1 $returnStateCritical = 2 $returnStateUnknown = 3

$date = (Get-Date).AddDays(-1)

try { _ $CritEvents = Get-WinEvent @{Path = “C:\Windows\System32\winevt\Logs\Microsoft-Windows-Backup.evtx” ; StartTime = $date; Level = 2,1} -ErrorAction SilentlyContinue_ _ $CritNbEv = $CritEvents.Count_ } catch { } try { _ $WarnEvents = Get-WinEvent @{Path = “C:\Windows\System32\winevt\Logs\Microsoft-Windows-Backup.evtx” ; StartTime = $date; Level = 3} -ErrorAction SilentlyContinue_ _ $WarnNbEv = $WarnEvents.Count_ } catch { } try { _ $OkEvents = Get-WinEvent @{Path = “C:\Windows\System32\winevt\Logs\Microsoft-Windows-Backup.evtx” ; StartTime = $date; ID = 4 } -ErrorAction SilentlyContinue_ _ $OkNbEv = $OkEvents.Count_ } catch { } if (($CritNbEv -eq $Null -and $CritEvents -eq $Null) -or $CritNbEv -eq 0) { $CritNbEv = 0 } else { $CritNbEv = 1 } if ($WarnNbEv -eq $Null -and $WarnEvents -eq $Null ) { _ $WarnNbEv = 0_ } else { _ $WarnNbEv = 1_ } if ($OkNbEv -eq $Null -and $OkEvents -eq $Null ) { _ $OkNbEv = 0_ } else { _ $OkNbEv = 1_ } if ($WarnNbEv -ne 0) { _ $message = “WARNING - Found {0} warning in Microsoft-Windows-Backup event log” -f $WarnNbEv_ _ Write-Host $message_ _ exit $returnStateWarning_ }

if ($OkNbEv -ne 0 ) { _ $message = "OK - No errors in Microsoft-Windows-Backup log "_ _ Write-Host $message_ _ exit $returnStateOK_ }

if ($CritNbEv -ne 0 ) { _ $message = “CRITICAL - Found {0} errors in Microsoft-Windows-Backup event log” -f $CritNbEv_ _ Write-Host $message_ _ exit $returnStateCritical_ }

Write-Host "UNKNOW - Not found backups events" exit $returnStateUnknown

https://exchange.nagios.org/directory/Plugins/Backup-and-Recovery/Check-Windows-Backup-Log/details And my nsclient.ini is this.

; in flight - TODO [/settings/default]

; Undocumented key password = *****

; Undocumented key allowed hosts = 192.168.1.229

; in flight - TODO [/settings/NRPE/server]

use ssl = false ssl opt .ions = no-sslv2,no-sslv3

; Undocumented key verify mode = none

; Undocumented key insecure = true

; in flight - TODO [/modules]

; Undocumented key CheckExternalScripts = enabled

; Undocumented key CheckHelpers = enabled

; Undocumented key CheckNSCP = enabled

; Undocumented key CheckDisk = enabled

; Undocumented key WEBServer = enabled

; Undocumented key CheckSystem = enabled

; Undocumented key NSClientServer = enabled

; Undocumented key CheckEventLog = enabled

; Undocumented key NSCAClient = enabled

; Undocumented key NRPEServer = enabled

[/settings/external scripts]

; in flight - TODO [/settings/external scripts/scripts]

allow arguments = true

check_backup=cmd /c echo scriptscheck_backup.ps1; exit($LastExitCode) | powershell.exe -command -

When I check from ubuntu this::/usr/local/nagios/libexec$ ./check_nrpe -2 -H MYWINDOSSERVERIP -n -p 12489 -s MYPASSWORD -c check_backup The following message is returned to me: CHECK_NRPE: Invalid packet version received from server.

Why I have this error? How can i solve it? Thanks?