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.
Passive Checks with LONGTEXT not shown correctly
-
hoschmieder
- Posts: 4
- Joined: Wed Dec 04, 2013 6:56 am
Re: Passive Checks with LONGTEXT not shown correctly
Can you show us the active and passive service check command definitions?
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.
"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.
-
hoschmieder
- Posts: 4
- Joined: Wed Dec 04, 2013 6:56 am
Re: Passive Checks with LONGTEXT not shown correctly
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
}
=============================================================
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
This is most likely a bug. What version of nagios core are you running?
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.
"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.
-
hoschmieder
- Posts: 4
- Joined: Wed Dec 04, 2013 6:56 am
Re: Passive Checks with LONGTEXT not shown correctly
we are running 4.0.2.
same we saw also with 4.0.1
same we saw also with 4.0.1
Re: Passive Checks with LONGTEXT not shown correctly
This is a bug. Please open up a bug report at: http://tracker.nagios.org
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.
"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.
-
hoschmieder
- Posts: 4
- Joined: Wed Dec 04, 2013 6:56 am
Re: Passive Checks with LONGTEXT not shown correctly
the bug report is still opened: http://tracker.nagios.org/view.php?id=543
Re: Passive Checks with LONGTEXT not shown correctly
Great. The bug will get updated on the tracker, so that is the best place to follow it progress.
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.
"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.