Question

VEEAM - job-status - CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

  • 4 September 2023
  • 15 replies
  • 829 views

Userlevel 1
Badge +9

Hello everyone,

Does anyone have an idea how to resolve this error:

CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

 

Command:

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.192.30.9 -p 8084 -t 60 -u -2 -P 8192 -c check_centreon_plugins -a 'apps::backup::veeam::local::plugin' 'job-status'  ' --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose'

 

Other commands are ok.

 

 

NSClient++ version number

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.192.30.9 -p 8084 -t 60 -u -2 -P 8192

I (0.5.2.41 2018-04-26) seem to be doing fine...


15 replies

Badge +1

Hello, i had this trouble to.

to resolve this, i had to change the centreon_plugins.exe.

i took an old version then without almost changing the ini file, it worked

try the version 20210427 from this build github.com/centreon/centreon-nsclient-build/releases/tag/20210518194507

Userlevel 1
Badge +9

Bonjour,

Après des tests croisés, je m'aperçois que depuis la version Centreon Plugins release 2022050400000. Les tests avec le plugin Veeam NSClient++ NRPE renvoi très souvent des erreurs "CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).". Le problème c'est que les version en deça ne contiennent pas le mode Repositories. C’est un problème.

Badge +1

Est-ce obsolète pour les développeurs ? ou un oublie ?

Badge

UP. j’ai le même souci 

Badge +6

UP same trouble here

Userlevel 1
Badge +4

same trouble for me.

 

Userlevel 2
Badge +4

Hello,

Thank you all for your patience, we have taken note of the problem and we will implement the strategy to address the issue in the best delay. Do not hesitate if you have any additional information or element to bring them to our attention.

Userlevel 4
Badge +12

Hi all,

If the issue comes from the plugin, then maybe we can get more information by runnin it directly on the Windows server.

Can you run this command?

"C:\Program Files\Centreon NSClient++\scripts\centreon\centreon_plugins.exe" --plugin=apps::backup::veeam::local::plugin --mode=job-status  --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose --debug

Feel free to run it several times and send the output here. It may help us a lot in the troubleshooting process.

Userlevel 1
Badge +9

Bonjour,

voici ce que me renvoi la commande en local.

PS C:\Program Files\Centreon NSClient++\scripts\centreon> .\centreon_plugins.exe --plugin apps::backup::veeam::local::plugin --mode=job-status --filter-end-time="86400" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --verbose --debug
UNKNOWN: Cannot decode json response: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "#< CLIXML\n<Objs Ver...") at C:\Windows\temp\par-41646d696e697374726174657572\cache-041a39e2bf0cf2311fc6f64e8ebbbc6239255a0e\inc\lib/apps/backup/veeam/local/mode/jobstatus.pm line 182.

 

Userlevel 4
Badge +12

It seems that the PowerShell script does not run as expected.

Here is the code that is executed by the plugin:

$culture = new-object "System.Globalization.CultureInfo" "en-us"    
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture

function Escape-JSONString($str) {
if ($str -eq $null) {return ""}
$str = $str.ToString().Replace('\\','\\\\').Replace('"','\"').Replace("`n",'\n').Replace("`r",'\r').Replace("`t",'\t')
return $str;
}

