+ Version 2.0 connector vmware
This commit is contained in:
parent
fa6ff00566
commit
ce35549972
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use centreon::script::centreonesxd;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
|
||||
centreon::script::centreonesxd->new()->run();
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
centreon_esxd - a daemon to handle VMWare checks.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
centreon_esxd [options]
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--config-extra>
|
||||
|
||||
Specify the path to the centreonesxd configuration file (default: /etc/centreon/centreon_esxd.pm).
|
||||
|
||||
=item B<--help>
|
||||
|
||||
Print a brief help message and exits.
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<centreon_esxd> will connect to ESX and/or VirtualCenter. Use the script 'centreon_esx_client.pl'
|
||||
to do checks through the daemon.
|
||||
|
||||
=cut
|
|
@ -1,2 +0,0 @@
|
|||
# centreon_esxd command line options
|
||||
OPTIONS="--logfile=/var/log/centreon/centreon_esxd.log --severity=error"
|
|
@ -5,9 +5,9 @@ Exploitation
|
|||
Generals Principles
|
||||
-------------------
|
||||
|
||||
Centreon-esxd is a Perl program in charged to get back VMWare indicators. This program uses the SDK Perl provided by VMWare in order to connect and get back the informations of one (or more) Virtual Center. To do this, it makes a TCP connection with the VirtualCenter.
|
||||
Centreon-vmware is a Perl program in charged to get back VMWare indicators. This program uses the SDK Perl provided by VMWare in order to connect and get back the informations of one (or more) Virtual Center. To do this, it makes a TCP connection with the VirtualCenter.
|
||||
|
||||
By default "centreon-esxd" starts at least two processes (named "handle-client" and "handle-vsphere-xxxx") :
|
||||
By default "centreon-vmware" starts at least two processes (named "handle-client" and "handle-vsphere-xxxx") :
|
||||
|
||||
*« handle-client »*:
|
||||
*Process waiting for requests of clients.*
|
||||
|
@ -25,7 +25,7 @@ Steps of operation :
|
|||
|
||||
Then, this process gets back the VMWare indicators creating a subprocess per request.
|
||||
|
||||
Centreon-esxd necessitates the utilization of one (or more) VirtualCenter (or ESX).
|
||||
Centreon-vmware necessitates the utilization of one (or more) VirtualCenter (or ESX).
|
||||
This is a example of a distributed architecture :
|
||||
|
||||
.. image:: ../images/archi.png
|
||||
|
@ -33,15 +33,15 @@ This is a example of a distributed architecture :
|
|||
Operating mode
|
||||
--------------
|
||||
|
||||
The "centreon-esxd" program only works in "daemon" mode (a client is needed).
|
||||
The "centreon-vmware" program only works in "daemon" mode (a client is needed).
|
||||
|
||||
Connector configuration
|
||||
-----------------------
|
||||
|
||||
The « centreon-esxd » daemon is configured with the « centreon_esxd.pm » configuration file:
|
||||
The « centreon-vmware » daemon is configured with the « centreon_vmware.pm » configuration file:
|
||||
::
|
||||
|
||||
%centreonesxd_config = (
|
||||
%centreon_vmware_config = (
|
||||
vsphere_server => {
|
||||
'default' => {'url' => 'https://vcenter/sdk',
|
||||
'username' => 'test@test.fr',
|
||||
|
@ -53,7 +53,7 @@ The « centreon-esxd » daemon is configured with the « centreon_esxd.pm »
|
|||
In case you have many VirtualCenters, the configuration is (note the use of "," as a separator):
|
||||
::
|
||||
|
||||
%centreonesxd_config = (
|
||||
%centreon_vmware_config = (
|
||||
vsphere_server => {
|
||||
'default' => {'url' => 'https://vcenter/sdk',
|
||||
'username' => 'test@test.fr',
|
||||
|
@ -69,12 +69,9 @@ In case you have many VirtualCenters, the configuration is (note the use of ","
|
|||
Troubleshooting
|
||||
---------------
|
||||
|
||||
It is possible to get this kind of errors in the « logs » of « centreon-esxd »:
|
||||
It is possible to get this kind of errors in the « logs » of « centreon-vmware »:
|
||||
::
|
||||
|
||||
...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. 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.
|
||||
|
||||
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).
|
|
@ -8,24 +8,24 @@ Prerequisites
|
|||
Software Recommandations
|
||||
````````````````````````
|
||||
|
||||
The "centreon-esxd" connector has been only tested on red-hat 6 with rpms.
|
||||
Installation on other system is possible but is outside the scope of this document (Debian,...).
|
||||
The "centreon-vmware" connector has been only tested on red-hat 5 and 6 with rpms.
|
||||
Installation on other system should be possible.
|
||||
|
||||
====================== =====================
|
||||
Software Version
|
||||
====================== =====================
|
||||
VMWare SDK Perl 5.1.0-780721
|
||||
Perl 5.8
|
||||
centreon-esxd 1.6.0
|
||||
perl-centreon-base 2.5.0
|
||||
centreon-plugins-base 1.10
|
||||
centreon-vmware 2.0.0
|
||||
perl-centreon-base 2.6.0
|
||||
centreon-plugins-base 1.11
|
||||
ZeroMQ 3.x
|
||||
Perl Date::Parse 1.x
|
||||
Perl ZMQ::LibZMQ3 1.19
|
||||
Perl ZMQ::Constants 1.04
|
||||
====================== =====================
|
||||
|
||||
.. warning::
|
||||
The "centreon-esxd" RPMS provided by Merethis is designed to work with Centreon 2.5 (CES 3), it does not work with Centreon 2.4.
|
||||
How to install from sources is explained in the current documentation.
|
||||
|
||||
Hardware Recommandations
|
||||
````````````````````````
|
||||
|
@ -35,18 +35,106 @@ Hardware prerequisites will depend of check numbers. Minimal used resources are
|
|||
* RAM : 512 Mo (May slightly increase with the number of checks).
|
||||
* CPU : same as poller server.
|
||||
|
||||
Centreon-esxd Installation - centos/rhel 5 systems
|
||||
==================================================
|
||||
|
||||
Not tested on centos/rhel 5. There is a problem with Perl ZMQ::LibZMQ3 module.
|
||||
|
||||
Centreon-esxd Installation - centos/rhel 6 systems
|
||||
==================================================
|
||||
Centreon-vmware Installation - centos/rhel 5 systems
|
||||
====================================================
|
||||
|
||||
SDK Perl VMWare Installation
|
||||
````````````````````````````
|
||||
|
||||
The "centreon-esxd" connector uses SDK Perl VMWare for its operation. So we install it with VMWare recommandation (only tested with version below).
|
||||
The "centreon-vmware" connector uses SDK Perl VMWare for its operation. So we install it with VMWare recommandation (only tested with version below).
|
||||
|
||||
======================= ===================== ======================
|
||||
Dependency Version Repository
|
||||
======================= ===================== ======================
|
||||
perl-libwww-perl 5.805 redhat/centos base
|
||||
perl-XML-LibXML 1.58 redhat/centos base
|
||||
perl-Class-MethodMaker 2.18 ces standard
|
||||
perl-Crypt-SSLeay 0.51 redhat/centos base
|
||||
perl-SOAP-Lite 0.712 ces standard
|
||||
perl-UUID 0.04 ces standard
|
||||
perl-VMware-vSphere 5.1.0-780721.1 ces standard
|
||||
======================= ===================== ======================
|
||||
|
||||
Install following dependency::
|
||||
|
||||
# yum install perl-VMware-vSphere
|
||||
|
||||
Requirements
|
||||
`````````````
|
||||
|
||||
Following prerequisites are mandatory for « centreon_vmware »:
|
||||
|
||||
* « perl-centreon-base »: module since Centreon 2.5 (repository ces standard)
|
||||
* « centreon-plugins-base »: in repository ces standard
|
||||
* « zeromq » and Perl binding: in repository ces standard or EPEL
|
||||
|
||||
Following prerequisites are optional for « centreon_vmware »:
|
||||
|
||||
* « perl-TimeDate »: in repository redhat/centos base
|
||||
|
||||
centreon-vmware Installation with rpm
|
||||
`````````````````````````````````````
|
||||
|
||||
Install the connector:
|
||||
::
|
||||
|
||||
# yum install ces-plugins-Virtualization-VMWare-daemon
|
||||
|
||||
Install the client:
|
||||
::
|
||||
|
||||
# yum install ces-plugins-Virtualization-VMWare-client
|
||||
|
||||
centreon-vmware Installation with source
|
||||
````````````````````````````````````````
|
||||
|
||||
Download « centreon-vmware » archive, then install ::
|
||||
|
||||
# tar zxvf centreon-vmware-2.0.0.tar.gz
|
||||
# cd centreon-vmware-2.0.0
|
||||
# cp centreon_vmware.pl /usr/bin/
|
||||
|
||||
# mkdir -p /etc/centreon
|
||||
# cp contrib/config/centreon_vmware-conf.pm /etc/centreon/centreon_vmware.pm
|
||||
# cp contrib/redhat/centreon_vmware-init /etc/init.d/centreon_vmware
|
||||
# cp contrib/redhat/centreon_vmware-sysconfig /etc/sysconfig/centreon_vmware
|
||||
# chmod 775 /etc/init.d/centreon_vmware /usr/bin/centreon_vmware.pl
|
||||
|
||||
# mkdir -p /usr/lib/perl5/vendor_perl/5.8.8/centreon/vmware/
|
||||
# cp centreon/vmware/* /usr/lib/perl5/vendor_perl/5.8.8/centreon/vmware/
|
||||
# cp centreon/script/centreon_vmware.pm /usr/lib/perl5/vendor_perl/5.8.8/centreon/script/
|
||||
|
||||
Configure "centreon-vmware" daemon to start at boot:
|
||||
::
|
||||
|
||||
# chkconfig --level 2345 centreon_vmware on
|
||||
|
||||
Install « perl-centreon-base » dependency:
|
||||
::
|
||||
|
||||
# git clone -b 2.6.x --single-branch https://github.com/centreon/centreon.git centreon
|
||||
# cd centreon
|
||||
# cp lib/perl/centreon/script.pm /usr/lib/perl5/vendor_perl/5.8.8/centreon/
|
||||
# cp -R lib/perl/centreon/common /usr/lib/perl5/vendor_perl/5.8.8/centreon/
|
||||
|
||||
Install the client:
|
||||
::
|
||||
|
||||
# git clone http://git.centreon.com/centreon-plugins.git
|
||||
# cd centreon-plugins
|
||||
# mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
|
||||
Centreon-vmware Installation - centos/rhel 6 systems
|
||||
====================================================
|
||||
|
||||
SDK Perl VMWare Installation
|
||||
````````````````````````````
|
||||
|
||||
The "centreon-vmware" connector uses SDK Perl VMWare for its operation. So we install it with VMWare recommendation (only tested with version below).
|
||||
|
||||
======================= ===================== ======================
|
||||
Dependency Version Repository
|
||||
|
@ -56,8 +144,8 @@ perl-XML-LibXML 1.70 redhat/centos base
|
|||
perl-Class-MethodMaker 2.16 redhat/centos base
|
||||
perl-Crypt-SSLeay 0.57 redhat/centos base
|
||||
perl-SOAP-Lite 0.710.10 redhat/centos base
|
||||
perl-UUID 0.04 centreon plugin-packs
|
||||
perl-VMware-vSphere 5.1.0-780721.1 centreon plugin-packs
|
||||
perl-UUID 0.04 ces standard
|
||||
perl-VMware-vSphere 5.1.0-780721.1 ces standard
|
||||
======================= ===================== ======================
|
||||
|
||||
Install following dependency:
|
||||
|
@ -66,57 +154,71 @@ Install following dependency:
|
|||
root # yum install perl-VMware-vSphere
|
||||
|
||||
Requirements
|
||||
```````````````````````````````
|
||||
````````````
|
||||
|
||||
Following prerequisites are mandatory for « centreon_esxd »:
|
||||
Following prerequisites are mandatory for « centreon_vmware »:
|
||||
|
||||
* « perl-centreon-base »: module since Centreon 2.5 (repository ces standard)
|
||||
* « centreon-plugins-base »: in repository centreon plugin-packs
|
||||
* « centreon-plugins-base »: in repository ces standard
|
||||
* « zeromq » and Perl binding: in repository ces standard or EPEL
|
||||
|
||||
centreon-esxd Installation with rpm
|
||||
```````````````````````````````````
|
||||
Following prerequisites are optional for « centreon_vmware »:
|
||||
|
||||
* « perl-TimeDate »: in repository redhat/centos base
|
||||
|
||||
centreon-vmware Installation with rpm
|
||||
`````````````````````````````````````
|
||||
|
||||
Install the connector:
|
||||
::
|
||||
|
||||
root # yum install ces-plugins-Virtualization-VMWare
|
||||
# yum install ces-plugins-Virtualization-VMWare-daemon
|
||||
|
||||
Install the client:
|
||||
::
|
||||
|
||||
root # yum install ces-plugins-Virtualization-VMWare-client
|
||||
# yum install ces-plugins-Virtualization-VMWare-client
|
||||
|
||||
centreon-esxd Installation with source
|
||||
``````````````````````````````````````
|
||||
centreon-vmware Installation with source
|
||||
````````````````````````````````````````
|
||||
|
||||
Download « centreon-esxd » archive, then install:
|
||||
Download « centreon-vmware » archive, then install:
|
||||
::
|
||||
|
||||
root # tar zxvf centreon-esxd-1.6.0.tar.gz
|
||||
root # cd centreon-esxd-1.6.0
|
||||
root # cp centreon_esxd /usr/bin/
|
||||
# tar zxvf centreon-vmware-2.0.0.tar.gz
|
||||
# cd centreon-vmware-2.0.0
|
||||
# cp centreon_vmware.pl /usr/bin/
|
||||
|
||||
root # mkdir -p /etc/centreon
|
||||
root # cp centreon_esxd-conf.pm /etc/centreon/centreon_esxd.pm
|
||||
root # cp centreon_esxd-init /etc/init.d/centreon_esxd
|
||||
# mkdir -p /etc/centreon
|
||||
# cp contrib/config/centreon_vmware-conf.pm /etc/centreon/centreon_vmware.pm
|
||||
# cp contrib/redhat/centreon_vmware-init /etc/init.d/centreon_vmware
|
||||
# cp contrib/redhat/centreon_vmware-sysconfig /etc/sysconfig/centreon_vmware
|
||||
# chmod 775 /etc/init.d/centreon_vmware /usr/bin/centreon_vmware.pl
|
||||
|
||||
root # mkdir -p /usr/share/perl5/vendor_perl/centreon/esxd/
|
||||
root # cp centreon/esxd/* /usr/share/perl5/vendor_perl/centreon/esxd/
|
||||
root # cp centreon/script/centreonesxd.pm /usr/share/perl5/vendor_perl/centreon/script/
|
||||
# mkdir -p /usr/share/perl5/vendor_perl/centreon/vmware/
|
||||
# cp centreon/vmware/* /usr/share/perl5/vendor_perl/centreon/vmware/
|
||||
# cp centreon/script/centreon_vmware.pm /usr/share/perl5/vendor_perl/centreon/script/
|
||||
|
||||
Configure "centreon-esxd" daemon to start at boot:
|
||||
Configure "centreon-vmware" daemon to start at boot:
|
||||
::
|
||||
|
||||
root # chkconfig --level 2345 centreon_esxd on
|
||||
# chkconfig --level 2345 centreon_vmware on
|
||||
|
||||
Install « perl-centreon-base » dependency:
|
||||
::
|
||||
|
||||
# git clone -b 2.6.x --single-branch https://github.com/centreon/centreon.git centreon
|
||||
# cd centreon
|
||||
# cp lib/perl/centreon/script.pm /usr/share/perl5/vendor_perl/centreon/
|
||||
# cp -R lib/perl/centreon/common /usr/share/perl5/vendor_perl/centreon/
|
||||
|
||||
Install the client:
|
||||
::
|
||||
|
||||
root # git clone http://git.centreon.com/centreon-plugins.git
|
||||
root # cd centreon-plugins
|
||||
root # mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
root # cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
root # mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
root # cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
root # cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
# git clone http://git.centreon.com/centreon-plugins.git
|
||||
# cd centreon-plugins
|
||||
# mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
|
|
|
@ -7,7 +7,7 @@ Principes Généraux
|
|||
|
||||
Centreon-esxd est un programme Perl chargé de récupérer des indicateurs VMWare. Ce programme utilise le SDK Perl fourni par VMWare afin de se connecter et récupérer les informations d'un (ou plusieurs) VirtualCenter. Pour cela il effectue une connexion TCP avec le(s) VirtualCenter.
|
||||
|
||||
Par défaut, « centreon-esxd » lance au moins deux processus (nommé respectivement « handle-client », « handle-vsphere-xxxx ») :
|
||||
Par défaut, « centreon-vmware » lance au moins deux processus (nommé respectivement « handle-client », « handle-vsphere-xxxx ») :
|
||||
|
||||
*« handle-client »*:
|
||||
*Processus en attente des demandes clientes.*
|
||||
|
@ -25,7 +25,7 @@ Voici le fonctionnement :
|
|||
|
||||
Enfin, ce processus récupère les indicateurs VMWare en créant un sous-processus par demande.
|
||||
|
||||
Centreon-esxd nécessite impérativement l'utilisation d'un (ou plusieurs) VirtualCenter (ou ESX).
|
||||
Centreon-vmware nécessite l'utilisation d'un (ou plusieurs) VirtualCenter (ou ESX).
|
||||
|
||||
Voici un exemple d'architecture éclaté :
|
||||
|
||||
|
@ -34,15 +34,15 @@ Voici un exemple d'architecture éclaté :
|
|||
Mode de fonctionnement
|
||||
----------------------
|
||||
|
||||
Le programme « centreon-esxd » fonctionne uniquement en mode « daemon ». (dans le sens où il ne peut fournir les indicateurs sans l'utilisation d'un client).
|
||||
Le programme « centreon-vmware » fonctionne uniquement en mode « daemon ». (dans le sens où il ne peut fournir les indicateurs sans l'utilisation d'un client).
|
||||
|
||||
Configuration du connecteur
|
||||
---------------------------
|
||||
|
||||
Le daemon « centreon-esxd » possède un fichier de configuration « centreon_esxd.pm » de la forme suivante :
|
||||
Le daemon « centreon-vmware » possède un fichier de configuration « centreon_vmware.pm » de la forme suivante :
|
||||
::
|
||||
|
||||
%centreonesxd_config = (
|
||||
%centreon_vmware_config = (
|
||||
vsphere_server => {
|
||||
'default' => {'url' => 'https://vcenter/sdk',
|
||||
'username' => 'test@test.fr',
|
||||
|
@ -54,7 +54,7 @@ L'attribut « vsphere_server » permet de configurer les accès aux différents
|
|||
Dans le cas ou il y a plusieurs VirtualCenters, la configuration devient (noter la "," de séparation) :
|
||||
::
|
||||
|
||||
%centreonesxd_config = (
|
||||
%centreon_vmware_config = (
|
||||
vsphere_server => {
|
||||
'default' => {'url' => 'https://vcenter/sdk',
|
||||
'username' => 'test@test.fr',
|
||||
|
@ -77,5 +77,3 @@ Il est possible de retrouver des erreurs de ce type dans les « logs » de «
|
|||
|
||||
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.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ Pré-Requis
|
|||
Préconisations logicielles
|
||||
``````````````````````````
|
||||
|
||||
Le connecteur "centreon-esxd" est testé et validé sur red-hat 6 uniquement avec des rpms.
|
||||
Le connecteur "centreon-vmware" est testé et validé sur red-hat 6 uniquement avec des rpms.
|
||||
L'installation sur d'autres environnements n'est pas exclu mais non présenté dans ce document (Debian, ...).
|
||||
|
||||
====================== =====================
|
||||
|
@ -16,16 +16,16 @@ Logiciels Version
|
|||
====================== =====================
|
||||
VMWare SDK Perl 5.1.0-780721
|
||||
Perl 5.8
|
||||
centreon-esxd 1.6.0
|
||||
centreon-vmware 2.0.0
|
||||
perl-centreon-base 2.5.0
|
||||
centreon-plugins-base 1.10
|
||||
ZeroMQ 3.x
|
||||
Perl Date::Parse 1.x
|
||||
Perl ZMQ::LibZMQ3 1.19
|
||||
Perl ZMQ::Constants 1.04
|
||||
====================== =====================
|
||||
|
||||
.. warning::
|
||||
Le connecteur "centreon-esxd" fourni par Merethis est conçu pour fonctionner Centreon 2.5 (CES 3), il ne fonctionne pas avec Centreon 2.4.
|
||||
Il est expliqué comment installer par les sources dans ce document.
|
||||
|
||||
Préconisations matérielles
|
||||
``````````````````````````
|
||||
|
@ -35,18 +35,107 @@ Le matériel nécessaire dépend du nombre de demandes de vérifications. Par d
|
|||
* mémoire vive : 512 Mo minimum (Peut sensiblement augmenter en fonction du nombre de contrôle).
|
||||
* CPU : même pré-requis que pour le serveur de collecte.
|
||||
|
||||
Installation de centreon-esxd - Environnement centos/rhel 5
|
||||
===========================================================
|
||||
|
||||
Le connecteur n'a pas été testé et validé en centos/rhel 5.
|
||||
|
||||
Installation de centreon-esxd - Environnement centos/rhel 6
|
||||
===========================================================
|
||||
Installation de centreon-vmware - Environnement centos/rhel 5
|
||||
=============================================================
|
||||
|
||||
Installation du SDK Perl VMWare
|
||||
```````````````````````````````
|
||||
|
||||
Le connecteur « centreon-esxd » utilise le SDK Perl VMWare pour son fonctionnement. Nous allons donc l'installer en suivant les versions recommandées par VMWare (en dehors de ces versions, le fonctionnement n'est pas garanti).
|
||||
Le connecteur « centreon-vmware » utilise le SDK Perl VMWare pour son fonctionnement. Nous allons donc l'installer en suivant les versions recommandées par VMWare (en dehors de ces versions, le fonctionnement n'est pas garanti).
|
||||
|
||||
======================= ===================== ======================
|
||||
Dépendance Version Dépôt
|
||||
======================= ===================== ======================
|
||||
perl-libwww-perl 5.805 redhat/centos base
|
||||
perl-XML-LibXML 1.58 redhat/centos base
|
||||
perl-Class-MethodMaker 2.18 ces standard
|
||||
perl-Crypt-SSLeay 0.51 redhat/centos base
|
||||
perl-SOAP-Lite 0.712 ces standard
|
||||
perl-UUID 0.04 ces standard
|
||||
perl-VMware-vSphere 5.1.0-780721.1 ces standard
|
||||
======================= ===================== ======================
|
||||
|
||||
Installer la dépendance suivante::
|
||||
|
||||
# yum install perl-VMware-vSphere
|
||||
|
||||
Pré-requis
|
||||
``````````
|
||||
|
||||
Les dépendances suivantes sont nécessaires pour le fonctionnement de « centreon_vmware »:
|
||||
|
||||
* « perl-centreon-base »: module depuis Centreon 2.5 (dépôt ces standard)
|
||||
* « centreon-plugins-base »: dépôt ces standard
|
||||
* « zeromq » and Perl binding: dépôt ces standard ou EPEL
|
||||
|
||||
Les dépendances suivantes sont optionnelles pour le fonctionnement de « centreon_vmware »:
|
||||
|
||||
* « perl-TimeDate »: dépôt redhat/centos base
|
||||
|
||||
Installation de centreon-vmware par rpm
|
||||
```````````````````````````````````````
|
||||
|
||||
Installer le connecteur:
|
||||
::
|
||||
|
||||
# yum install ces-plugins-Virtualization-VMWare-daemon
|
||||
|
||||
Installer le client:
|
||||
::
|
||||
|
||||
# yum install ces-plugins-Virtualization-VMWare-client
|
||||
|
||||
Installation de centreon-vmware par les sources
|
||||
```````````````````````````````````````````````
|
||||
|
||||
Télécharger l'archive de « centreon-vmware ».
|
||||
|
||||
Installer les fichiers::
|
||||
|
||||
# tar zxvf centreon-vmware-2.0.0.tar.gz
|
||||
# cd centreon-vmware-2.0.0
|
||||
# cp centreon_vmware.pl /usr/bin/
|
||||
|
||||
# mkdir -p /etc/centreon
|
||||
# cp contrib/config/centreon_vmware-conf.pm /etc/centreon/centreon_vmware.pm
|
||||
# cp contrib/redhat/centreon_vmware-init /etc/init.d/centreon_vmware
|
||||
# cp contrib/redhat/centreon_vmware-sysconfig /etc/sysconfig/centreon_vmware
|
||||
# chmod 775 /etc/init.d/centreon_vmware /usr/bin/centreon_vmware.pl
|
||||
|
||||
# mkdir -p /usr/lib/perl5/vendor_perl/5.8.8/centreon/vmware/
|
||||
# cp centreon/vmware/* /usr/lib/perl5/vendor_perl/5.8.8/centreon/vmware/
|
||||
# cp centreon/script/centreon_vmware.pm /usr/lib/perl5/vendor_perl/5.8.8/centreon/script/
|
||||
|
||||
Activer le daemon « centreon-vmware » au démarrage::
|
||||
|
||||
# chkconfig --level 2345 centreon_vmware on
|
||||
|
||||
Installer la dépendance « perl-centreon-base »:
|
||||
::
|
||||
|
||||
# git clone -b 2.6.x --single-branch https://github.com/centreon/centreon.git centreon
|
||||
# cd centreon
|
||||
# cp lib/perl/centreon/script.pm /usr/lib/perl5/vendor_perl/5.8.8/centreon/
|
||||
# cp -R lib/perl/centreon/common /usr/lib/perl5/vendor_perl/5.8.8/centreon/
|
||||
|
||||
Installer le client:
|
||||
::
|
||||
|
||||
# git clone http://git.centreon.com/centreon-plugins.git
|
||||
# cd centreon-plugins
|
||||
# mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
|
||||
Installation de centreon-vmware - Environnement centos/rhel 6
|
||||
=============================================================
|
||||
|
||||
Installation du SDK Perl VMWare
|
||||
```````````````````````````````
|
||||
|
||||
Le connecteur « centreon-vmware » utilise le SDK Perl VMWare pour son fonctionnement. Nous allons donc l'installer en suivant les versions recommandées par VMWare (en dehors de ces versions, le fonctionnement n'est pas garanti).
|
||||
|
||||
======================= ===================== ======================
|
||||
Dépendance Version Dépôt
|
||||
|
@ -56,72 +145,78 @@ perl-XML-LibXML 1.70 redhat/centos base
|
|||
perl-Class-MethodMaker 2.16 redhat/centos base
|
||||
perl-Crypt-SSLeay 0.57 redhat/centos base
|
||||
perl-SOAP-Lite 0.710.10 redhat/centos base
|
||||
perl-UUID 0.04 centreon plugin-packs
|
||||
perl-VMware-vSphere 5.1.0-780721.1 centreon plugin-packs
|
||||
perl-UUID 0.04 ces standard
|
||||
perl-VMware-vSphere 5.1.0-780721.1 ces standard
|
||||
======================= ===================== ======================
|
||||
|
||||
Installer la dépendance suivante:
|
||||
::
|
||||
|
||||
root # yum install perl-VMware-vSphere
|
||||
# yum install perl-VMware-vSphere
|
||||
|
||||
Pré-requis
|
||||
```````````````````````````````````````
|
||||
``````````
|
||||
|
||||
Les dépendances suivantes sont nécessaires pour le fonctionnement de « centreon_esxd »:
|
||||
Les dépendances suivantes sont nécessaires pour le fonctionnement de « centreon_vmware »:
|
||||
|
||||
* « perl-centreon-base » : module est présent à partir de Centreon 2.5 (dépôt ces standard)
|
||||
* « centreon-plugins-base » : présent dans le dépôt centreon plugin-packs
|
||||
* « centreon-plugins-base » : présent dans le dépôt ces standard
|
||||
* « zeromq » et le binding Perl : présent dans le dépôt ces standard ou EPEL
|
||||
|
||||
Installation de centreon-esxd par rpm
|
||||
`````````````````````````````````````
|
||||
Les dépendances suivantes sont optionnelles pour le fonctionnement de « centreon_vmware »:
|
||||
|
||||
* « perl-TimeDate »: dépôt redhat/centos base
|
||||
|
||||
Installation de centreon-vmware par rpm
|
||||
```````````````````````````````````````
|
||||
|
||||
Installer le connecteur:
|
||||
::
|
||||
|
||||
root # yum install ces-plugins-Virtualization-VMWare
|
||||
# yum install ces-plugins-Virtualization-VMWare-daemon
|
||||
|
||||
Installer le client:
|
||||
::
|
||||
|
||||
root # yum install ces-plugins-Virtualization-VMWare-client
|
||||
# yum install ces-plugins-Virtualization-VMWare-client
|
||||
|
||||
Installation de centreon-esxd par les sources
|
||||
`````````````````````````````````````````````
|
||||
Installation de centreon-vmware par les sources
|
||||
```````````````````````````````````````````````
|
||||
|
||||
Télécharger l'archive de « centreon-esxd ».
|
||||
Télécharger l'archive de « centreon-vmware ».
|
||||
|
||||
Installer les fichiers:
|
||||
Installer le connecteur:
|
||||
::
|
||||
|
||||
root # tar zxvf centreon-esxd-1.6.0.tar.gz
|
||||
root # cd centreon-esxd-1.6.0
|
||||
root # cp centreon_esxd /usr/bin/
|
||||
# tar zxvf centreon-vmware-2.0.0.tar.gz
|
||||
# cd centreon-vmware-2.0.0
|
||||
# cp centreon_vmware.pl /usr/bin/
|
||||
|
||||
root # mkdir -p /etc/centreon
|
||||
root # cp centreon_esxd-conf.pm /etc/centreon/centreon_esxd.pm
|
||||
root # cp centreon_esxd-init /etc/init.d/centreon_esxd
|
||||
# mkdir -p /etc/centreon
|
||||
# cp contrib/config/centreon_vmware-conf.pm /etc/centreon/centreon_vmware.pm
|
||||
# cp contrib/redhat/centreon_vmware-init /etc/init.d/centreon_vmware
|
||||
# cp contrib/redhat/centreon_vmware-sysconfig /etc/sysconfig/centreon_vmware
|
||||
# chmod 775 /etc/init.d/centreon_vmware /usr/bin/centreon_vmware.pl
|
||||
|
||||
root # mkdir -p /usr/share/perl5/vendor_perl/centreon/esxd/
|
||||
root # cp centreon/esxd/* /usr/share/perl5/vendor_perl/centreon/esxd/
|
||||
root # cp centreon/script/centreonesxd.pm /usr/share/perl5/vendor_perl/centreon/script/
|
||||
# mkdir -p /usr/share/perl5/vendor_perl/centreon/vmware/
|
||||
# cp centreon/vmware/* /usr/share/perl5/vendor_perl/centreon/vmware/
|
||||
# cp centreon/script/centreon_vmware.pm /usr/share/perl5/vendor_perl/centreon/script/
|
||||
|
||||
Activer le daemon « centreon-esxd » au démarrage:
|
||||
Installer la dépendance « perl-centreon-base »:
|
||||
::
|
||||
|
||||
root # chkconfig --level 2345 centreon_esxd on
|
||||
|
||||
# git clone -b 2.6.x --single-branch https://github.com/centreon/centreon.git centreon
|
||||
# cd centreon
|
||||
# cp lib/perl/centreon/script.pm /usr/share/perl5/vendor_perl/centreon/
|
||||
# cp -R lib/perl/centreon/common /usr/share/perl5/vendor_perl/centreon/
|
||||
|
||||
Installer le client:
|
||||
::
|
||||
|
||||
root # git clone http://git.centreon.com/centreon-plugins.git
|
||||
root # cd centreon-plugins
|
||||
root # mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
root # cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
root # mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
root # cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
root # cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
|
||||
|
||||
|
||||
# git clone http://git.centreon.com/centreon-plugins.git
|
||||
# cd centreon-plugins
|
||||
# mkdir -p /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# cp centreon/plugins/* /usr/lib/nagios/plugins/centreon/plugins/
|
||||
# mkdir -p /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp -R apps/vmware/* /usr/lib/nagios/plugins/apps/vmware/
|
||||
# cp centreon_plugins.pl /usr/lib/nagios/plugins/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
%centreonesxd_config = (
|
||||
%centreon_vmware_config = (
|
||||
vsphere_server => {
|
||||
'default' => {'url' => 'https://vcenter/sdk',
|
||||
'username' => 'XXXXXX',
|
|
@ -1,26 +1,26 @@
|
|||
#! /bin/bash
|
||||
#
|
||||
# centreon_esxd Start/Stop the centreon_esxd daemon.
|
||||
# centreon_vmware Start/Stop the centreon_vmware daemon.
|
||||
#
|
||||
# chkconfig: 2345 80 20
|
||||
# description: centreon_esxd is a Centreon program that manage Vpshere Checks
|
||||
# processname: centreon_esxd
|
||||
# config: /etc/centreon/centreon_esxd.pm
|
||||
# pidfile: /var/run/centreon_esxd.pid
|
||||
# description: centreon_vmware is a Centreon program that manage Vpshere Checks
|
||||
# processname: centreon_vmware.pl
|
||||
# config: /etc/centreon/centreon_vmware.pm
|
||||
# pidfile: /var/run/centreon_vmware.pid
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
binary=/usr/bin/centreon_esxd
|
||||
binary=/usr/bin/centreon_vmware.pl
|
||||
servicename=$(basename "$0")
|
||||
OPTIONS=""
|
||||
user=root
|
||||
timeout=60
|
||||
start_timeout=5
|
||||
|
||||
pidfile=/var/run/centreon_esxd.pid
|
||||
pidfile=/var/run/centreon_vmware.pid
|
||||
|
||||
[ -e /etc/sysconfig/centreon_esxd ] && . /etc/sysconfig/centreon_esxd
|
||||
[ -e /etc/sysconfig/centreon_vmware ] && . /etc/sysconfig/centreon_vmware
|
||||
|
||||
# Check if we can find the binary.
|
||||
if [ ! -x $binary ]; then
|
||||
|
@ -49,9 +49,9 @@ start() {
|
|||
fi
|
||||
|
||||
if [ "$(id -u -n)" = "$user" ] ; then
|
||||
daemon ''$binary' '$OPTIONS' > /dev/null 2>&1 &'
|
||||
daemon --check centreon_vmware ''$binary' '$OPTIONS' > /dev/null 2>&1 &'
|
||||
else
|
||||
daemon --user $user ''$binary' '$OPTIONS' > /dev/null 2>&1 &'
|
||||
daemon --user $user --check centreon_vmware ''$binary' '$OPTIONS' > /dev/null 2>&1 &'
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
|
@ -122,7 +122,7 @@ case "$1" in
|
|||
rhstatus
|
||||
;;
|
||||
condrestart)
|
||||
[ -f /var/lock/subsys/centreon_esxd ] && restart || :
|
||||
[ -f /var/lock/subsys/centreon_vmware ] && restart || :
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
|
|
@ -0,0 +1,2 @@
|
|||
# centreon_vmware command line options
|
||||
OPTIONS="--logfile=/var/log/centreon/centreon_vmware.log --severity=error"
|
|
@ -1,6 +1,23 @@
|
|||
#!/usr/bin/perl
|
||||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::script::centreonesxd;
|
||||
package centreon::script::centreon_vmware;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -13,58 +30,58 @@ use Digest::MD5 qw(md5_hex);
|
|||
use POSIX ":sys_wait_h";
|
||||
use JSON;
|
||||
use centreon::script;
|
||||
use centreon::esxd::common;
|
||||
use centreon::esxd::connector;
|
||||
use centreon::vmware::common;
|
||||
use centreon::vmware::connector;
|
||||
|
||||
my ($centreonesxd, $frontend);
|
||||
my ($centreon_vmware, $frontend);
|
||||
|
||||
BEGIN {
|
||||
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
|
||||
}
|
||||
|
||||
use base qw(centreon::script);
|
||||
use vars qw(%centreonesxd_config);
|
||||
use vars qw(%centreon_vmware_config);
|
||||
|
||||
my $VERSION = "1.6.0";
|
||||
my $VERSION = "2.0.0";
|
||||
my %handlers = (TERM => {}, HUP => {}, CHLD => {});
|
||||
|
||||
my @load_modules = (
|
||||
'centreon::esxd::cmdalarmdatacenter',
|
||||
'centreon::esxd::cmdalarmhost',
|
||||
'centreon::esxd::cmdcountvmhost',
|
||||
'centreon::esxd::cmdcpuhost',
|
||||
'centreon::esxd::cmdcpuvm',
|
||||
'centreon::esxd::cmddatastoreio',
|
||||
'centreon::esxd::cmddatastoreiops',
|
||||
'centreon::esxd::cmddatastorehost',
|
||||
'centreon::esxd::cmddatastoresnapshot',
|
||||
'centreon::esxd::cmddatastorevm',
|
||||
'centreon::esxd::cmddatastoreusage',
|
||||
'centreon::esxd::cmdgetmap',
|
||||
'centreon::esxd::cmdhealthhost',
|
||||
'centreon::esxd::cmdlimitvm',
|
||||
'centreon::esxd::cmdlistdatacenters',
|
||||
'centreon::esxd::cmdlistdatastores',
|
||||
'centreon::esxd::cmdlistnichost',
|
||||
'centreon::esxd::cmdmemhost',
|
||||
'centreon::esxd::cmdmaintenancehost',
|
||||
'centreon::esxd::cmdmemvm',
|
||||
'centreon::esxd::cmdnethost',
|
||||
'centreon::esxd::cmdsnapshotvm',
|
||||
'centreon::esxd::cmdstatushost',
|
||||
'centreon::esxd::cmdstatusvm',
|
||||
'centreon::esxd::cmdswaphost',
|
||||
'centreon::esxd::cmdswapvm',
|
||||
'centreon::esxd::cmdthinprovisioningvm',
|
||||
'centreon::esxd::cmdtimehost',
|
||||
'centreon::esxd::cmdtoolsvm',
|
||||
'centreon::esxd::cmduptimehost',
|
||||
'centreon::esxd::cmdvmoperationcluster',
|
||||
'centreon::vmware::cmdalarmdatacenter',
|
||||
'centreon::vmware::cmdalarmhost',
|
||||
'centreon::vmware::cmdcountvmhost',
|
||||
'centreon::vmware::cmdcpuhost',
|
||||
'centreon::vmware::cmdcpuvm',
|
||||
'centreon::vmware::cmddatastoreio',
|
||||
'centreon::vmware::cmddatastoreiops',
|
||||
'centreon::vmware::cmddatastorehost',
|
||||
'centreon::vmware::cmddatastoresnapshot',
|
||||
'centreon::vmware::cmddatastorevm',
|
||||
'centreon::vmware::cmddatastoreusage',
|
||||
'centreon::vmware::cmdgetmap',
|
||||
'centreon::vmware::cmdhealthhost',
|
||||
'centreon::vmware::cmdlimitvm',
|
||||
'centreon::vmware::cmdlistdatacenters',
|
||||
'centreon::vmware::cmdlistdatastores',
|
||||
'centreon::vmware::cmdlistnichost',
|
||||
'centreon::vmware::cmdmemhost',
|
||||
'centreon::vmware::cmdmaintenancehost',
|
||||
'centreon::vmware::cmdmemvm',
|
||||
'centreon::vmware::cmdnethost',
|
||||
'centreon::vmware::cmdsnapshotvm',
|
||||
'centreon::vmware::cmdstatushost',
|
||||
'centreon::vmware::cmdstatusvm',
|
||||
'centreon::vmware::cmdswaphost',
|
||||
'centreon::vmware::cmdswapvm',
|
||||
'centreon::vmware::cmdthinprovisioningvm',
|
||||
'centreon::vmware::cmdtimehost',
|
||||
'centreon::vmware::cmdtoolsvm',
|
||||
'centreon::vmware::cmduptimehost',
|
||||
'centreon::vmware::cmdvmoperationcluster',
|
||||
);
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = $class->SUPER::new("centreonesxd",
|
||||
my $self = $class->SUPER::new("centreon_vmware",
|
||||
centreon_db_conn => 0,
|
||||
centstorage_db_conn => 0,
|
||||
noconfig => 1
|
||||
|
@ -75,7 +92,7 @@ sub new {
|
|||
"config-extra=s" => \$self->{opt_extra},
|
||||
);
|
||||
|
||||
%{$self->{centreonesxd_default_config}} =
|
||||
%{$self->{centreon_vmware_default_config}} =
|
||||
(
|
||||
credstore_use => 0,
|
||||
credstore_file => '/root/.vmware/credstore/vicredentials.xml',
|
||||
|
@ -118,7 +135,7 @@ sub init {
|
|||
$SIG{__DIE__} = undef;
|
||||
|
||||
if (!defined($self->{opt_extra})) {
|
||||
$self->{opt_extra} = "/etc/centreon/centreon_esxd.pm";
|
||||
$self->{opt_extra} = "/etc/centreon/centreon_vmware.pm";
|
||||
}
|
||||
if (-f $self->{opt_extra}) {
|
||||
require $self->{opt_extra};
|
||||
|
@ -126,14 +143,14 @@ sub init {
|
|||
$self->{logger}->writeLogInfo("Can't find extra config file $self->{opt_extra}");
|
||||
}
|
||||
|
||||
$self->{centreonesxd_config} = {%{$self->{centreonesxd_default_config}}, %centreonesxd_config};
|
||||
$self->{centreon_vmware_config} = {%{$self->{centreon_vmware_default_config}}, %centreon_vmware_config};
|
||||
|
||||
##### Load modules
|
||||
$self->load_module(@load_modules);
|
||||
|
||||
##### credstore check #####
|
||||
if (defined($self->{centreonesxd_config}->{credstore_use}) && defined($self->{centreonesxd_config}->{credstore_file}) &&
|
||||
$self->{centreonesxd_config}->{credstore_use} == 1 && -e "$self->{centreonesxd_config}->{credstore_file}") {
|
||||
if (defined($self->{centreon_vmware_config}->{credstore_use}) && defined($self->{centreon_vmware_config}->{credstore_file}) &&
|
||||
$self->{centreon_vmware_config}->{credstore_use} == 1 && -e "$self->{centreon_vmware_config}->{credstore_file}") {
|
||||
eval 'require VMware::VICredStore';
|
||||
if ($@) {
|
||||
$self->{logger}->writeLogError("Could not load module VMware::VICredStore");
|
||||
|
@ -141,7 +158,7 @@ sub init {
|
|||
}
|
||||
require VMware::VICredStore;
|
||||
|
||||
if (VMware::VICredStore::init(filename => $self->{centreonesxd_config}->{credstore_file}) == 0) {
|
||||
if (VMware::VICredStore::init(filename => $self->{centreon_vmware_config}->{credstore_file}) == 0) {
|
||||
$self->{logger}->writeLogError("Credstore init failed: $@");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -149,13 +166,13 @@ sub init {
|
|||
###
|
||||
# Get password
|
||||
###
|
||||
foreach (keys %{$self->{centreonesxd_config}->{vsphere_server}}) {
|
||||
my $lpassword = VMware::VICredStore::get_password(server => $_, username => $self->{centreonesxd_config}->{vsphere_server}->{$_}->{username});
|
||||
foreach (keys %{$self->{centreon_vmware_config}->{vsphere_server}}) {
|
||||
my $lpassword = VMware::VICredStore::get_password(server => $_, username => $self->{centreon_vmware_config}->{vsphere_server}->{$_}->{username});
|
||||
if (!defined($lpassword)) {
|
||||
$self->{logger}->writeLogError("Can't get password for couple host='" . $_ . "', username='" . $self->{centreonesxd_config}->{vsphere_server}->{$_}->{username} . "' : $@");
|
||||
$self->{logger}->writeLogError("Can't get password for couple host='" . $_ . "', username='" . $self->{centreon_vmware_config}->{vsphere_server}->{$_}->{username} . "' : $@");
|
||||
exit(1);
|
||||
}
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$_}->{password} = $lpassword;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$_}->{password} = $lpassword;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,15 +264,15 @@ sub verify_child_vsphere {
|
|||
if ($self->{stop} == 0) {
|
||||
$self->{logger}->writeLogError("Sub-process for '" . $self->{childs_vpshere_pid}->{$_} . "'???!! we relaunch it!!!");
|
||||
|
||||
if ($self->{centreonesxd_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}}->{dynamic} == 0) {
|
||||
if ($self->{centreon_vmware_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}}->{dynamic} == 0) {
|
||||
$self->create_vsphere_child(vsphere_name => $self->{childs_vpshere_pid}->{$_}, dynamic => 0);
|
||||
} else {
|
||||
$self->{logger}->writeLogError("Sub-process for '" . $self->{childs_vpshere_pid}->{$_} . "' is dead. But we don't relaunch it (dynamic sub-process)");
|
||||
delete $self->{centreonesxd_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}};
|
||||
delete $self->{centreon_vmware_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}};
|
||||
}
|
||||
} else {
|
||||
$self->{logger}->writeLogInfo("Sub-process for '" . $self->{childs_vpshere_pid}->{$_} . "' dead ???!!");
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}}->{running} = 0;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{childs_vpshere_pid}->{$_}}->{running} = 0;
|
||||
}
|
||||
|
||||
delete $self->{childs_vpshere_pid}->{$_};
|
||||
|
@ -263,14 +280,14 @@ sub verify_child_vsphere {
|
|||
}
|
||||
|
||||
my $count = 0;
|
||||
foreach (keys %{$self->{centreonesxd_config}->{vsphere_server}}) {
|
||||
if ($self->{centreonesxd_config}->{vsphere_server}->{$_}->{running} == 1) {
|
||||
foreach (keys %{$self->{centreon_vmware_config}->{vsphere_server}}) {
|
||||
if ($self->{centreon_vmware_config}->{vsphere_server}->{$_}->{running} == 1) {
|
||||
$count++;
|
||||
}
|
||||
if ($self->{centreonesxd_config}->{vsphere_server}->{$_}->{dynamic} == 1 &&
|
||||
time() - $self->{centreonesxd_config}->{dynamic_timeout_kill} > $self->{centreonesxd_config}->{vsphere_server}->{$_}->{last_request}) {
|
||||
if ($self->{centreon_vmware_config}->{vsphere_server}->{$_}->{dynamic} == 1 &&
|
||||
time() - $self->{centreon_vmware_config}->{dynamic_timeout_kill} > $self->{centreon_vmware_config}->{vsphere_server}->{$_}->{last_request}) {
|
||||
$self->{logger}->writeLogError("Send TERM signal for process '" . $_ . "': too many times without requests. We clean it.");
|
||||
kill('TERM', $self->{centreonesxd_config}->{vsphere_server}->{$_}->{pid});
|
||||
kill('TERM', $self->{centreon_vmware_config}->{vsphere_server}->{$_}->{pid});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,19 +297,19 @@ sub verify_child_vsphere {
|
|||
sub waiting_ready {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 1 if ($self->{centreonesxd_config}->{vsphere_server}->{$options{container}}->{ready} == 1);
|
||||
return 1 if ($self->{centreon_vmware_config}->{vsphere_server}->{$options{container}}->{ready} == 1);
|
||||
|
||||
my $time = time();
|
||||
# We wait 10 seconds
|
||||
while ($self->{centreonesxd_config}->{vsphere_server}->{$options{container}}->{ready} == 0 &&
|
||||
while ($self->{centreon_vmware_config}->{vsphere_server}->{$options{container}}->{ready} == 0 &&
|
||||
time() - $time < 10) {
|
||||
zmq_poll($self->{poll}, 5000);
|
||||
}
|
||||
|
||||
if ($self->{centreonesxd_config}->{vsphere_server}->{$options{container}}->{ready} == 0) {
|
||||
if ($self->{centreon_vmware_config}->{vsphere_server}->{$options{container}}->{ready} == 0) {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "connector still not ready.");
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -306,26 +323,26 @@ sub request_dynamic {
|
|||
!defined($options{result}->{vsphere_password}) || $options{result}->{vsphere_password} eq '') {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Please set vsphere username or password");
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
|
||||
my $container = md5_hex($options{result}->{vsphere_address} . $options{result}->{vsphere_username} . $options{result}->{vsphere_password});
|
||||
# Need to create fork
|
||||
if (!defined($self->{centreonesxd_config}->{vsphere_server}->{$container})) {
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$container} = { url => 'https://' . $options{result}->{vsphere_address} . '/sdk',
|
||||
if (!defined($self->{centreon_vmware_config}->{vsphere_server}->{$container})) {
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$container} = { url => 'https://' . $options{result}->{vsphere_address} . '/sdk',
|
||||
username => $options{result}->{vsphere_username},
|
||||
password => $options{result}->{vsphere_password},
|
||||
last_request => time() };
|
||||
$self->{logger}->writeLogError(sprintf("Dynamic creation: identity = %s [address: %s] [username: %s] [password: %s]",
|
||||
$container, $options{result}->{vsphere_address}, $options{result}->{vsphere_username}, $options{result}->{vsphere_password}));
|
||||
$centreonesxd->create_vsphere_child(vsphere_name => $container, dynamic => 1);
|
||||
$centreon_vmware->create_vsphere_child(vsphere_name => $container, dynamic => 1);
|
||||
}
|
||||
|
||||
return if ($self->waiting_ready(container => $container, manager => $options{manager},
|
||||
identity => $options{identity}) == 0);
|
||||
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$container}->{last_request} = time();
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$container}->{last_request} = time();
|
||||
my $flag = ZMQ_NOBLOCK | ZMQ_SNDMORE;
|
||||
zmq_sendmsg($frontend, "server-" . $container, $flag);
|
||||
zmq_sendmsg($frontend, 'REQCLIENT ' . $options{data}, ZMQ_NOBLOCK);
|
||||
|
@ -342,24 +359,24 @@ sub request {
|
|||
if ($@) {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Cannot decode json result: $@");
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
if ($result->{command} eq 'stats') {
|
||||
centreon::esxd::common::stats_info(manager => $options{manager},
|
||||
centreon::vmware::common::stats_info(manager => $options{manager},
|
||||
counters => $self->{counter_stats});
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
if (!defined($self->{modules_registry}->{$result->{command}})) {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Unknown method name '$result->{command}'");
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
if ($self->{modules_registry}->{$result->{command}}->checkArgs(manager => $options{manager},
|
||||
arguments => $result)) {
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -369,10 +386,10 @@ sub request {
|
|||
return ;
|
||||
}
|
||||
|
||||
if (!defined($self->{centreonesxd_config}->{vsphere_server}->{$result->{container}})) {
|
||||
if (!defined($self->{centreon_vmware_config}->{vsphere_server}->{$result->{container}})) {
|
||||
$options{manager}->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Unknown container name '$result->{container}'");
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $options{identity});
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -401,7 +418,7 @@ sub repserver {
|
|||
$result->{plugin}->{name} =~ /^client-(.*)$/;
|
||||
my $identity = 'client-' . pack('H*', $1);
|
||||
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend,
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend,
|
||||
identity => $identity, stdout => $options{data});
|
||||
}
|
||||
|
||||
|
@ -414,19 +431,19 @@ sub router_event {
|
|||
|
||||
my $data = zmq_msg_data($message);
|
||||
|
||||
my $manager = centreon::esxd::common::init_response();
|
||||
if ($centreonesxd->{stop} != 0) {
|
||||
my $manager = centreon::vmware::common::init_response();
|
||||
if ($centreon_vmware->{stop} != 0) {
|
||||
# We quit so we say we're leaving ;)
|
||||
$manager->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => 'Daemon is restarting/stopping...');
|
||||
centreon::esxd::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $identity);
|
||||
centreon::vmware::common::response(token => 'RESPSERVER', endpoint => $frontend, identity => $identity);
|
||||
} elsif ($data =~ /^REQCLIENT\s+(.*)$/msi) {
|
||||
$centreonesxd->request(identity => $identity, data => $1, manager => $manager);
|
||||
$centreon_vmware->request(identity => $identity, data => $1, manager => $manager);
|
||||
} elsif ($data =~ /^RESPSERVER2\s+(.*)$/msi) {
|
||||
$centreonesxd->repserver(data => $1, manager => $manager);
|
||||
$centreon_vmware->repserver(data => $1, manager => $manager);
|
||||
} elsif ($data =~ /^READY/msi) {
|
||||
$identity =~ /server-(.*)/;
|
||||
$centreonesxd->{centreonesxd_config}->{vsphere_server}->{$1}->{ready} = 1;
|
||||
$centreon_vmware->{centreon_vmware_config}->{vsphere_server}->{$1}->{ready} = 1;
|
||||
}
|
||||
|
||||
my $more = zmq_getsockopt($frontend, ZMQ_RCVMORE);
|
||||
|
@ -438,24 +455,24 @@ sub create_vsphere_child {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{whoaim} = $options{vsphere_name};
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{whoaim}}->{running} = 0;
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{whoaim}}->{ready} = 0;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{whoaim}}->{running} = 0;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{whoaim}}->{ready} = 0;
|
||||
$self->{logger}->writeLogInfo("Create vsphere sub-process for '" . $options{vsphere_name} . "'");
|
||||
|
||||
my $child_vpshere_pid = fork();
|
||||
if ($child_vpshere_pid == 0) {
|
||||
my $connector = centreon::esxd::connector->new(name => $self->{whoaim},
|
||||
my $connector = centreon::vmware::connector->new(name => $self->{whoaim},
|
||||
modules_registry => $self->{modules_registry},
|
||||
module_date_parse_loaded => $self->{module_date_parse_loaded},
|
||||
config => $self->{centreonesxd_config},
|
||||
config => $self->{centreon_vmware_config},
|
||||
logger => $self->{logger});
|
||||
$connector->run();
|
||||
exit(0);
|
||||
}
|
||||
$self->{childs_vpshere_pid}->{$child_vpshere_pid} = $self->{whoaim};
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{whoaim}}->{running} = 1;
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{whoaim}}->{dynamic} = $options{dynamic};
|
||||
$self->{centreonesxd_config}->{vsphere_server}->{$self->{whoaim}}->{pid} = $child_vpshere_pid;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{whoaim}}->{running} = 1;
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{whoaim}}->{dynamic} = $options{dynamic};
|
||||
$self->{centreon_vmware_config}->{vsphere_server}->{$self->{whoaim}}->{pid} = $child_vpshere_pid;
|
||||
}
|
||||
|
||||
sub bind_ipc {
|
||||
|
@ -477,34 +494,34 @@ sub bind_ipc {
|
|||
}
|
||||
|
||||
sub run {
|
||||
$centreonesxd = shift;
|
||||
$centreon_vmware = shift;
|
||||
|
||||
$centreonesxd->SUPER::run();
|
||||
$centreonesxd->{logger}->redirect_output();
|
||||
$centreon_vmware->SUPER::run();
|
||||
$centreon_vmware->{logger}->redirect_output();
|
||||
|
||||
$centreonesxd->{logger}->writeLogDebug("centreonesxd launched....");
|
||||
$centreonesxd->{logger}->writeLogDebug("PID: $$");
|
||||
$centreon_vmware->{logger}->writeLogDebug("centreon_vmware launched....");
|
||||
$centreon_vmware->{logger}->writeLogDebug("PID: $$");
|
||||
|
||||
my $context = zmq_init();
|
||||
$frontend = zmq_socket($context, ZMQ_ROUTER);
|
||||
if (!defined($frontend)) {
|
||||
$centreonesxd->{logger}->writeLogError("Can't setup server: $!");
|
||||
$centreon_vmware->{logger}->writeLogError("Can't setup server: $!");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
zmq_setsockopt($frontend, ZMQ_LINGER, 0); # we discard
|
||||
zmq_bind($frontend, 'tcp://*:5700');
|
||||
$centreonesxd->bind_ipc(socket => $frontend, ipc_file => '/tmp/centreonesxd/routing.ipc');
|
||||
$centreon_vmware->bind_ipc(socket => $frontend, ipc_file => '/tmp/centreon_vmware/routing.ipc');
|
||||
|
||||
foreach (keys %{$centreonesxd->{centreonesxd_config}->{vsphere_server}}) {
|
||||
$centreonesxd->{counter_stats}->{$_} = 0;
|
||||
$centreonesxd->create_vsphere_child(vsphere_name => $_, dynamic => 0);
|
||||
foreach (keys %{$centreon_vmware->{centreon_vmware_config}->{vsphere_server}}) {
|
||||
$centreon_vmware->{counter_stats}->{$_} = 0;
|
||||
$centreon_vmware->create_vsphere_child(vsphere_name => $_, dynamic => 0);
|
||||
}
|
||||
|
||||
$centreonesxd->{logger}->writeLogInfo("[Server accepting clients]");
|
||||
$centreon_vmware->{logger}->writeLogInfo("[Server accepting clients]");
|
||||
|
||||
# Initialize poll set
|
||||
$centreonesxd->{poll} = [
|
||||
$centreon_vmware->{poll} = [
|
||||
{
|
||||
socket => $frontend,
|
||||
events => ZMQ_POLLIN,
|
||||
|
@ -514,18 +531,18 @@ sub run {
|
|||
|
||||
# Switch messages between sockets
|
||||
while (1) {
|
||||
my $count = $centreonesxd->verify_child_vsphere();
|
||||
my $count = $centreon_vmware->verify_child_vsphere();
|
||||
|
||||
if ($centreonesxd->{stop} == 1) {
|
||||
if ($centreon_vmware->{stop} == 1) {
|
||||
# No childs
|
||||
if ($count == 0) {
|
||||
$centreonesxd->{logger}->writeLogInfo("Quit main process");
|
||||
$centreon_vmware->{logger}->writeLogInfo("Quit main process");
|
||||
zmq_close($frontend);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
zmq_poll($centreonesxd->{poll}, 5000);
|
||||
zmq_poll($centreon_vmware->{poll}, 5000);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdalarmdatacenter;
|
||||
package centreon::vmware::cmdalarmdatacenter;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
use centreon::plugins::statefile;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
|
@ -39,7 +56,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => 0);
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => 0);
|
||||
|
@ -81,7 +98,7 @@ sub run {
|
|||
}
|
||||
|
||||
my @properties = ('name', 'triggeredAlarmState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datacenter', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datacenter', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -91,7 +108,7 @@ sub run {
|
|||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("No current alarms on datacenter(s)"));
|
||||
|
||||
my $alarmMgr = centreon::esxd::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->alarmManager, undef);
|
||||
my $alarmMgr = centreon::vmware::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->alarmManager, undef);
|
||||
my $total_alarms = { red => 0, yellow => 0 };
|
||||
my $dc_alarms = {};
|
||||
my $new_datas = {};
|
||||
|
@ -107,8 +124,8 @@ sub run {
|
|||
$new_datas->{$_->key} = 1;
|
||||
next if (defined($self->{memory}) && defined($self->{statefile_cache}->get(name => $_->key)));
|
||||
|
||||
my $entity = centreon::esxd::common::get_view($self->{connector}, $_->entity, ['name']);
|
||||
my $alarm = centreon::esxd::common::get_view($self->{connector}, $_->alarm, ['info']);
|
||||
my $entity = centreon::vmware::common::get_view($self->{connector}, $_->entity, ['name']);
|
||||
my $alarm = centreon::vmware::common::get_view($self->{connector}, $_->alarm, ['info']);
|
||||
|
||||
$dc_alarms->{$datacenter_view->name}->{alarms}->{$_->key} = { type => $_->entity->type, name => $entity->name,
|
||||
time => $_->time, name => $alarm->info->name,
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdalarmhost;
|
||||
package centreon::vmware::cmdalarmhost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
use centreon::plugins::statefile;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
|
@ -39,7 +56,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => 0);
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => 0);
|
||||
|
@ -81,7 +98,7 @@ sub run {
|
|||
}
|
||||
|
||||
my @properties = ('name', 'triggeredAlarmState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -90,7 +107,7 @@ sub run {
|
|||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("No current alarms on host(s)"));
|
||||
|
||||
my $alarmMgr = centreon::esxd::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->alarmManager, undef);
|
||||
my $alarmMgr = centreon::vmware::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->alarmManager, undef);
|
||||
my $total_alarms = { red => 0, yellow => 0 };
|
||||
my $host_alarms = {};
|
||||
my $new_datas = {};
|
||||
|
@ -106,8 +123,8 @@ sub run {
|
|||
$new_datas->{$_->key} = 1;
|
||||
next if (defined($self->{memory}) && defined($self->{statefile_cache}->get(name => $_->key)));
|
||||
|
||||
my $entity = centreon::esxd::common::get_view($self->{connector}, $_->entity, ['name']);
|
||||
my $alarm = centreon::esxd::common::get_view($self->{connector}, $_->alarm, ['info']);
|
||||
my $entity = centreon::vmware::common::get_view($self->{connector}, $_->entity, ['name']);
|
||||
my $alarm = centreon::vmware::common::get_view($self->{connector}, $_->alarm, ['info']);
|
||||
|
||||
$host_alarms->{$host_view->name}->{alarms}->{$_->key} = { type => $_->entity->type, name => $entity->name,
|
||||
time => $_->time, name => $alarm->info->name,
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdcountvmhost;
|
||||
package centreon::vmware::cmdcountvmhost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning_on', 'critical_on', 'warning_off', 'critical_off', 'warning_suspended', 'critical_suspended')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -76,14 +93,14 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'vm', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
}
|
||||
|
||||
#return if (centreon::esxd::common::host_state($self->{connector}, $self->{lhost},
|
||||
#return if (centreon::vmware::common::host_state($self->{connector}, $self->{lhost},
|
||||
# $$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my @vm_array = ();
|
||||
|
@ -93,7 +110,7 @@ sub run {
|
|||
}
|
||||
}
|
||||
@properties = ('runtime.powerState');
|
||||
my $result2 = centreon::esxd::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
return if (!defined($result2));
|
||||
|
||||
if ($multiple == 1) {
|
||||
|
@ -102,7 +119,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdcpuhost;
|
||||
package centreon::vmware::cmdcpuhost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -53,7 +70,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -85,34 +102,34 @@ sub run {
|
|||
}
|
||||
|
||||
my @properties = ('name', 'runtime.connectionState', 'summary.hardware.numCpuCores', 'summary.hardware.cpuMhz');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
}
|
||||
my @instances = ('*');
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'cpu.usage.average', 'instances' => \@instances},
|
||||
{'label' => 'cpu.usagemhz.average', 'instances' => \@instances}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if ($multiple == 1) {
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All Total Average CPU usages are ok"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
multiple => $multiple) == 0);
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
my $total_cpu_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"}[0] * 0.01));
|
||||
my $total_cpu_mhz_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}[0]));
|
||||
my $total_cpu_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"}[0] * 0.01));
|
||||
my $total_cpu_mhz_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}[0]));
|
||||
|
||||
my $exit = $self->{manager}->{perfdata}->threshold_check(value => $total_cpu_average,
|
||||
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
|
@ -145,7 +162,7 @@ sub run {
|
|||
my ($counter_id, $instance) = split /:/, $id;
|
||||
if ($instance ne "") {
|
||||
$self->{manager}->{output}->perfdata_add(label => 'cpu' . $instance . $extra_label, unit => '%',
|
||||
value => centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$id}[0]) * 0.01),
|
||||
value => centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$id}[0]) * 0.01),
|
||||
min => 0, max => 100);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdcpuvm;
|
||||
package centreon::vmware::cmdcpuvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -56,7 +73,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning_usagemhz', 'critical_usagemhz', 'warning_usage', 'critical_usage', 'warning_ready', 'critical_ready')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -95,18 +112,18 @@ sub run {
|
|||
if (defined($self->{display_description})) {
|
||||
push @properties, 'config.annotation';
|
||||
}
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
my @instances = ('*');
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'cpu.usage.average', 'instances' => \@instances},
|
||||
{'label' => 'cpu.usagemhz.average', 'instances' => \@instances},
|
||||
{'label' => 'cpu.ready.summation', 'instances' => \@instances}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
|
@ -116,7 +133,7 @@ sub run {
|
|||
short_msg => sprintf("All cpu usages are ok"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
power => $entity_view->{'runtime.powerState'}->val,
|
||||
|
@ -124,9 +141,9 @@ sub run {
|
|||
powerstatus => $self->{nopoweredon_status},
|
||||
multiple => $multiple) == 0);
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
my $total_cpu_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"}[0] * 0.01));
|
||||
my $total_cpu_mhz_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}[0]));
|
||||
my $total_cpu_ready = centreon::esxd::common::simplify_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.ready.summation'}->{'key'} . ":"}[0] / ($self->{connector}->{perfcounter_speriod} * 1000) * 100);
|
||||
my $total_cpu_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"}[0] * 0.01));
|
||||
my $total_cpu_mhz_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}[0]));
|
||||
my $total_cpu_ready = centreon::vmware::common::simplify_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.ready.summation'}->{'key'} . ":"}[0] / ($self->{connector}->{perfcounter_speriod} * 1000) * 100);
|
||||
|
||||
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
|
||||
my @exits;
|
||||
|
@ -160,7 +177,7 @@ sub run {
|
|||
my $prefix_msg = "'$entity_view->{name}'";
|
||||
if (defined($self->{display_description}) && defined($entity_view->{'config.annotation'}) &&
|
||||
$entity_view->{'config.annotation'} ne '') {
|
||||
$prefix_msg .= ' [' . centreon::esxd::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
$prefix_msg .= ' [' . centreon::vmware::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
}
|
||||
|
||||
$self->{manager}->{output}->output_add(long_msg => "$prefix_msg $long_msg");
|
||||
|
@ -183,7 +200,7 @@ sub run {
|
|||
next if ($self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{key} != $counter_id);
|
||||
if ($instance ne "") {
|
||||
$self->{manager}->{output}->perfdata_add(label => 'cpu_' . $instance . '_MHz' . $extra_label, unit => 'MHz',
|
||||
value => centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$id}[0])),
|
||||
value => centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$id}[0])),
|
||||
min => 0);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,27 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastorehost;
|
||||
package centreon::vmware::cmddatastorehost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -56,7 +73,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -88,7 +105,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'config.fileSystemVolume.mountInfo', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -108,7 +125,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -153,17 +170,17 @@ sub run {
|
|||
|
||||
# Vsphere >= 4.1
|
||||
# You get counters even if datastore is disconnect...
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
undef,
|
||||
$query_perfs,
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All Datastore latencies are ok"));
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0);
|
||||
next if (centreon::vmware::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0);
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
|
||||
my $checked = {};
|
||||
|
@ -172,8 +189,8 @@ sub run {
|
|||
next if (defined($checked->{$uuid}));
|
||||
$checked->{$uuid} = 1;
|
||||
|
||||
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.totalReadLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.totalWriteLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||
my $read_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.totalReadLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||
my $write_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.totalWriteLatency.average'}->{'key'} . ":" . $uuid}[0]));
|
||||
|
||||
my $exit = $self->{manager}->{perfdata}->threshold_check(value => $read_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
$self->{manager}->{output}->output_add(long_msg => sprintf("'%s' read on '%s' is %s ms",
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastoreio;
|
||||
package centreon::vmware::cmddatastoreio;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -82,16 +99,16 @@ sub run {
|
|||
$filters{name} = qr/$self->{datastore_name}/;
|
||||
}
|
||||
my @properties = ('summary.name', 'summary.accessible');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'datastore.read.average', 'instances' => ['']},
|
||||
{'label' => 'datastore.write.average', 'instances' => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
|
@ -102,7 +119,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::datastore_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::datastore_state(connector => $self->{connector},
|
||||
name => $entity_view->{'summary.name'},
|
||||
state => $entity_view->{'summary.accessible'},
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -110,8 +127,8 @@ sub run {
|
|||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
|
||||
# in KBps
|
||||
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.read.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.write.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $read_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.read.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $write_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'datastore.write.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
|
||||
my $exit1 = $self->{manager}->{perfdata}->threshold_check(value => $read_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
my $exit2 = $self->{manager}->{perfdata}->threshold_check(value => $write_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastoreiops;
|
||||
package centreon::vmware::cmddatastoreiops;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -82,7 +99,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{datastore_name}/;
|
||||
}
|
||||
my @properties = ('summary.accessible', 'summary.name', 'vm', 'info');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -98,7 +115,7 @@ sub run {
|
|||
my %datastore_lun = ();
|
||||
my $ds_checked = 0;
|
||||
foreach (@$result) {
|
||||
next if (centreon::esxd::common::datastore_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::datastore_state(connector => $self->{connector},
|
||||
name => $_->{'summary.name'},
|
||||
state => $_->{'summary.accessible'},
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -139,14 +156,14 @@ sub run {
|
|||
}
|
||||
|
||||
@properties = ('name', 'runtime.connectionState', 'runtime.powerState');
|
||||
my $result2 = centreon::esxd::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
return if (!defined($result2));
|
||||
|
||||
# Remove disconnected or not running vm
|
||||
my %ref_ids_vm = ();
|
||||
for(my $i = $#{$result2}; $i >= 0; --$i) {
|
||||
if (!centreon::esxd::common::is_connected(state => ${$result2}[$i]->{'runtime.connectionState'}->val) ||
|
||||
!centreon::esxd::common::is_running(power => ${$result2}[$i]->{'runtime.powerState'}->val)) {
|
||||
if (!centreon::vmware::common::is_connected(state => ${$result2}[$i]->{'runtime.connectionState'}->val) ||
|
||||
!centreon::vmware::common::is_running(power => ${$result2}[$i]->{'runtime.powerState'}->val)) {
|
||||
splice @$result2, $i, 1;
|
||||
next;
|
||||
}
|
||||
|
@ -154,14 +171,14 @@ sub run {
|
|||
}
|
||||
|
||||
# Vsphere >= 4.1
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result2,
|
||||
[{'label' => 'disk.numberRead.summation', 'instances' => ['*']},
|
||||
{'label' => 'disk.numberWrite.summation', 'instances' => ['*']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1);
|
||||
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
foreach (keys %$values) {
|
||||
my ($vm_id, $id, $disk_name) = split(/:/);
|
||||
|
@ -169,7 +186,7 @@ sub run {
|
|||
# RDM Disk. We skip. Don't know how to manage it right now.
|
||||
next if (!defined($disk_name{$disk_name}));
|
||||
|
||||
my $tmp_value = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$_}[0] / $self->{connector}->{perfcounter_speriod}));
|
||||
my $tmp_value = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$_}[0] / $self->{connector}->{perfcounter_speriod}));
|
||||
$datastore_lun{$disk_name{$disk_name}}{$self->{connector}->{perfcounter_cache_reverse}->{$id}} += $tmp_value;
|
||||
if (!defined($datastore_lun{$disk_name{$disk_name}}{$vm_id . '_' . $self->{connector}->{perfcounter_cache_reverse}->{$id}})) {
|
||||
$datastore_lun{$disk_name{$disk_name}}{$vm_id . '_' . $self->{connector}->{perfcounter_cache_reverse}->{$id}} = $tmp_value;
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastoresnapshot;
|
||||
package centreon::vmware::cmddatastoresnapshot;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning_total', 'critical_total', 'warning_snapshot', 'critical_snapshot')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -76,7 +93,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{datastore_name}/;
|
||||
}
|
||||
my @properties = ('summary.accessible', 'summary.name', 'browser');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -86,7 +103,7 @@ sub run {
|
|||
my @ds_array = ();
|
||||
my %ds_names = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::datastore_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::datastore_state(connector => $self->{connector},
|
||||
name => $entity_view->{'summary.name'},
|
||||
state => $entity_view->{'summary.accessible'},
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -99,7 +116,7 @@ sub run {
|
|||
|
||||
@properties = ();
|
||||
my $result2;
|
||||
return if (!($result2 = centreon::esxd::common::get_views($self->{connector}, \@ds_array, \@properties)));
|
||||
return if (!($result2 = centreon::vmware::common::get_views($self->{connector}, \@ds_array, \@properties)));
|
||||
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All snapshot sizes are ok"));
|
||||
|
@ -110,7 +127,7 @@ sub run {
|
|||
$dsName = $ds_names{$tmp_name};
|
||||
|
||||
$self->{manager}->{output}->output_add(long_msg => "Checking datastore '$dsName':");
|
||||
my ($snapshots, $msg) = centreon::esxd::common::search_in_datastore($self->{connector}, $browse_ds, '[' . $dsName . ']', [VmSnapshotFileQuery->new()], 1);
|
||||
my ($snapshots, $msg) = centreon::vmware::common::search_in_datastore($self->{connector}, $browse_ds, '[' . $dsName . ']', [VmSnapshotFileQuery->new()], 1);
|
||||
if (!defined($snapshots)) {
|
||||
$msg =~ s/\n/ /g;
|
||||
if ($msg =~ /NoPermissionFault/i) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastoreusage;
|
||||
package centreon::vmware::cmddatastoreusage;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -54,7 +71,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -81,7 +98,7 @@ sub run {
|
|||
}
|
||||
my @properties = ('summary');
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -93,7 +110,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::datastore_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::datastore_state(connector => $self->{connector},
|
||||
name => $entity_view->summary->name,
|
||||
state => $entity_view->summary->accessible,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmddatastorevm;
|
||||
package centreon::vmware::cmddatastorevm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
use File::Basename;
|
||||
|
||||
sub new {
|
||||
|
@ -62,7 +79,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -101,7 +118,7 @@ sub run {
|
|||
if (defined($self->{display_description})) {
|
||||
push @properties, 'config.annotation';
|
||||
}
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -119,7 +136,7 @@ sub run {
|
|||
my $mapped_datastore = {};
|
||||
my @ds_array = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
power => $entity_view->{'runtime.powerState'}->val,
|
||||
|
@ -137,7 +154,7 @@ sub run {
|
|||
}
|
||||
|
||||
@properties = ('info');
|
||||
my $result2 = centreon::esxd::common::get_views($self->{connector}, \@ds_array, \@properties);
|
||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@ds_array, \@properties);
|
||||
return if (!defined($result2));
|
||||
|
||||
#my %uuid_list = ();
|
||||
|
@ -158,25 +175,25 @@ sub run {
|
|||
|
||||
# Vsphere >= 4.1
|
||||
# We don't filter. To filter we'll need to get disk from vms
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'disk.numberRead.summation', 'instances' => ['*']},
|
||||
{'label' => 'disk.numberWrite.summation', 'instances' => ['*']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All Datastore IOPS counters are ok"));
|
||||
my $finded = 0;
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0 &&
|
||||
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
next if (centreon::vmware::common::is_connected(state => $entity_view->{'runtime.connectionState'}->val) == 0 &&
|
||||
centreon::vmware::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
my $prefix_msg = "'$entity_view->{name}'";
|
||||
if (defined($self->{display_description}) && defined($entity_view->{'config.annotation'}) &&
|
||||
$entity_view->{'config.annotation'} ne '') {
|
||||
$prefix_msg .= ' [' . centreon::esxd::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
$prefix_msg .= ' [' . centreon::vmware::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
}
|
||||
|
||||
$finded |= 1;
|
||||
|
@ -195,8 +212,8 @@ sub run {
|
|||
|
||||
foreach (sort keys %datastore_lun) {
|
||||
$finded |= 2;
|
||||
my $read_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberRead.summation'} / $self->{connector}->{perfcounter_speriod}));
|
||||
my $write_counter = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($datastore_lun{$_}{'disk.numberWrite.summation'} / $self->{connector}->{perfcounter_speriod}));
|
||||
my $read_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($datastore_lun{$_}{'disk.numberRead.summation'} / $self->{connector}->{perfcounter_speriod}));
|
||||
my $write_counter = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($datastore_lun{$_}{'disk.numberWrite.summation'} / $self->{connector}->{perfcounter_speriod}));
|
||||
|
||||
my $exit = $self->{manager}->{perfdata}->threshold_check(value => $read_counter, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
$self->{manager}->{output}->output_add(long_msg => sprintf("%s read iops on '%s' is %s",
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdgetmap;
|
||||
package centreon::vmware::cmdgetmap;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -37,7 +54,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -60,7 +77,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'vm');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
|
@ -77,7 +94,7 @@ sub run {
|
|||
}
|
||||
|
||||
@properties = ('name', 'summary.runtime.powerState');
|
||||
my $result2 = centreon::esxd::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||
return if (!defined($result2));
|
||||
|
||||
my %vms = ();
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdhealthhost;
|
||||
package centreon::vmware::cmdhealthhost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -43,7 +60,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => 0);
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => 0);
|
||||
|
@ -71,7 +88,7 @@ sub run {
|
|||
|
||||
my @properties = ('name', 'runtime.healthSystemRuntime.hardwareStatusInfo', 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo',
|
||||
'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -83,7 +100,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdlimitvm;
|
||||
package centreon::vmware::cmdlimitvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -61,7 +78,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -78,7 +95,7 @@ sub display_verbose {
|
|||
foreach my $vm (sort keys %{$options{vms}}) {
|
||||
my $prefix = $vm;
|
||||
if ($options{vms}->{$vm} ne '') {
|
||||
$prefix .= ' [' . centreon::esxd::common::strip_cr(value => $options{vms}->{$vm}) . ']';
|
||||
$prefix .= ' [' . centreon::vmware::common::strip_cr(value => $options{vms}->{$vm}) . ']';
|
||||
}
|
||||
$self->{manager}->{output}->output_add(long_msg => ' ' . $prefix);
|
||||
}
|
||||
|
@ -108,7 +125,7 @@ sub run {
|
|||
push @properties, 'config.annotation';
|
||||
}
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -126,7 +143,7 @@ sub run {
|
|||
my %memory_limit = ();
|
||||
my %disk_limit = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -134,7 +151,7 @@ sub run {
|
|||
multiple => $multiple) == 0);
|
||||
|
||||
next if (defined($self->{nopoweredon_skip}) &&
|
||||
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
centreon::vmware::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
|
||||
# CPU Limit
|
||||
if (defined($entity_view->{'config.cpuAllocation.limit'}) && $entity_view->{'config.cpuAllocation.limit'} != -1) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdlistdatacenters;
|
||||
package centreon::vmware::cmdlistdatacenters;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -37,7 +54,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -62,7 +79,7 @@ sub run {
|
|||
}
|
||||
my @properties = ('name');
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datacenter', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datacenter', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (!defined($self->{disco_show})) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdlistdatastores;
|
||||
package centreon::vmware::cmdlistdatastores;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -37,7 +54,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -62,7 +79,7 @@ sub run {
|
|||
}
|
||||
my @properties = ('summary');
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (!defined($self->{disco_show})) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdlistnichost;
|
||||
package centreon::vmware::cmdlistnichost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -37,7 +54,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -53,7 +70,7 @@ sub run {
|
|||
|
||||
my %filters = (name => $self->{esx_hostname});
|
||||
my @properties = ('config.network.pnic', 'config.network.vswitch', 'config.network.proxySwitch');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
# Get Name from vswitch
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdmaintenancehost;
|
||||
package centreon::vmware::cmdmaintenancehost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -49,7 +66,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -74,7 +91,7 @@ sub run {
|
|||
}
|
||||
|
||||
my @properties = ('name', 'runtime.inMaintenanceMode', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -86,7 +103,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdmemhost;
|
||||
package centreon::vmware::cmdmemhost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -53,7 +70,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -84,26 +101,26 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'summary.hardware.memorySize', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
}
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'mem.consumed.average', 'instances' => ['']},
|
||||
{'label' => 'mem.overhead.average', 'instances' => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if ($multiple == 1) {
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All memory usages are ok"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -112,8 +129,8 @@ sub run {
|
|||
my $memory_size = $entity_view->{'summary.hardware.memorySize'}; # in B
|
||||
|
||||
# in KB
|
||||
my $mem_used = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.consumed.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_overhead = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.overhead.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_used = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.consumed.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_overhead = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.overhead.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_free = $memory_size - $mem_used;
|
||||
my $prct_used = $mem_used * 100 / $memory_size;
|
||||
my $prct_free = 100 - $prct_used;
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdmemvm;
|
||||
package centreon::vmware::cmdmemvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -59,7 +76,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -97,10 +114,10 @@ sub run {
|
|||
if (defined($self->{display_description})) {
|
||||
push @properties, 'config.annotation';
|
||||
}
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{label => 'mem.active.average', instancess => ['']},
|
||||
{label => 'mem.overhead.average', instances => ['']},
|
||||
|
@ -109,7 +126,7 @@ sub run {
|
|||
{label => 'mem.shared.average', instances => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
|
@ -119,7 +136,7 @@ sub run {
|
|||
short_msg => sprintf("All memory usages are ok"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
power => $entity_view->{'runtime.powerState'}->val,
|
||||
|
@ -130,11 +147,11 @@ sub run {
|
|||
my $memory_size = $entity_view->{'summary.config.memorySizeMB'} * 1024 * 1024;
|
||||
|
||||
# in KB
|
||||
my $mem_consumed = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.consumed.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_active = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.active.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_overhead = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.overhead.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_ballooning = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.vmmemctl.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_shared = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.shared.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_consumed = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.consumed.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_active = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.active.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_overhead = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.overhead.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_ballooning = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.vmmemctl.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $mem_shared = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.shared.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
|
||||
my $mem_free = $memory_size - $mem_consumed;
|
||||
my $prct_used = $mem_consumed * 100 / $memory_size;
|
||||
|
@ -148,7 +165,7 @@ sub run {
|
|||
my $prefix_msg = "'$entity_view->{name}'";
|
||||
if (defined($self->{display_description}) && defined($entity_view->{'config.annotation'}) &&
|
||||
$entity_view->{'config.annotation'} ne '') {
|
||||
$prefix_msg .= ' [' . centreon::esxd::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
$prefix_msg .= ' [' . centreon::vmware::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
}
|
||||
|
||||
$self->{manager}->{output}->output_add(long_msg => sprintf("%s Memory Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdnethost;
|
||||
package centreon::vmware::cmdnethost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -62,7 +79,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning_in', 'critical_in', 'warning_out', 'critical_out')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -97,7 +114,7 @@ sub run {
|
|||
if (!defined($self->{no_proxyswitch})) {
|
||||
push @properties, 'config.network.proxySwitch';
|
||||
}
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -112,7 +129,7 @@ sub run {
|
|||
my $pnic_def_down = {};
|
||||
my $query_perfs = [];
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -188,12 +205,12 @@ sub run {
|
|||
# Nothing to retrieve. problem before already.
|
||||
return if (scalar(@$query_perfs) == 0);
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
undef,
|
||||
$query_perfs,
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
|
@ -208,8 +225,8 @@ sub run {
|
|||
my @exits;
|
||||
foreach (sort keys %{$pnic_def_up->{$entity_value}}) {
|
||||
# KBps
|
||||
my $traffic_in = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'net.received.average'}->{key} . ":" . $_}[0])) * 1024 * 8;
|
||||
my $traffic_out = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'net.transmitted.average'}->{key} . ":" . $_}[0])) * 1024 * 8;
|
||||
my $traffic_in = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'net.received.average'}->{key} . ":" . $_}[0])) * 1024 * 8;
|
||||
my $traffic_out = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'net.transmitted.average'}->{key} . ":" . $_}[0])) * 1024 * 8;
|
||||
my $interface_speed = $pnic_def_up->{$entity_value}->{$_} * 1024 * 1024;
|
||||
my $in_prct = $traffic_in * 100 / $interface_speed;
|
||||
my $out_prct = $traffic_out * 100 / $interface_speed;
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdsnapshotvm;
|
||||
package centreon::vmware::cmdsnapshotvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning', 'critical')) {
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => $label, value => $options{arguments}->{$label});
|
||||
|
@ -93,7 +110,7 @@ sub run {
|
|||
push @properties, 'config.annotation';
|
||||
}
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
my %vm_consolidate = ();
|
||||
|
@ -109,7 +126,7 @@ sub run {
|
|||
short_msg => sprintf("Snapshot(s) OK"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -117,7 +134,7 @@ sub run {
|
|||
multiple => $multiple) == 0);
|
||||
|
||||
next if (defined($self->{nopoweredon_skip}) &&
|
||||
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
centreon::vmware::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
|
||||
if (defined($self->{check_consolidation}) && defined($entity_view->{'runtime.consolidationNeeded'}) && $entity_view->{'runtime.consolidationNeeded'} =~ /^true|1$/i) {
|
||||
$vm_consolidate{$entity_view->{name}} = 1;
|
||||
|
@ -141,7 +158,7 @@ sub run {
|
|||
my $prefix_msg = "'$entity_view->{name}'";
|
||||
if (defined($self->{display_description}) && defined($entity_view->{'config.annotation'}) &&
|
||||
$entity_view->{'config.annotation'} ne '') {
|
||||
$prefix_msg .= ' [' . centreon::esxd::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
$prefix_msg .= ' [' . centreon::vmware::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
}
|
||||
if (!$self->{manager}->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$vm_errors{$exit}->{$entity_view->{name}} = 1;
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdstatushost;
|
||||
package centreon::vmware::cmdstatushost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -43,7 +60,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -67,7 +84,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'summary.overallStatus', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -92,7 +109,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdstatusvm;
|
||||
package centreon::vmware::cmdstatusvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -43,7 +60,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -73,7 +90,7 @@ sub run {
|
|||
if (defined($self->{display_description})) {
|
||||
push @properties, 'config.annotation';
|
||||
}
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -98,7 +115,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdswaphost;
|
||||
package centreon::vmware::cmdswaphost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -53,7 +70,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -84,26 +101,26 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
}
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'mem.swapinRate.average', 'instances' => ['']},
|
||||
{'label' => 'mem.swapoutRate.average', 'instances' => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if ($multiple == 1) {
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All swap rate usages are ok"));
|
||||
}
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -111,8 +128,8 @@ sub run {
|
|||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
|
||||
# KBps
|
||||
my $swap_in = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapinRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_out = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapoutRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_in = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapinRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_out = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapoutRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
|
||||
my $exit1 = $self->{manager}->{perfdata}->threshold_check(value => $swap_in, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
my $exit2 = $self->{manager}->{perfdata}->threshold_check(value => $swap_out, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdswapvm;
|
||||
package centreon::vmware::cmdswapvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -59,7 +76,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -98,16 +115,16 @@ sub run {
|
|||
push @properties, 'config.annotation';
|
||||
}
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{label => 'mem.swapinRate.average', instances => ['']},
|
||||
{label => 'mem.swapoutRate.average', instances => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
|
@ -118,7 +135,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
power => $entity_view->{'runtime.powerState'}->val,
|
||||
|
@ -128,8 +145,8 @@ sub run {
|
|||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
|
||||
# KBps
|
||||
my $swap_in = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapinRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_out = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapoutRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_in = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapinRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
my $swap_out = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'mem.swapoutRate.average'}->{'key'} . ":"}[0])) * 1024;
|
||||
|
||||
my $exit1 = $self->{manager}->{perfdata}->threshold_check(value => $swap_in, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
my $exit2 = $self->{manager}->{perfdata}->threshold_check(value => $swap_out, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
|
@ -140,7 +157,7 @@ sub run {
|
|||
my $prefix_msg = "'$entity_view->{name}'";
|
||||
if (defined($self->{display_description}) && defined($entity_view->{'config.annotation'}) &&
|
||||
$entity_view->{'config.annotation'} ne '') {
|
||||
$prefix_msg .= ' [' . centreon::esxd::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
$prefix_msg .= ' [' . centreon::vmware::common::strip_cr(value => $entity_view->{'config.annotation'}) . ']';
|
||||
}
|
||||
|
||||
$self->{manager}->{output}->output_add(long_msg => sprintf("%s Swap In: %s Swap Out: %s",
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdthinprovisioningvm;
|
||||
package centreon::vmware::cmdthinprovisioningvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -50,7 +67,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -66,7 +83,7 @@ sub display_verbose {
|
|||
foreach my $vm (sort keys %{$options{vms}}) {
|
||||
my $prefix = $vm;
|
||||
if ($options{vms}->{$vm}->{description} ne '') {
|
||||
$prefix .= ' [' . centreon::esxd::common::strip_cr(value => $options{vms}->{$vm}->{description}) . ']';
|
||||
$prefix .= ' [' . centreon::vmware::common::strip_cr(value => $options{vms}->{$vm}->{description}) . ']';
|
||||
}
|
||||
$self->{manager}->{output}->output_add(long_msg => $prefix);
|
||||
foreach my $disk (sort keys %{$options{vms}->{$vm}->{disks}}) {
|
||||
|
@ -96,7 +113,7 @@ sub run {
|
|||
push @properties, 'config.annotation';
|
||||
}
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -120,7 +137,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -128,7 +145,7 @@ sub run {
|
|||
multiple => $multiple) == 0);
|
||||
|
||||
next if (defined($self->{nopoweredon_skip}) &&
|
||||
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
centreon::vmware::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
|
||||
foreach (@{$entity_view->{'config.hardware.device'}}) {
|
||||
if ($_->isa('VirtualDisk')) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdtimehost;
|
||||
package centreon::vmware::cmdtimehost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -37,7 +54,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -68,14 +85,14 @@ sub run {
|
|||
}
|
||||
my @properties = ('name', 'configManager.dateTimeSystem', 'runtime.connectionState');
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'Time Host(s):');
|
||||
my @host_array = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
if (centreon::esxd::common::is_connected(state => $entity_view->{'runtime.connectionState'}->{val}) == 0) {
|
||||
if (centreon::vmware::common::is_connected(state => $entity_view->{'runtime.connectionState'}->{val}) == 0) {
|
||||
$self->{manager}->{output}->output_add(long_msg => sprintf(" '%s' is disconnected",
|
||||
$entity_view->{name}));
|
||||
next;
|
||||
|
@ -86,7 +103,7 @@ sub run {
|
|||
}
|
||||
|
||||
@properties = ();
|
||||
my $result2 = centreon::esxd::common::get_views($self->{connector}, \@host_array, \@properties);
|
||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@host_array, \@properties);
|
||||
return if (!defined($result2));
|
||||
|
||||
foreach my $entity_view (@$result) {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdtoolsvm;
|
||||
package centreon::vmware::cmdtoolsvm;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -61,7 +78,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
}
|
||||
|
||||
|
@ -78,7 +95,7 @@ sub display_verbose {
|
|||
foreach my $vm (sort keys %{$options{vms}}) {
|
||||
my $prefix = $vm;
|
||||
if ($options{vms}->{$vm} ne '') {
|
||||
$prefix .= ' [' . centreon::esxd::common::strip_cr(value => $options{vms}->{$vm}) . ']';
|
||||
$prefix .= ' [' . centreon::vmware::common::strip_cr(value => $options{vms}->{$vm}) . ']';
|
||||
}
|
||||
$self->{manager}->{output}->output_add(long_msg => ' ' . $prefix);
|
||||
}
|
||||
|
@ -105,7 +122,7 @@ sub run {
|
|||
push @properties, 'config.annotation';
|
||||
}
|
||||
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'VirtualMachine', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -122,7 +139,7 @@ sub run {
|
|||
my %not_running = ();
|
||||
my %not_up2date = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::vm_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::vm_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
||||
|
@ -130,7 +147,7 @@ sub run {
|
|||
multiple => $multiple) == 0);
|
||||
|
||||
next if (defined($self->{nopoweredon_skip}) &&
|
||||
centreon::esxd::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
centreon::vmware::common::is_running(power => $entity_view->{'runtime.powerState'}->val) == 0);
|
||||
|
||||
my $tools_status = lc($entity_view->{'summary.guest.toolsStatus'}->val);
|
||||
if ($tools_status eq 'toolsnotinstalled') {
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmduptimehost;
|
||||
package centreon::vmware::cmduptimehost;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -53,7 +70,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'warning', value => $options{arguments}->{warning});
|
||||
$self->{manager}->{perfdata}->threshold_validate(label => 'critical', value => $options{arguments}->{critical});
|
||||
|
@ -84,7 +101,7 @@ sub run {
|
|||
$filters{name} = qr/$self->{esx_hostname}/;
|
||||
}
|
||||
my @properties = ('name', 'runtime.bootTime', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'HostSystem', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
|
@ -96,7 +113,7 @@ sub run {
|
|||
}
|
||||
|
||||
foreach my $entity_view (@$result) {
|
||||
next if (centreon::esxd::common::host_state(connector => $self->{connector},
|
||||
next if (centreon::vmware::common::host_state(connector => $self->{connector},
|
||||
hostname => $entity_view->{name},
|
||||
state => $entity_view->{'runtime.connectionState'}->val,
|
||||
status => $self->{disconnect_status},
|
|
@ -1,9 +1,26 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::cmdvmoperationcluster;
|
||||
package centreon::vmware::cmdvmoperationcluster;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
use centreon::plugins::statefile;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
|
@ -47,7 +64,7 @@ sub initArgs {
|
|||
foreach (keys %{$options{arguments}}) {
|
||||
$self->{$_} = $options{arguments}->{$_};
|
||||
}
|
||||
$self->{manager} = centreon::esxd::common::init_response();
|
||||
$self->{manager} = centreon::vmware::common::init_response();
|
||||
$self->{manager}->{output}->{plugin} = $options{arguments}->{identity};
|
||||
foreach my $label (('warning_svmotion', 'critical_svmotion', 'warning_vmotion', 'critical_vmotion',
|
||||
'warning_clone', 'critical_clone')) {
|
||||
|
@ -87,20 +104,20 @@ sub run {
|
|||
$filters{name} = qr/$self->{cluster}/;
|
||||
}
|
||||
my @properties = ('name');
|
||||
my $result = centreon::esxd::common::search_entities(command => $self, view_type => 'ClusterComputeResource', properties => \@properties, filter => \%filters);
|
||||
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'ClusterComputeResource', properties => \@properties, filter => \%filters);
|
||||
return if (!defined($result));
|
||||
|
||||
if (scalar(@$result) > 1) {
|
||||
$multiple = 1;
|
||||
}
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{connector},
|
||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||
$result,
|
||||
[{'label' => 'vmop.numVMotion.latest', 'instances' => ['']},
|
||||
{'label' => 'vmop.numSVMotion.latest', 'instances' => ['']},
|
||||
{'label' => 'vmop.numClone.latest', 'instances' => ['']}],
|
||||
$self->{connector}->{perfcounter_speriod},
|
||||
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
|
||||
return if (centreon::esxd::common::performance_errors($self->{connector}, $values) == 1);
|
||||
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
|
||||
|
||||
if ($multiple == 1) {
|
||||
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||
|
@ -112,7 +129,7 @@ sub run {
|
|||
my $checked = 0;
|
||||
foreach my $entity_view (@$result) {
|
||||
my $entity_value = $entity_view->{mo_ref}->{value};
|
||||
my $name = centreon::esxd::common::substitute_name(value => $entity_view->{name});
|
||||
my $name = centreon::vmware::common::substitute_name(value => $entity_view->{name});
|
||||
my %values = ();
|
||||
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
|
||||
my @exits;
|
|
@ -1,5 +1,22 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::common;
|
||||
package centreon::vmware::common;
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
@ -51,10 +68,10 @@ sub response {
|
|||
}
|
||||
|
||||
sub vmware_error {
|
||||
my ($obj_esxd, $lerror) = @_;
|
||||
my ($obj_vmware, $lerror) = @_;
|
||||
|
||||
$manager_display->{output}->output_add(long_msg => $lerror);
|
||||
$obj_esxd->{logger}->writeLogError("'" . $obj_esxd->{whoaim} . "' $lerror");
|
||||
$obj_vmware->{logger}->writeLogError("'" . $obj_vmware->{whoaim} . "' $lerror");
|
||||
if ($lerror =~ /NoPermissionFault/i) {
|
||||
$manager_display->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => 'VMWare error: not enought permissions');
|
||||
|
@ -134,35 +151,35 @@ sub convert_number {
|
|||
}
|
||||
|
||||
sub get_views {
|
||||
my $obj_esxd = shift;
|
||||
my $obj_vmware = shift;
|
||||
my $results;
|
||||
|
||||
eval {
|
||||
$results = $obj_esxd->{session1}->get_views(mo_ref_array => $_[0], properties => $_[1]);
|
||||
$results = $obj_vmware->{session1}->get_views(mo_ref_array => $_[0], properties => $_[1]);
|
||||
};
|
||||
if ($@) {
|
||||
vmware_error($obj_esxd, $@);
|
||||
vmware_error($obj_vmware, $@);
|
||||
return undef;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
sub get_view {
|
||||
my $obj_esxd = shift;
|
||||
my $obj_vmware = shift;
|
||||
my $results;
|
||||
|
||||
eval {
|
||||
$results = $obj_esxd->{session1}->get_view(mo_ref => $_[0], properties => $_[1]);
|
||||
$results = $obj_vmware->{session1}->get_view(mo_ref => $_[0], properties => $_[1]);
|
||||
};
|
||||
if ($@) {
|
||||
vmware_error($obj_esxd, $@);
|
||||
vmware_error($obj_vmware, $@);
|
||||
return undef;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
sub search_in_datastore {
|
||||
my $obj_esxd = shift;
|
||||
my $obj_vmware = shift;
|
||||
my ($ds_browse, $ds_name, $query, $return) = @_;
|
||||
my $result;
|
||||
|
||||
|
@ -179,26 +196,26 @@ sub search_in_datastore {
|
|||
};
|
||||
if ($@) {
|
||||
return (undef, $@) if (defined($return) && $return == 1);
|
||||
vmware_error($obj_esxd, $@);
|
||||
vmware_error($obj_vmware, $@);
|
||||
return undef;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub get_perf_metric_ids {
|
||||
my $obj_esxd = shift;
|
||||
my $obj_vmware = shift;
|
||||
my $perf_names = $_[0];
|
||||
my $filtered_list = [];
|
||||
|
||||
foreach (@$perf_names) {
|
||||
if (defined($obj_esxd->{perfcounter_cache}->{$_->{label}})) {
|
||||
if (defined($obj_vmware->{perfcounter_cache}->{$_->{label}})) {
|
||||
foreach my $instance (@{$_->{instances}}) {
|
||||
my $metric = PerfMetricId->new(counterId => $obj_esxd->{perfcounter_cache}->{$_->{label}}{key},
|
||||
my $metric = PerfMetricId->new(counterId => $obj_vmware->{perfcounter_cache}->{$_->{label}}{key},
|
||||
instance => $instance);
|
||||
push @$filtered_list, $metric;
|
||||
}
|
||||
} else {
|
||||
$obj_esxd->{logger}->writeLogError("Metric '" . $_->{label} . "' unavailable.");
|
||||
$obj_vmware->{logger}->writeLogError("Metric '" . $_->{label} . "' unavailable.");
|
||||
$manager_display->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Counter doesn't exist. VMware version can be too old.");
|
||||
return undef;
|
||||
|
@ -285,7 +302,7 @@ sub performance_builder_global {
|
|||
}
|
||||
|
||||
sub generic_performance_values_historic {
|
||||
my ($obj_esxd, $views, $perfs, $interval, %options) = @_;
|
||||
my ($obj_vmware, $views, $perfs, $interval, %options) = @_;
|
||||
my $counter = 0;
|
||||
my %results;
|
||||
|
||||
|
@ -293,12 +310,12 @@ sub generic_performance_values_historic {
|
|||
my $perfdata;
|
||||
|
||||
if (defined($views)) {
|
||||
$perfdata = performance_builder_global(connector => $obj_esxd,
|
||||
$perfdata = performance_builder_global(connector => $obj_vmware,
|
||||
views => $views,
|
||||
metrics => $perfs,
|
||||
interval => $interval);
|
||||
} else {
|
||||
$perfdata = performance_builder_specific(connector => $obj_esxd,
|
||||
$perfdata = performance_builder_specific(connector => $obj_vmware,
|
||||
metrics => $perfs,
|
||||
interval => $interval);
|
||||
}
|
||||
|
@ -334,38 +351,38 @@ sub generic_performance_values_historic {
|
|||
}
|
||||
};
|
||||
if ($@) {
|
||||
$obj_esxd->{logger}->writeLogError("'" . $obj_esxd->{whoaim} . "' $@");
|
||||
$obj_vmware->{logger}->writeLogError("'" . $obj_vmware->{whoaim} . "' $@");
|
||||
return undef;
|
||||
}
|
||||
return \%results;
|
||||
}
|
||||
|
||||
sub cache_perf_counters {
|
||||
my $obj_esxd = shift;
|
||||
my $obj_vmware = shift;
|
||||
|
||||
eval {
|
||||
$obj_esxd->{perfmanager_view} = $obj_esxd->{session1}->get_view(mo_ref => $obj_esxd->{session1}->get_service_content()->perfManager, properties => ['perfCounter', 'historicalInterval']);
|
||||
foreach (@{$obj_esxd->{perfmanager_view}->perfCounter}) {
|
||||
$obj_vmware->{perfmanager_view} = $obj_vmware->{session1}->get_view(mo_ref => $obj_vmware->{session1}->get_service_content()->perfManager, properties => ['perfCounter', 'historicalInterval']);
|
||||
foreach (@{$obj_vmware->{perfmanager_view}->perfCounter}) {
|
||||
my $label = $_->groupInfo->key . "." . $_->nameInfo->key . "." . $_->rollupType->val;
|
||||
$obj_esxd->{perfcounter_cache}->{$label} = {'key' => $_->key, 'unitkey' => $_->unitInfo->key};
|
||||
$obj_esxd->{perfcounter_cache_reverse}->{$_->key} = $label;
|
||||
$obj_vmware->{perfcounter_cache}->{$label} = {'key' => $_->key, 'unitkey' => $_->unitInfo->key};
|
||||
$obj_vmware->{perfcounter_cache_reverse}->{$_->key} = $label;
|
||||
}
|
||||
|
||||
my $historical_intervals = $obj_esxd->{perfmanager_view}->historicalInterval;
|
||||
my $historical_intervals = $obj_vmware->{perfmanager_view}->historicalInterval;
|
||||
|
||||
foreach (@$historical_intervals) {
|
||||
if ($obj_esxd->{perfcounter_speriod} == -1 || $obj_esxd->{perfcounter_speriod} > $_->samplingPeriod) {
|
||||
$obj_esxd->{perfcounter_speriod} = $_->samplingPeriod;
|
||||
if ($obj_vmware->{perfcounter_speriod} == -1 || $obj_vmware->{perfcounter_speriod} > $_->samplingPeriod) {
|
||||
$obj_vmware->{perfcounter_speriod} = $_->samplingPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
# Put refresh = 20 (for ESX check)
|
||||
if ($obj_esxd->{perfcounter_speriod} == -1) {
|
||||
$obj_esxd->{perfcounter_speriod} = 20;
|
||||
if ($obj_vmware->{perfcounter_speriod} == -1) {
|
||||
$obj_vmware->{perfcounter_speriod} = 20;
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
$obj_esxd->{logger}->writeLogError("'" . $obj_esxd->{whoaim} . "' $@");
|
||||
$obj_vmware->{logger}->writeLogError("'" . $obj_vmware->{whoaim} . "' $@");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -469,7 +486,7 @@ sub find_entity_views {
|
|||
}
|
||||
|
||||
sub performance_errors {
|
||||
my ($obj_esxd, $values) = @_;
|
||||
my ($obj_vmware, $values) = @_;
|
||||
|
||||
# Error counter not available or other from function
|
||||
return 1 if (!defined($values) || scalar(keys(%$values)) <= 0);
|
|
@ -1,5 +1,22 @@
|
|||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package centreon::esxd::connector;
|
||||
package centreon::vmware::connector;
|
||||
|
||||
use strict;
|
||||
use VMware::VIRuntime;
|
||||
|
@ -10,7 +27,7 @@ use ZMQ::Constants qw(:all);
|
|||
use File::Basename;
|
||||
use POSIX ":sys_wait_h";
|
||||
use centreon::script;
|
||||
use centreon::esxd::common;
|
||||
use centreon::vmware::common;
|
||||
|
||||
my %handlers = (TERM => {}, HUP => {}, CHLD => {});
|
||||
my ($connector, $backend);
|
||||
|
@ -108,11 +125,11 @@ sub handle_CHLD {
|
|||
sub response_router {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $manager = centreon::esxd::common::init_response();
|
||||
my $manager = centreon::vmware::common::init_response();
|
||||
$manager->{output}->output_add(severity => $options{severity},
|
||||
short_msg => $options{msg});
|
||||
$manager->{output}->{plugin} = $options{identity};
|
||||
centreon::esxd::common::response(token => 'RESPSERVER2', endpoint => $backend);
|
||||
centreon::vmware::common::response(token => 'RESPSERVER2', endpoint => $backend);
|
||||
}
|
||||
|
||||
sub verify_child {
|
||||
|
@ -168,7 +185,7 @@ sub reqclient {
|
|||
$self->{modules_registry}->{$result->{command}}->initArgs(arguments => $result);
|
||||
$self->{modules_registry}->{$result->{command}}->run();
|
||||
|
||||
centreon::esxd::common::response(token => 'RESPSERVER2', endpoint => $backend, reinit => 'ipc:///tmp/centreonesxd/routing.ipc');
|
||||
centreon::vmware::common::response(token => 'RESPSERVER2', endpoint => $backend, reinit => 'ipc:///tmp/centreon_vmware/routing.ipc');
|
||||
zmq_close($backend);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -202,8 +219,8 @@ sub run {
|
|||
$backend = zmq_socket($context, ZMQ_DEALER);
|
||||
zmq_setsockopt($backend, ZMQ_IDENTITY, "server-" . $connector->{whoaim});
|
||||
zmq_setsockopt($backend, ZMQ_LINGER, 0); # we discard
|
||||
zmq_connect($backend, 'ipc:///tmp/centreonesxd/routing.ipc');
|
||||
centreon::esxd::common::response(token => 'READY', endpoint => $backend, stdout => '');
|
||||
zmq_connect($backend, 'ipc:///tmp/centreon_vmware/routing.ipc');
|
||||
centreon::vmware::common::response(token => 'READY', endpoint => $backend, stdout => '');
|
||||
|
||||
# Initialize poll set
|
||||
my @poll = (
|
||||
|
@ -251,16 +268,16 @@ sub run {
|
|||
}
|
||||
|
||||
if ($connector->{vsphere_connected} == 0) {
|
||||
if (!centreon::esxd::common::connect_vsphere($connector->{logger},
|
||||
$connector->{whoaim},
|
||||
$connector->{config_vsphere_connect_timeout},
|
||||
\$connector->{session1},
|
||||
$connector->{config_vsphere_url},
|
||||
$connector->{config_vsphere_user},
|
||||
$connector->{config_vsphere_pass})) {
|
||||
if (!centreon::vmware::common::connect_vsphere($connector->{logger},
|
||||
$connector->{whoaim},
|
||||
$connector->{config_vsphere_connect_timeout},
|
||||
\$connector->{session1},
|
||||
$connector->{config_vsphere_url},
|
||||
$connector->{config_vsphere_user},
|
||||
$connector->{config_vsphere_pass})) {
|
||||
$connector->{logger}->writeLogInfo("'" . $connector->{whoaim} . "' Vsphere connection ok");
|
||||
$connector->{logger}->writeLogInfo("'" . $connector->{whoaim} . "' Create perf counters cache in progress");
|
||||
if (!centreon::esxd::common::cache_perf_counters($connector)) {
|
||||
if (!centreon::vmware::common::cache_perf_counters($connector)) {
|
||||
$connector->{last_time_vsphere} = time();
|
||||
$connector->{keeper_session_time} = time();
|
||||
$connector->{vsphere_connected} = 1;
|
||||
|
@ -274,7 +291,7 @@ sub run {
|
|||
###
|
||||
if (defined($connector->{keeper_session_time}) &&
|
||||
(time() - $connector->{keeper_session_time}) > ($connector->{config_vsphere_session_heartbeat} * 60)) {
|
||||
centreon::esxd::common::heartbeat(connector => $connector);
|
||||
centreon::vmware::common::heartbeat(connector => $connector);
|
||||
}
|
||||
|
||||
my $data_element;
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/perl
|
||||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
use warnings;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
use centreon::script::centreon_vmware;
|
||||
|
||||
centreon::script::centreon_vmware->new()->run();
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
centreon_vmware.pl - a daemon to handle VMWare checks.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
centreon_vmware.pl [options]
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--config-extra>
|
||||
|
||||
Specify the path to the centreon_vmware configuration file (default: /etc/centreon/centreon_vmware.pm).
|
||||
|
||||
=item B<--help>
|
||||
|
||||
Print a brief help message and exits.
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<centreon_vmware.pl> will connect to ESX and/or VirtualCenter.
|
||||
Use the plugin 'apps::vmware::connector::plugin' from: https://github.com/centreon/centreon-plugins
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue