CHECK_NRPE: Received 0 bytes from daemon. Check the remote s

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

CHECK_NRPE: Received 0 bytes from daemon. Check the remote s

Post by hillhealthcenter »

I'm seeing this warning a lot lately for different hosts.

"CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages."

I've attached my system profile.
You do not have the required permissions to view the files attached to this post.
Thanks so much,
Tom
lcontreras
Posts: 48
Joined: Thu Sep 13, 2012 7:15 pm

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by lcontreras »

Hi,

Open your nrpe.cfg file and set dont_blame_nrpe=1

Then restart xinet.d service.
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by hillhealthcenter »

lcontreras,
Thanks for getting back to me.
I made the change that you suggested. However, I'm still receiving the same warning from random Windows hosts.
Thanks so much,
Tom
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by hillhealthcenter »

lcontreras,
Should be using NSVlient++ 0.3 or 0.4 on my windows hosts?
Thanks so much,
Tom
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by lmiltchev »

Should be using NSVlient++ 0.3 or 0.4 on my windows hosts?
Both should work with check_nrpe but you need to enable the NRPE listener first. Have you completed the steps, outlined in this document? What is the error that you are getting the nsclient.log?
Be sure to check out our Knowledgebase for helpful articles and solutions!
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by hillhealthcenter »

Code: Select all

2014-07-23 16:43:58: e:d:\source\nscp\trunk\modules\checkexternalscripts\commands.hpp:91: Failed to parse arguments for command 'check_updates', using old split string method: unknown escape sequence: cmd /c echo scripts\Check-Updates.ps1; exit $LastExitCode | powershell.exe -command -
Thanks so much,
Tom
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by abrist »

Could you post the external scripts command from your nsclient config for this check?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by hillhealthcenter »

Code: Select all

Param(
	[Parameter(Mandatory=$false)][Int]$GracePeriod
	)

Function Check-NewUpdates {

<#
	.SYNOPSIS
	    Get list of available Windows updates.

	.DESCRIPTION
        Use Check-NewUpdates to determine if there are additional updates that have not been applied to a Microsoft Windows machine. 
		
	.PARAMETER Type
		Pre-search criteria. Finds updates of a specific type, such as 'Driver' and 'Software'. Default value contains all updates.


	.EXAMPLE
		Get list of available updates from Microsoft Update Server, no matter how recent the last check was.
	
		PS D:\Powershell> .\Check-Updates.ps1
            35 Days since last update.
            2 Critical Updates:
            KB2792100
            KB2797052
            6 Important Updates:
            KB2778344
            KB2789642
            KB2789645
            KB2790113
            KB2799494
            KB954430
            1 Moderate Updates:
            KB2790655
            4 Unknown Updates:
            KB890830
            KB915597
            KB971033
            KB973688

    .EXAMPLE
		Get list of available updates from Microsoft Update Server, if last check was outside of grace period.
	
        PS D:\Powershell> .\Check-Updates.ps1 50
            35 Days since last update. Within grace period

		PS D:\Powershell> .\Check-Updates.ps1 50
            35 Days since last update.
            2 Critical Updates:
            KB2792100
            KB2797052
            6 Important Updates:
            KB2778344
            KB2789642
            KB2789645
            KB2790113
            KB2799494
            KB954430
            1 Moderate Updates:
            KB2790655
            4 Unknown Updates:
            KB890830
            KB915597
            KB971033
            KB973688

	.NOTES
		Author: Spenser Reinhardt
        Company: Nagios Enterprises LLC
		Version: 1.0

	.LINK
		http://www.nagios.com

	#>

Param(
	[Parameter(Mandatory=$false)][Int]$GracePeriod
	)

## Start Main Script

$OSVersion = Check-OSVersion

If ( $GracePeriod -ne $null ) { #If GracePeriod is set
	$UpdateTime = Check-LastUpdate $GracePeriod
	
	If ($UpdateTime.IsOver -eq $true) { #If is outside of GP, check for updates and return
		$Updates = Check-Updates
		$Output = Create-Output $Updates
	}
	ElseIF ($UpdateTime.IsOver -eq $false) { #If within GP, return days since check with OK status
        $Output = @{}
        $Output.Output = "Within grace period."
        $Output.ExitCode = 0
	}
} #ends if GP is set
	
Else { # If no grace period has been set, check and return
	$UpdateTime = Check-LastUpdate 0
	$Updates = Check-Updates
	$Output = Create-Output $Updates
}

$days = $UpdateTime.Days
$OutputString = $Output.Output
Write-Output "$days Days since last update. $OutputString"
Exit $Output.ExitCode
}

