Page 2 of 2

Re: Plugin_ouput issue

Posted: Thu Apr 09, 2015 11:13 am
by Sacotram
Hi again!

These are my configurations for both servers (server2 and working server):
Working Server:

submit_service_check

Code: Select all

#!/bin/sh
# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = return_code (An integer that determines the state
#       of the service check, 0=OK, 1=WARNING, 2=CRITICAL,
#       3=UNKNOWN).
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service check)
#
#  $5 = $LONGSERVICEOUTPUT$
#  $6 = $SERVICESTATETYPE$ (= SOFT ou HARD)
#  $7 = $SERVICEPERFDATA$

# Convert the state string to the corresponding return code
	return_code=-1
	myfirst=`expr substr "$4" 1 1`

	case "$3" in
    	    OK)
        	        return_code=0
            	    ;;
	        WARNING)
    	            return_code=1
        	        ;;
	        CRITICAL)
    	            return_code=2
        	        ;;
	        UNKNOWN)
    	            return_code=-1
        	        ;;
	esac
 
# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring ser

	case "$6" in 
		HARD)
		printf "%s\t%s\t%s\t%s\n%s\n" "$1" "$2" "$return_code" "$4|$7"  | /usr/local/nagios/bin/send_nsca IP_ADDRESS_SERVER1 -c /etc/send_nsca.cfg
		;;
		*)
		esac

echocmd="/bin/echo"
 
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
 
# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`
 
# create the command line to add to the command file
cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4"
 
# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`
Command definition

Code: Select all

define command{
        command_name    submit_service_check
        command_line    /usr/local/nagios/etc/TMS/submit_service_check $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$' '$LONGSERVICEOUTPUT$' '$SERVICESTATETYPE$' '$SERVICEPERFDATA$'
        }
Server2:

Code: Select all

#!/bin/sh

# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = return_code (An integer that determines the state
#       of the service check, 0=OK, 1=WARNING, 2=CRITICAL,
#       3=UNKNOWN).
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service check)
#
#  $5 = $LONGSERVICEOUTPUT$
#  $6 = $SERVICESTATETYPE

# Convert the state string to the corresponding return code
	return_code=-1
	myfirst=`expr substr "$4" 1 1`

	case "$3" in
    	    OK)
        	        return_code=0
            	    ;;
	        WARNING)
    	            return_code=1
        	        ;;
	        CRITICAL)
    	            return_code=2
        	        ;;
	        UNKNOWN)
    	            return_code=-1
        	        ;;
	esac
 
# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring ser

	case "$6" in 
		HARD)
		printf "%s\t%s\t%s\t%s\n%s\n" "$1" "$2" "$return_code" "$4|$7"  | /usr/sbin/send_nsca IP_ADDRESS_SERVER1 -c /usr/local/nagios/etc/send_nsca.cfg
		;;
		*)
		esac

echocmd="/bin/echo"
 
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
 
# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`
 
# create the command line to add to the command file
cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4"
 
# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`
#printf "%s: %s %s %s %s\n" "`date`" "$1" "$2" "$return_code :: $3  | $4" "$5" >> /bash/ocsp_command.log
Command definition

Code: Select all

define command{
        command_name    submit_service_check
        command_line    /usr/local/nagios/etc/TMS/submit_service_check $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$' '$LONGSERVICEOUTPUT$' '$SERVICESTATETYPE$' '$SERVICEPERFDATA$'
        }
Forgive me for dumping all the information in here but these are the configurations I have for both Server2 and the working server.
Do you see any difference because I can't. I know I'm missing something but I am completely lost in here.

EDIT: I realized just now that the versions of the check_nrpe is different in both servers. Do you think that this might be the reason why the plugin_output is filled with all information in one server and in the other is not?
Thank you

Re: Plugin_ouput issue

Posted: Thu Apr 09, 2015 5:23 pm
by tgriep
What are the version of check_nrpe that are running on each server?
Also what is the version of send_nsca on each server and could you post the send_nsca.cfg file for each server?

Re: Plugin_ouput issue

Posted: Fri Apr 10, 2015 5:15 am
by Sacotram
Hello again!

The information you asked is below:

Working server:

send_nsca version

Code: Select all

