Page 1 of 1

Passive Checks with LONGTEXT not shown correctly

Posted: Wed Dec 04, 2013 8:32 am
by hoschmieder
Hi,
i believe this is a bug, anyway, maybe there is an idea for an workaround or an hint on what i am doing wrong:
Following problem:
if i write the output of an service- plugin to nagios.cmd, the output is not spitted into the two parts: SERVICEOUTPUT and LONGSERVICEOUTPUT.
The same plugin working as active check shows the output as expected.

Attached you'll see the screenshot of an example.
- the output 1. line is the active_check result
- the 2. line came from passive check

Thanks for every idea.

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Wed Dec 04, 2013 1:04 pm
by abrist
Can you show us the active and passive service check command definitions?

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Sat Dec 07, 2013 3:36 am
by hoschmieder
Hi, thanks for your feedback. Unfortunaly i saw it right now.
I wrote a short test script to show you whats wrong. (see below)

In the attached picture you'll find the output.
There you see, that while active check puts the 2++ lines into the long output, the passive check puts all them together.

Any ideas ?
Thanks
Holger


file: /etc/nagios/test_passive.pl
=============================================================
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Std;
my $nagcmd="/var/nagios/rw/nagios.cmd";

our($opt_H,$opt_T);
getopts('H:T:');

my $host=$opt_H;
my $checktyp=$opt_T;
my $servicename="Test ".$opt_T;
my $status="0";


my $outtext="Testcheck [OK] This is a test-check";
my $longout="Line 1\nLine 2\nLine 3";
my $perfdata=" | result=10;70;70; ";



if($checktyp eq "passive"){
my $outp="[".time()."] PROCESS_SERVICE_CHECK_RESULT;$host;$servicename;$status;$outtext";
$longout=~s/\n/\\n/g;
$outp.="\\n$longout $perfdata";
print $outp;
open(CM,">>".$nagcmd);
print CM $outp."\n";
close CM;
exit $status;
}elsif($checktyp eq "active"){
print "$outtext\n$longout $perfdata \n";
exit $status;

}else{
print "please choose ether -T active OR -T passive\n";
}
=============================================================

file: /etc/nagios/test1.cfg
=============================================================
define command{
command_name test_check
command_line /etc/nagios/test_passive.pl -H $HOSTADDRESS$ -T $ARG1$
}

define host {
max_check_attempts 4
check_command check_host_alive
active_checks_enabled 1
icon_image nagios.gif
host_name nagios-Server
address 2.2.0.15
passive_checks_enabled 1
contact_groups Mailsystem_SCHMIEDER
}

define service {
active_checks_enabled 0
use 4Stunden
passive_checks_enabled 1
service_description Test passive
name Test passive
check_command test_check!passive
host_name nagios-Server
}

define service {
active_checks_enabled 1
use 4Stunden
passive_checks_enabled 0
service_description Test aktive
name Test active
check_command test_check!active
host_name nagios-Server
}
=============================================================

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Mon Dec 09, 2013 12:01 pm
by abrist
This is most likely a bug. What version of nagios core are you running?

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Tue Dec 10, 2013 5:58 am
by hoschmieder
we are running 4.0.2.
same we saw also with 4.0.1

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Tue Dec 10, 2013 11:36 am
by abrist
This is a bug. Please open up a bug report at: http://tracker.nagios.org

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Thu Dec 12, 2013 2:33 am
by hoschmieder
the bug report is still opened: http://tracker.nagios.org/view.php?id=543

Re: Passive Checks with LONGTEXT not shown correctly

Posted: Thu Dec 12, 2013 10:31 am
by abrist
Great. The bug will get updated on the tracker, so that is the best place to follow it progress.