function ConvertTo-JSON-20($maxDepth = 4,$forceArray = $false) {
begin {
$data = @()
}
process{
$data += $_
}

end{
if ($data.length -eq 1 -and $forceArray -eq $false) {
$value = $data[0]
} else {
$value = $data
}

if ($value -eq $null) {
return "null"
}

$dataType = $value.GetType().Name

switch -regex ($dataType) {
'String' {
return "`"{0}`"" -f (Escape-JSONString $value )
}
'(System\.)?DateTime' {return "`"{0:yyyy-MM-dd}T{0:HH:mm:ss}`"" -f $value}
'Int16|Int32|Double' {return "$value"}
'Boolean' {return "$value".ToLower()}
'(System\.)?Object\[\]' { # array

if ($maxDepth -le 0){return "`"$value`""}

$jsonResult = ''
foreach($elem in $value){
#if ($elem -eq $null) {continue}
if ($jsonResult.Length -gt 0) {$jsonResult +=','}
$jsonResult += ($elem | ConvertTo-JSON-20 -maxDepth ($maxDepth -1))
}
return "[" + $jsonResult + "]"
}
'(System\.)?Hashtable' { # hashtable
$jsonResult = ''
foreach($key in $value.Keys){
if ($jsonResult.Length -gt 0) {$jsonResult +=','}
$jsonResult +=
@"
"{0}":{1}
"@ -f $key , ($value[$key] | ConvertTo-JSON-20 -maxDepth ($maxDepth -1) )
}
return "{" + $jsonResult + "}"
}
default { #object
if ($maxDepth -le 0){return "`"{0}`"" -f (Escape-JSONString $value)}

return "{" +
(($value | Get-Member -MemberType *property | % {
@"
"{0}":{1}
"@ -f $_.Name , ($value.($_.Name) | ConvertTo-JSON-20 -maxDepth ($maxDepth -1) )

}) -join ',') + "}"
}
}
}
}

$register_snaps=Get-PSSnapin -Registered
$all_snaps=Get-PSSnapin
$load_snaps=@("VeeamPSSnapin")
$registered=0
foreach ($snap_name in $load_snaps) {
if (@($register_snaps | Where-Object {$_.Name -Match $snap_name} ).count -gt 0) {
if (@($all_snaps | Where-Object {$_.Name -Match $snap_name} ).count -eq 0) {
Try {
$register_snaps | Where-Object {$_.Name -Match $snap_name} | Add-PSSnapin -ErrorAction STOP
$registered=1
} Catch {
Write-Host $Error[0].Exception
exit 1
}
}
}
}
if ($registered -eq 0) {
if (@(Get-Module | Where-Object {$_.Name -Match "Veeam.Backup.PowerShell"} ).count -eq 0) {
Try {
Import-Module -DisableNameChecking -Name "Veeam.Backup.PowerShell"
} Catch {
Write-Host $Error[0].Exception
exit 1
}
}
}

Try {
$ErrorActionPreference = "Stop"

$items = New-Object System.Collections.Generic.List[Hashtable];

$sessions = @{}
Get-VBRBackupSession | Sort CreationTimeUTC -Descending | ForEach-Object {
$jobId = $_.jobId.toString()
if (-not $sessions.ContainsKey($jobId)) {
$sessions[$jobId] = New-Object System.Collections.Generic.List[Hashtable];
$session = @{}
$session.result = $_.Result.value__
$session.creationTimeUTC = (get-date -date $_.CreationTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$session.endTimeUTC = (get-date -date $_.EndTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$sessions[$jobId].Add($session)
} elseif ($sessions[$jobId].Length -lt 2) {
$session = @{}
$session.result = $_.Result.value__
$session.creationTimeUTC = (get-date -date $_.CreationTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$session.endTimeUTC = (get-date -date $_.EndTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$sessions[$jobId].Add($session)
}
}

Get-VBRJob | ForEach-Object {
$item = @{}
$item.name = $_.Name
$item.type = $_.JobType.value__
$item.isRunning = $_.isRunning
$item.scheduled = $_.IsScheduleEnabled
$item.isContinuous = 0

if ($_.isContinuous -eq $true) {
$item.isContinuous = 1
}

$guid = $_.Id.Guid.toString()
if ($sessions.ContainsKey($guid)) {
$item.sessions = $sessions[$guid]
} else {
$item.sessions = New-Object System.Collections.Generic.List[Hashtable];
$session = @{}
$session.result = -10
$session.creationTimeUTC = ""
$session.endTimeUTC = ""
$item.sessions.Add($session)
}

$items.Add($item)
}

$jsonString = $items | ConvertTo-JSON-20 -forceArray $true
Write-Host $jsonString
} Catch {
Write-Host $Error[0].Exception
exit 1
}

Can you run it in your powershell console and post the results here?

It may behave differently with or without the Try/Catch, so try a second run in a second PowerShell console with this:

$culture = new-object "System.Globalization.CultureInfo" "en-us"    
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture

function Escape-JSONString($str) {
if ($str -eq $null) {return ""}
$str = $str.ToString().Replace('\\','\\\\').Replace('"','\"').Replace("`n",'\n').Replace("`r",'\r').Replace("`t",'\t')
return $str;
}

function ConvertTo-JSON-20($maxDepth = 4,$forceArray = $false) {
begin {
$data = @()
}
process{
$data += $_
}

end{
if ($data.length -eq 1 -and $forceArray -eq $false) {
$value = $data[0]
} else {
$value = $data
}

if ($value -eq $null) {
return "null"
}

$dataType = $value.GetType().Name

switch -regex ($dataType) {
'String' {
return "`"{0}`"" -f (Escape-JSONString $value )
}
'(System\.)?DateTime' {return "`"{0:yyyy-MM-dd}T{0:HH:mm:ss}`"" -f $value}
'Int16|Int32|Double' {return "$value"}
'Boolean' {return "$value".ToLower()}
'(System\.)?Object\[\]' { # array

if ($maxDepth -le 0){return "`"$value`""}

$jsonResult = ''
foreach($elem in $value){
#if ($elem -eq $null) {continue}
if ($jsonResult.Length -gt 0) {$jsonResult +=','}
$jsonResult += ($elem | ConvertTo-JSON-20 -maxDepth ($maxDepth -1))
}
return "[" + $jsonResult + "]"
}
'(System\.)?Hashtable' { # hashtable
$jsonResult = ''
foreach($key in $value.Keys){
if ($jsonResult.Length -gt 0) {$jsonResult +=','}
$jsonResult +=
@"
"{0}":{1}
"@ -f $key , ($value[$key] | ConvertTo-JSON-20 -maxDepth ($maxDepth -1) )
}
return "{" + $jsonResult + "}"
}
default { #object
if ($maxDepth -le 0){return "`"{0}`"" -f (Escape-JSONString $value)}

return "{" +
(($value | Get-Member -MemberType *property | % {
@"
"{0}":{1}
"@ -f $_.Name , ($value.($_.Name) | ConvertTo-JSON-20 -maxDepth ($maxDepth -1) )

}) -join ',') + "}"
}
}
}
}

$register_snaps=Get-PSSnapin -Registered
$all_snaps=Get-PSSnapin
$load_snaps=@("VeeamPSSnapin")
$registered=0
foreach ($snap_name in $load_snaps) {
if (@($register_snaps | Where-Object {$_.Name -Match $snap_name} ).count -gt 0) {
if (@($all_snaps | Where-Object {$_.Name -Match $snap_name} ).count -eq 0) {
Try {
$register_snaps | Where-Object {$_.Name -Match $snap_name} | Add-PSSnapin -ErrorAction STOP
$registered=1
} Catch {
Write-Host $Error[0].Exception
exit 1
}
}
}
}
if ($registered -eq 0) {
if (@(Get-Module | Where-Object {$_.Name -Match "Veeam.Backup.PowerShell"} ).count -eq 0) {
Try {
Import-Module -DisableNameChecking -Name "Veeam.Backup.PowerShell"
} Catch {
Write-Host $Error[0].Exception
exit 1
}
}
}

$ErrorActionPreference = "Stop"

$items = New-Object System.Collections.Generic.List[Hashtable];

$sessions = @{}
Get-VBRBackupSession | Sort CreationTimeUTC -Descending | ForEach-Object {
$jobId = $_.jobId.toString()
if (-not $sessions.ContainsKey($jobId)) {
$sessions[$jobId] = New-Object System.Collections.Generic.List[Hashtable];
$session = @{}
$session.result = $_.Result.value__
$session.creationTimeUTC = (get-date -date $_.CreationTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$session.endTimeUTC = (get-date -date $_.EndTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$sessions[$jobId].Add($session)
} elseif ($sessions[$jobId].Length -lt 2) {
$session = @{}
$session.result = $_.Result.value__
$session.creationTimeUTC = (get-date -date $_.CreationTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$session.endTimeUTC = (get-date -date $_.EndTimeUTC.ToUniversalTime() -Uformat ' . "'%s'" . ')
$sessions[$jobId].Add($session)
}
}

Get-VBRJob | ForEach-Object {
$item = @{}
$item.name = $_.Name
$item.type = $_.JobType.value__
$item.isRunning = $_.isRunning
$item.scheduled = $_.IsScheduleEnabled
$item.isContinuous = 0

if ($_.isContinuous -eq $true) {
$item.isContinuous = 1
}

$guid = $_.Id.Guid.toString()
if ($sessions.ContainsKey($guid)) {
$item.sessions = $sessions[$guid]
} else {
$item.sessions = New-Object System.Collections.Generic.List[Hashtable];
$session = @{}
$session.result = -10
$session.creationTimeUTC = ""
$session.endTimeUTC = ""
$item.sessions.Add($session)
}

$items.Add($item)
}

$jsonString = $items | ConvertTo-JSON-20 -forceArray $true
Write-Host $jsonString

Thank you in advance.

Userlevel 1
Badge +9

Hi,

the first script give me this in Powershell ISE :

System.Management.Automation.ParameterBindingException: A positional parameter cannot be found that accepts argument '%s" . '.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefi
ne, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo in
vocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
   at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input
, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine
, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object 
dollarUnder, Object input, Object scriptThis, Object[] args)
   at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()

 

The second script give me that:

ForEach-Object : A positional parameter cannot be found that accepts argument '%s" . '.
Au caractère Ligne:109 : 59
+ ... BRBackupSession | Sort CreationTimeUTC -Descending | ForEach-Object {
+                                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument : (:) [ForEach-Object], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.ForEachObjectCommand

Userlevel 4
Badge +12

Hi @SavCent,

Thank you for your answer. I’m trying to get help from colleagues since we have reached the limits of my skills in PowerShell (they’re pretty low).

Userlevel 2
Badge +6

Hello same problem here:

CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

 

And trying on the host directly with the plugin:

C:\Program Files\Centreon NSClient++>"C:\Program Files\Centreon NSClient++\scripts\centreon\centreon_plugins.exe" --plugin=apps::backup::veeam::local::plugin --mode=job-status  --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose --debug
UNKNOWN: Command too long to execute (timeout)…

 

Using VBR V12….

 

Any idea is welcome :)

 

 

Userlevel 2
Badge +6

 

where is the doc on the filters part ?

--filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long=""

 

how can i know how this filters works ?

 

parse all the return of Get-VBRBackupSession is not a good idea (thousand of lines here) it’s would be better if we can take the last 3 months for example. (not sure it’s possible)

 

Userlevel 4
Badge +12

Hi @Jumulus, the doc about these options is here: https://docs.centreon.com/pp/integrations/plugin-packs/procedures/applications-veeam-nrpe/#using-a-service-template-provided-by-the-connector

Reply