# Function to check OS Version and return string with 7 or XP depending. Returns [string]
Function Check-OSVersion {
    
    $version = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
    
    switch ($($version.CurrentVersion).split(".")[0]){
        6 { [string]$Return = "7" }
        5 { [string]$Return = "XP" }
    } ## End of Switch to check versioning
    
    Return $Return

} ## End of Function

# Checks for updates using winupdate api, returns hashtable with all listed updates not including hidden ones. Returns [Array](KBImportance)KB and [Int](KBImportance)Number
Function Check-Updates {
	
	$Return = @{}
	[string]$Return.CriticalKB = ""
	[Int]$Return.CriticalNumber = 0
	[string]$Return.ImportantKB = ""
	[Int]$Return.ImportantNumber = 0
	[string]$Return.ModerateKB = ""
	[Int]$Return.ModerateNumber = 0
	[string]$Return.LowKB = ""
	[Int]$Return.LowNumber = 0
    [string]$Return.UnknownKB = ""
	[Int]$Return.UnknownNumber = 0
	
	$Updates = $( New-Object -ComObject Microsoft.Update.Session ).CreateUpdateSearcher().Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0").Updates
	
	$Updates | Where {$_.MsrcSeverity -eq "Critical" } |  ForEach-Object { $_.KbArticleIDs } | Sort -Unique | ForEach-Object { 
			$Return.CriticalNumber++
			$Return.CriticalKB += "KB"+$_+"\n"
			}
			
	$Updates | Where {$_.MsrcSeverity -eq "Important" } |  ForEach-Object { $_.KbArticleIDs } | Sort -Unique | ForEach-Object {
			$Return.ImportantNumber++
			$Return.ImportantKB += "KB"+$_+"\n"
			}
		
	$Updates | Where {$_.MsrcSeverity -eq "Moderate" } |  ForEach-Object { $_.KbArticleIDs } | Sort -Unique | ForEach-Object { 
			$Return.ModerateNumber++
			$Return.ModerateKB += "KB"+$_+"\n"
			}
			
	$Updates | Where {$_.MsrcSeverity -eq "Low" } |  ForEach-Object { $_.KbArticleIDs } | Sort -Unique | ForEach-Object {
			$Return.LowNumber++
			$Return.LowKB += "KB"+$_+"\n"
			}

    $Updates | Where-Object {!$_.MsrcSeverity} |  ForEach-Object { $_.KbArticleIDs } | Sort -Unique | ForEach-Object {
			$Return.UnknownNumber++
			$Return.UnknownKB += "KB"+$_+"\n"
			}
	
	Return $Return
} # Ends Function

# Checks if last update installed was within Grace Period, Returns [Int]Days and [Boolean]IsOver
Function Check-LastUpdate {

	Param([Parameter(Mandatory=$true)][Int]$GracePeriod)
	
	$Return = @{}
	
	#Gets DateTime Object with last update installed
	if ($(Check-OSVersion) -eq "7") {
		$WMIData = Get-WmiObject -Class Win32_QuickFixEngineering 
	}
	Else { $WMIData = $null }
	
    If ( $WMIData -eq $null ) { ## No data for installed on, run update check, might be issue with os version too
        
        $Return.Days = 0
        $Return.IsOver = $true
    }
    
    Else { ## has data and should be processed
        
        [DateTime]$Date = $( $WMIData | Sort InstalledOn -Descending -Unique | Select InstalledOn -First 1 ).InstalledOn
        
        $Return.Days =  $( $(Get-Date) - $Date).Days
    	
    	If ( $Return.Days -gt $GracePeriod ) { #if true has been longer than grace period
    		
    		$Return.IsOver = $true
    	}
    	Else { #if within Grace Period
    	
    		$Return.IsOver = $false
    	}
    }
    
	Return $Return
}

