mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
239 stars 94 forks source link

Chech_nrpe error #618

Open vvargasginer opened 5 years ago

vvargasginer commented 5 years ago

Issue and Steps to Reproduce

Describe your issue and tell us how to reproduce it.

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.

PLEASE PROVIDE COMMAND HERE

nsclient.ini
; in flight - TODO
[/settings/default]

; Undocumented key
password = Ntad5m2003

; 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 - 

this is the script code:

$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

Expected Behavior

Tell us what you think should happen.

I think that is a problem of NRPE version. Nsclient works fine because I recive info with the command check_nt....

Actual Behavior

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.

I don't know why happend it.

Details

Additional Details

NSClient++ log:

PLEASE PASTE LOG HERE
2019-05-30 10:41:58: error:c:\source\master\modules\NRPEServer\NRPEServer.cpp:121: CA not found: C:\Program Files\NSClient++/security/ca.pem (generating a default CA)
2019-05-30 10:41:59: error:c:\source\master\modules\WEBServer\WEBServer.cpp:144: Certificate not found: C:\Program Files\NSClient++/security/certificate.pem (generating a default certificate)
2019-05-30 10:45:58: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_drivesize available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:45:58: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_cpu available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:47:17: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_memory available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:47:29: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_uptime available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:48:44: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_drivesize available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:48:44: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_cpu available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:48:54: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_drivesize available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:49:17: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_memory available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:49:29: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_uptime available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:50:44: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_drivesize available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:50:44: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_cpu available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:51:17: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_memory available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 10:51:29: error:c:\source\master\service\plugin_manager.cpp:475: Unknown command(s): check_uptime available commands: commands {, submit_nsca}, plugins {, 1}
2019-05-30 21:26:04: error:c:\source\master\include\scheduler\simple_scheduler.cpp:189: Ran scheduled item 1 127 seconds to late from thread 100
2019-05-30 22:05:30: error:c:\source\master\include\scheduler\simple_scheduler.cpp:189: Ran scheduled item 1 54 seconds to late from thread 100
2019-06-01 20:49:04: error:c:\source\master\include\scheduler\simple_scheduler.cpp:189: Ran scheduled item 1 49 seconds to late from thread 100
2019-06-02 20:56:33: error:c:\source\master\include\scheduler\simple_scheduler.cpp:189: Ran scheduled item 1 14 seconds to late from thread 100