mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 08:34:46 +02:00
add resource-type option for discovery
This commit is contained in:
parent
42bbebb781
commit
649b949d6c
@ -1,4 +1,5 @@
|
|||||||
# Copyright 2015 Centreon (http://www.centreon.com/)
|
#
|
||||||
|
# Copyright 2019 Centreon (http://www.centreon.com/)
|
||||||
#
|
#
|
||||||
# Centreon is a full-fledged industry-strength solution that meets
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
# the needs in IT infrastructure and application monitoring for
|
# the needs in IT infrastructure and application monitoring for
|
||||||
@ -15,6 +16,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
package centreon::vmware::cmddiscovery;
|
package centreon::vmware::cmddiscovery;
|
||||||
|
|
||||||
@ -37,6 +39,13 @@ sub new {
|
|||||||
sub checkArgs {
|
sub checkArgs {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
if (defined($options{arguments}->{resource_type}) && $options{arguments}->{resource_type} !~ /^vm$|^esx$/) {
|
||||||
|
centreon::vmware::common::set_response(code => 100, short_message => "Argument error: resource type must be 'vm' or 'esx'");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->{resource_type} = $options{arguments}->{resource_type} if (defined($options{arguments}->{resource_type}));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +110,8 @@ sub run {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
push @disco_data, \%esx;
|
push @disco_data, \%esx if ($self->{resource_type} eq 'esx');
|
||||||
|
next if ($self->{resource_type} ne 'vm');
|
||||||
|
|
||||||
@properties = ('config.name', 'config.annotation', 'config.template', 'config.uuid', 'config.version',
|
@properties = ('config.name', 'config.annotation', 'config.template', 'config.uuid', 'config.version',
|
||||||
'config.guestId', 'guest.guestState', 'guest.hostName', 'guest.ipAddress', 'runtime.powerState');
|
'config.guestId', 'guest.guestState', 'guest.hostName', 'guest.ipAddress', 'runtime.powerState');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user