# Creates write-ouput text for returning data to nagios, Returns [int]ExitCode and [string]Output
Function Create-Output {
	Param ( [Parameter(Mandatory=$true)]$Updates )
	
	$Return = @{}
	[Int]$Return.ExitCode = 3 # Sets to unknown by default
	[String]$Return.Output = "Output creation failed, something is not working!"
	
	If ( $Updates.CriticalNumber -gt 0 ) { # If any Critical updates, writes output line and sets exit code to 2(critical)
		$Return.ExitCode = 2
		$Return.Output = "`n"+$Updates.CriticalNumber+" Critical Updates:"
		
		$Return.Output += "`n"+$Updates.CriticalKB.Replace("\n","`n")
		

		If ($Updates.ImportantNumber -gt 0)	{$Return.Output += ""+$Updates.ImportantNumber+" Important Updates:`n"
											 $Return.Output += $Updates.ImportantKB.Replace("\n","`n")
		    								}		
		If ($Updates.ModerateNumber -gt 0) 	{$Return.Output += ""+$Updates.ModerateNumber+" Moderate Updates:`n"
											 $Return.Output += $Updates.ModerateKB.Replace("\n","`n")
											}		
		If ($Updates.LowNumber -gt 0) 		{$Return.Output += ""+$Updates.LowNumber+" Low Updates:`n"
											 $Return.Output += $Updates.LowKB.Replace("\n","`n")
											}
        If ($Updates.UnknownNumber -gt 0)	{$Return.Output += ""+$Updates.UnknownNumber+" Unknown Updates:`n"
											 $Return.Output += $Updates.UnknownKB.Replace("\n","`n")
											}

	} #Ends Critical If
	
	ElseIf ( $Updates.ImportantNumber -gt 0 ) { # If any Important updates, writes output line and sets exit code to 2(critical)
		$Return.ExitCode = 2
		$Return.Output = "`n"+$Updates.ImportantNumber+" Important Updates:"
		
		$Return.Output += "`n"+$Updates.ImportantKB.Replace("\n","`n")
		
		If ($Updates.ModerateNumber -gt 0) 	{$Return.Output += ""+$Updates.ModerateNumber+" Moderate Updates:`n"
											 $Return.Output += $Updates.ModerateKB.Replace("\n","`n")
											}		
		If ($Updates.LowNumber -gt 0) 		{$Return.Output += ""+$Updates.LowNumber+" Low Updates:`n"
											 $Return.Output += $Updates.LowKB.Replace("\n","`n")
											}
        If ($Updates.UnknownNumber -gt 0)	{$Return.Output += ""+$Updates.UnknownNumber+" Unknown Updates:`n"
											 $Return.Output += $Updates.UnknownKB.Replace("\n","`n")
											}
	} #Ends Important If

	ElseIf ( $Updates.ModerateNumber -gt 0 ) { # If any Moderate updates, writes output line and sets exit code to 1(Warning)
			$Return.ExitCode = 1
			$Return.Output = "`n"+$Updates.ModerateNumber+" Moderate Updates:"
			
			$Return.Output += "`n"+$Updates.ModerateKB.Replace("\n","`n")
			
			If ($Updates.LowNumber -gt 0) 		{$Return.Output += ""+$Updates.LowNumber+" Low Updates:`n"
												 $Return.Output += $Updates.LowKB.Replace("\n","`n")
											}
            If ($Updates.UnknownNumber -gt 0) 	{$Return.Output += ""+$Updates.UnknownNumber+" Unknown Updates:`n"
												 $Return.Output += $Updates.UnknownKB.Replace("\n","`n")
											}
		} #Ends Moderate If
	
	ElseIf ( $Updates.LowNumber -gt 0 ) { # If any Low updates, writes output line and sets exit code to 1(Warning)
		    $Return.ExitCode = 1
		    $Return.Output = "`n"+$Updates.LowNumber+" Low Updates:"
		
		    $Return.Output += "`n"+$Updates.LowKB.Replace("\n","`n")
            If ($Updates.UnknownNumber -gt 0) 	{$Return.Output += ""+$Updates.UnknownNumber+" Unknown Updates:`n"
												 $Return.Output += $Updates.UnknownKB.Replace("\n","`n")
											}
            
		
	} #Ends Low If
    
    ElseIf ($Updates.UnknownNumber -gt 0) { # If number of unknown severity updates are available sets exit to 1(warning)
        $Return.ExitCode = 1
		$Return.Output = "`n"+$Updates.UnknownNumber+" Unknown Updates:"
		
		$Return.Output += "`n"+$Updates.UnknownKB.Replace("\n","`n")
    }

	ElseIf ( ($Updates.CriticalNumber -eq 0) -and ($Updates.ImportantNumber -eq 0) -and ($Updates.ModerateNumber -eq 0) -and ($Updates.LowNumber -eq 0) -and ($Updates.UnknownNumber -eq 0) ) { #If no updates, writes output and sets exit 0(OK)
		$Return.ExitCode = 0
		$Return.Output = "There are no updates to be done."
	}
	
	Return $Return
}

