This commit is contained in:
Quentin Garnier 2013-12-06 12:36:02 +01:00
parent 68271b1d35
commit ad11cdd3b8
4 changed files with 12 additions and 19 deletions

View File

@ -6,7 +6,7 @@ use IO::Socket;
use Getopt::Long;
my $PROGNAME = $0;
my $VERSION = "1.5.2";
my $VERSION = "1.5.3";
my %ERRORS = (OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3, DEPENDENT => 4);
my $socket;
my $separatorin = '~';
@ -66,7 +66,6 @@ GetOptions(
"nic=s" => \$OPTION{nic},
"older=i" => \$OPTION{older},
"warn" => \$OPTION{warn},
"crit" => \$OPTION{crit},
@ -772,30 +771,36 @@ sub listhost_get_str {
}
sub listdatastore_check_arg {
if (defined($OPTION{show_attributes})) {
print "<data><element>name</element></data>\n";
}
$OPTION{xml} = (defined($OPTION{xml}) ? 1 : 0);
$OPTION{show_attributes} = (defined($OPTION{show_attributes}) ? 1 : 0);
return 0;
}
sub listdatastore_get_str {
return join($separatorin,
('listdatastore', $OPTION{vsphere}, $OPTION{xml}, $OPTION{show_attributes}));
('listdatastore', $OPTION{vsphere}, $OPTION{xml}));
}
sub listnichost_check_arg {
if (defined($OPTION{show_attributes})) {
print "<data><element>name</element></data>\n";
exit(0);
}
if (!defined($OPTION{'esx-host'})) {
print "Option --esx-host is required\n";
print_usage();
exit $ERRORS{UNKNOWN};
}
$OPTION{xml} = (defined($OPTION{xml}) ? 1 : 0);
$OPTION{show_attributes} = (defined($OPTION{show_attributes}) ? 1 : 0);
return 0;
}
sub listnichost_get_str {
return join($separatorin,
('listnichost', $OPTION{vsphere}, $OPTION{'esx-host'}, $OPTION{xml}, $OPTION{show_attributes}));
('listnichost', $OPTION{vsphere}, $OPTION{'esx-host'}, $OPTION{xml}));
}
sub getmap_check_arg {

View File

@ -20,7 +20,7 @@ BEGIN {
use base qw(centreon::script);
use vars qw(%centreonesxd_config);
my $VERSION = "1.5.2";
my $VERSION = "1.5.3";
my %handlers = (TERM => {}, HUP => {}, CHLD => {});
my @load_modules = ('centreon::esxd::cmdcountvmhost',
'centreon::esxd::cmdcpuhost',

View File

@ -29,17 +29,11 @@ sub checkArgs {
sub initArgs {
my $self = shift;
$self->{xml} = (defined($_[0]) && $_[0] == 1) ? 1 : 0;
$self->{show_attributes} = (defined($_[1]) && $_[1] == 1) ? 1 : 0;
}
sub run {
my $self = shift;
if ($self->{show_attributes} == 1) {
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status(0) . "|<data><element>name</element></data>\n");
return ;
}
my %filters = ();
my @properties = ('summary');

View File

@ -36,17 +36,11 @@ sub initArgs {
my $self = shift;
$self->{lhost} = $_[0];
$self->{xml} = (defined($_[1]) && $_[1] == 1) ? 1 : 0;
$self->{show_attributes} = (defined($_[2]) && $_[2] == 1) ? 1 : 0;
}
sub run {
my $self = shift;
my %nic_in_vswitch = ();
if ($self->{show_attributes} == 1) {
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status(0) . "|<data><element>name</element></data>\n");
return ;
}
my %filters = ('name' => $self->{lhost});
my @properties = ('config.network.pnic', 'config.network.vswitch', 'config.network.proxySwitch');