Centreon on Centos 5

General support questions including new installations
rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Centreon on Centos 5

Post by rskay » 2016/11/29 22:03:11

I did yum update on Centos 5 and upgrades perl 5.8.8 v41.el5 to v43.el5_11

I have centreon installed which uses perl as well. after the upgrade i am getting this error:

Code: Select all

# /usr/lib/nagios/plugins/./check_centreon_dummy -H 172.31.0.109 -s 0
Attempt to free unreferenced scalar: SV 0x60142f0, Perl interpreter: 0x5fee010 at /usr/lib/perl5/5.8.8/FindBin.pm line 101.
Segmentation fault
i check the FindBin.pm interpretor and the line refered to is

Code: Select all

use File::Spec;
on centreon a host is using passive checks is getting the error 'Service check did not exit properly'

how can i fix my isssue?

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Re: Centreon on Centos 5

Post by rskay » 2016/11/29 22:30:20

this is what i get when issue the following:
perl -e 'for (qw(Cwd File::Spec)) { eval "use $_; print qq{$_ \$${_}::VERSION\n}" }'

Code: Select all

# perl -e 'for (qw(Cwd File::Spec)) { eval "use $_; print qq{$_ \$${_}::VERSION\n}" }'
Cwd 3.63
File::Spec 3.63

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centreon on Centos 5

Post by TrevorH » 2016/11/30 01:16:29

Nagios plugins use their own embedded perl unless you tell it otherwise. There's some magic incantation you have to add to the perl script, within the first 20 lines or so, to disable the embedded perl and use the system one instead.

https://assets.nagios.com/downloads/nag ... dperl.html at the bottom of the page.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Re: Centreon on Centos 5

Post by rskay » 2016/11/30 05:27:52

Code: Select all

# nagios: +epn
Do i need to update the following with the embeded perl?

Code: Select all

# ls /etc/nagios/
nsca.cfg

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Re: Centreon on Centos 5

Post by rskay » 2016/11/30 07:26:02

i could see on Configuration > Commands > Connectors on Centreon GUI i could see two connectors specified:
  • Perl Connector
  • SSH Connector
is that the two files that i need to define whether to use emberded perl or not?

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centreon on Centos 5

Post by TrevorH » 2016/11/30 07:33:11

No, it's most likely to be in /usr/lib/nagios/plugins/./check_centreon_dummy
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Re: Centreon on Centos 5

Post by rskay » 2016/11/30 21:25:54

i added the embedded perl line in /usr/lib/nagios/plugins/.check_centreon_dummy to use or not to use and restart the centreon engine but the "service check did not exit properly" status information is still there

the check_centreon_dummy configuration

Code: Select all

use strict;
use FindBin;

use vars qw($PROGNAME);
use Getopt::Long;
use vars qw($opt_h $opt_s $opt_o);

################################################
##Tell Nagios to USE or NOT use Perl Interpreter
nagios: -epn

#################################################
### Plugin var init
##
$PROGNAME = "$0";

sub print_help ();
sub print_usage ();

Getopt::Long::Configure('bundling');
GetOptions
    ("h"   => \$opt_h, "help"         => \$opt_h,
     "s=s" => \$opt_s, "status=s"     => \$opt_s,
     "o=s" => \$opt_o, "output=s"     => \$opt_o);


##################################################
#### Verify Options
##

if ($opt_h) {
    print_help();
    exit 0;
}

if (!defined($opt_s)) {
    print_usage && exit 0;
}
if ($opt_s ne "0" && $opt_s ne "1" && $opt_s ne "2" && $opt_s ne "3") {
    print_usage;
    exit 0;
}
if (!$opt_o) {
    $opt_o = "OK";
}

#################################################
## result
#

$opt_o .= "\n";
print $opt_o;
exit $opt_s;

sub print_usage () {
    print "Usage: $PROGNAME -s 2 -o 'This service is CRITICAL'\n";
    print "   -s (--status)     Value between 0 and 3 to return the Nagios status (Required)\n";
    print "                             0 returns OK status\n";
    print "                             1 returns WARNING status\n";
    print "                             2 returns CRITICAL status\n";
    print "                             3 returns UNKNOWN status\n";
    print "   -o (--output)     Output message that must be returned (Default: 'OK')\n";
    print "   -h (--help)       Usage help\n";  
}

sub print_help () {
    print "##############################################\n";
    print "#    Copyright (c) 2004-2011 Centreon        #\n";
    print "#    Bugs to http://forge.centreon.com/      #\n";
    print "##############################################\n";
    print_usage();
    print "\n";   
}                  


User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centreon on Centos 5

Post by TrevorH » 2016/11/30 21:46:09

It's meant to be a comment. You omitted the # from the start of the line so it's probably being treated as code and causing a syntax error. The page I linked to also says it needs to be within the first 10 lines of the script and yours may be too far down to be seen.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Re: Centreon on Centos 5

Post by rskay » 2016/11/30 22:12:19

i realise that i have to include it early for nagios to recognise it...i added it on the first line of the check_centreon_dummy command

and now i am getting Status "unknow" and status information as "(No output returned from plugin)"

rskay
Posts: 12
Joined: 2016/11/18 02:50:12

Perl Interpreter Segment fault

Post by rskay » 2016/12/01 06:47:03

when i issue the check command i go the following error:

Code: Select all

# /usr/lib/nagios/plugins/check_centreon_dummy -h
Attempt to free unreferenced scalar: SV 0x3b1c3c0, Perl interpreter: 0x3af6010 at /usr/lib/perl5/5.8.8/FindBin.pm line 101.
Segmentation fault
i checked /usr/lib/perl5/5.8.8/FindBin.pm line 101 and it is refering to 'use File::Spec;'

Code: Select all

package FindBin;
use Carp;
require 5.000;
require Exporter;
use Cwd qw(getcwd cwd abs_path);
use Config;       
use File::Basename;
use File::Spec;  

@EXPORT_OK = qw($Bin $Script $RealBin $RealScript $Dir $RealDir);
%EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]);
@ISA = qw(Exporter);
when i run the command i get no error

Code: Select all

# perl -e 'use File::Spec;'
i get no errors even when i do CPAN either

Code: Select all

# cpan
Loading internal null logger. Install Log::Log4perl for logging messages
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.14)
Enter 'h' for help.

cpan[1]> 

Post Reply