Check-NewUpdates $GracePeriod
Thanks so much,
Tom
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by lmiltchev »

Actually, post the entire NSC.ini (or nsclient.ini) file. Hide the sensitive info (IPs, passwords, etc.).
Be sure to check out our Knowledgebase for helpful articles and solutions!
hillhealthcenter
Posts: 174
Joined: Fri Sep 21, 2012 7:45 am
Location: New Haven, CT

Re: CHECK_NRPE: Received 0 bytes from daemon. Check the remo

Post by hillhealthcenter »

Code: Select all

; Undocumented section


[/modules]

; CheckDisk - CheckDisk can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckDisk = 1

; Event log Checker. - Check for errors and warnings in the event log. This is only supported through NRPE so if you plan to use only NSClient this wont help you at all.
CheckEventLog = 1

; Check External Scripts - A simple wrapper to run external scripts and batch files.
CheckExternalScripts = 1

; Helper function - Various helper function to extend other checks. This is also only supported through NRPE.
CheckHelpers = 1

; Check NSCP - Checkes the state of the agent
CheckNSCP = 1

; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = 1

; CheckWMI - CheckWMI can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckWMI = 1

; NRPE server - A simple server that listens for incoming NRPE connection and handles them. NRPE is preferred over NSClient as it is more flexible. You can of cource use both NSClient and NRPE.
NRPEServer = 1

; NSClient server - A simple server that listens for incoming NSClient (check_nt) connection and handles them. Although NRPE is the preferred method NSClient is fully supported and can be used for simplicity or for compatibility.
NSClientServer = 1


; Undocumented section
[/settings/default]

; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = 192.168.100.xxx


; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]


; Section for system checks and system settings
[/settings/check/system/windows]


; Confiure which services has to be in which state
[/settings/check/system/windows/service mapping]


; Configure crash handling properties.
[/settings/crash]


; Section for the EventLog Checker (CheckEventLog.dll).
[/settings/eventlog]


; A set of options to configure the real time checks
[/settings/eventlog/real-time]


; A set of filters to use in real-time mode
[/settings/eventlog/real-time/filters]


; Section for external scripts configuration options (CheckExternalScripts).
[/settings/external scripts]


; A list of aliases available. An alias is an internal command that has been "wrapped" (to add arguments). Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[/settings/external scripts/alias]


; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
check_updates=cmd /c echo scripts\Check-Updates.ps1; exit $LastExitCode | powershell.exe -command -


; A list of wrappped scripts (ie. using the template mechanism)
[/settings/external scripts/wrapped scripts]


; A list of templates for wrapped scripts
[/settings/external scripts/wrappings]


; Section for configuring the log handling.
[/settings/log]


; Configure log file properties.
[/settings/log/file]


; Section for configuring the shared session.
[/settings/shared session]


; A list of avalible remote target systems
[/settings/targets]


; Section for NRPE (NRPEListener.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]
Thanks so much,
Tom
Locked