From 8c2ed7124f04f4aa198c8d17a2b477cf2e2383b1 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Wed, 29 Oct 2014 11:30:30 +0100 Subject: [PATCH] + better management + Fix openssl infos --- .../vmware/doc/en/exploitation/index.rst | 2 +- .../vmware/doc/fr/exploitation/index.rst | 2 +- connectors/vmware/src/centreon/esxd/common.pm | 26 +++++++++++++++++++ .../vmware/src/centreon/esxd/connector.pm | 16 +----------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/connectors/vmware/doc/en/exploitation/index.rst b/connectors/vmware/doc/en/exploitation/index.rst index 6db7b05fc..86c75d681 100644 --- a/connectors/vmware/doc/en/exploitation/index.rst +++ b/connectors/vmware/doc/en/exploitation/index.rst @@ -71,7 +71,7 @@ It is possible to get this kind of errors in the « logs » of « centreon-es ...SOAP request error - possibly a protocol issue: read failed: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac... -VMWare Perl SDK sometimes generates this error that does not alter the behaviour of the connector. +VMWare Perl SDK sometimes generates this error that does not alter the behaviour of the connector. The bug comes from OpenSSL. It should be fix in OpenSSL 1.0.1h (CVE-2010-5298). It is necessary to create an incident in case there are too many connections error between the daemon and the VirtualCenter. diff --git a/connectors/vmware/doc/fr/exploitation/index.rst b/connectors/vmware/doc/fr/exploitation/index.rst index ca75ea1c9..30cf919e5 100644 --- a/connectors/vmware/doc/fr/exploitation/index.rst +++ b/connectors/vmware/doc/fr/exploitation/index.rst @@ -72,7 +72,7 @@ Il est possible de retrouver des erreurs de ce type dans les « logs » de « ...SOAP request error - possibly a protocol issue: read failed: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac... -Le SDK Perl VMWare génère cette erreur de temps en temps mais ne bloque pas le fonctionnement du connecteur. +Le SDK Perl VMWare génère cette erreur de temps en temps mais ne bloque pas le fonctionnement du connecteur. Le bug provient d'OpenSSL. Il devrait être fix dans la version 1.0.1h (CVE-2010-5298). Il est nécessaire de remonter un problème dans le cas d'un trop grand nombres de déconnexion du daemon au VirtualCenter. diff --git a/connectors/vmware/src/centreon/esxd/common.pm b/connectors/vmware/src/centreon/esxd/common.pm index 93fabc79f..f6ccafaf5 100644 --- a/connectors/vmware/src/centreon/esxd/common.pm +++ b/connectors/vmware/src/centreon/esxd/common.pm @@ -93,6 +93,32 @@ sub connect_vsphere { return 0; } +sub heartbeat { + my (%options) = @_; + my $stime; + + eval { + $stime = $options{connector}->{session1}->get_service_instance()->CurrentTime(); + $options{connector}->{keeper_session_time} = time(); + }; + if ($@) { + $options{connector}->{logger}->writeLogError("$@"); + # Try a second time + eval { + $stime = $options{connector}->{session1}->get_service_instance()->CurrentTime(); + $options{connector}->{keeper_session_time} = time(); + }; + if ($@) { + $options{connector}->{logger}->writeLogError("$@"); + $options{connector}->{logger}->writeLogError("'" . $options{connector}->{whoaim} . "' Ask a new connection"); + # Ask a new connection + $options{connector}->{last_time_check} = time(); + } + } + + $options{connector}->{logger}->writeLogInfo("'" . $options{connector}->{whoaim} . "' Get current time = " . Data::Dumper::Dumper($stime)); +} + sub simplify_number { my ($number, $cnt) = @_; $cnt = 2 if (!defined($cnt)); diff --git a/connectors/vmware/src/centreon/esxd/connector.pm b/connectors/vmware/src/centreon/esxd/connector.pm index 5a0b34c24..ca6e78dbf 100644 --- a/connectors/vmware/src/centreon/esxd/connector.pm +++ b/connectors/vmware/src/centreon/esxd/connector.pm @@ -1,4 +1,3 @@ -#!/usr/bin/perl -w package centreon::esxd::connector; @@ -271,20 +270,7 @@ sub run { ### if (defined($connector->{keeper_session_time}) && (time() - $connector->{keeper_session_time}) > ($connector->{config_vsphere_session_heartbeat} * 60)) { - my $stime; - - eval { - $stime = $connector->{session1}->get_service_instance()->CurrentTime(); - $connector->{keeper_session_time} = time(); - }; - if ($@) { - $connector->{logger}->writeLogError("$@"); - $connector->{logger}->writeLogError("'" . $connector->{whoaim} . "' Ask a new connection"); - # Ask a new connection - $connector->{last_time_check} = time(); - } else { - $connector->{logger}->writeLogInfo("'" . $connector->{whoaim} . "' Get current time = " . Data::Dumper::Dumper($stime)); - } + centreon::esxd::common::heartbeat(connector => $connector); } my $data_element;