NSCA Client 2.7.2
Copyright (c) 2000-2007 Ethan Galstad (www.nagios.org)
Last Modified: 07-03-2007
License: GPL v2
Encryption Routines: NOT AVAILABLE
send_nsca.cfg

Code: Select all

# ENCRYPTION PASSWORD
# This is the password/passphrase that should be used to encrypt the
# outgoing packets.  Note that the nsca daemon must use the same
# password when decrypting the packet!
# IMPORTANT: You don't want all the users on this system to be able
# to read the password you specify here, so make sure to set
# restrictive permissions on this config file!
#
password=password


# ENCRYPTION METHOD
# Note: The encryption method you specify here must match the
#       decryption method the nsca daemon uses (as specified in
#       the nsca.cfg file)!!
# Values:
#       0 = None        (Do NOT use this option)
#       1 = Simple XOR  (No security, just obfuscation, but very fast)
#
encryption_method=1
dencryption_method=1
check_nrpe version

Code: Select all

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.12
Last Modified: 03-10-2008
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
NSClient ++ version in the Backup Server

Code: Select all

../libexec/check_nrpe -H IP_ADDRESS
I (0.3.9.322 2011-07-04) seem to be doing fine...

Server2:

send_nsca version

Code: Select all

NSCA Client 2.7.2
Copyright (c) 2000-2007 Ethan Galstad (www.nagios.org)
Last Modified: 07-03-2007
License: GPL v2
Encryption Routines: NOT AVAILABLE
send_nsca.cfg

Code: Select all

# ENCRYPTION PASSWORD
# This is the password/passphrase that should be used to encrypt the
# outgoing packets.  Note that the nsca daemon must use the same
# password when decrypting the packet!
# IMPORTANT: You don't want all the users on this system to be able
# to read the password you specify here, so make sure to set
# restrictive permissions on this config file!
#
password=password


# ENCRYPTION METHOD
# Note: The encryption method you specify here must match the
#       decryption method the nsca daemon uses (as specified in
#       the nsca.cfg file)!!
# Values:
#       0 = None        (Do NOT use this option)
#       1 = Simple XOR  (No security, just obfuscation, but very fast)
#
encryption_method=1
dencryption_method=1
check_nrpe version

Code: Select all

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.12
Last Modified: 03-10-2008
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
NSClient ++ version in the Backup Server

Code: Select all

../libexec/check_nrpe -H IP_ADDRESS
I (0,4,1,102 2013-07-15) seem to be doing fine...
I even included the NSClient version for both Backup Servers (the service check is about checking the backups in a Backup Server, as I written in the initial post), which is the only difference I found.
Anyway I concatenated the output and the long_output in the server2's submit_service_check file and I am getting all the information now, but I still don't understand why in the other server I didn't have to.
Thanks

Re: Plugin_ouput issue

Posted: Fri Apr 10, 2015 12:24 pm
by scottwilkerson
You are using 2 different versions of NSClient++ and it has been known to have bugs in newer versions...

Re: Plugin_ouput issue

Posted: Mon Apr 13, 2015 2:45 am
by Box293
FYI, if you receive NSCA checks from NSClient++ 0.3.9 and below you MUST use NSCA version 2.7.2. Newer versions of NSCA are not friendly with the old version of NSClient++ 0.3.9.

Can you run this command on both servers please and post the output of the versions:

Code: Select all

/usr/local/nagios/bin/nsca --help

Re: Plugin_ouput issue

Posted: Fri Apr 17, 2015 8:38 am
by Sacotram
Sorry for taking so long.
I believe I have showed in the previous posts the version of nsca for both servers and it's the same for both: 2.7.2.

Thank you

Re: Plugin_ouput issue

Posted: Fri Apr 17, 2015 2:20 pm
by tgriep
Can you install the same version version of NSClient++ on the failing server that is running on the working server and see if that fixes it?

Re: Plugin_ouput issue

Posted: Mon May 04, 2015 12:29 pm
by Sacotram
Hello!

No I can't install but I now comprehend that the issue is in the NSClient version.
Anyway I got a workaround by concatenating the output and the longoutput. It's working.
Thank you for all the patience and help.

Best regards

Re: Plugin_ouput issue

Posted: Mon May 04, 2015 12:30 pm
by abrist
Awesome! Locking thread. Have a great week.