fix wsman vmware

This commit is contained in:
qgarnier 2017-09-18 14:41:59 +02:00
parent 71e52a35a9
commit 7b8e7af662
1 changed files with 30 additions and 28 deletions

View File

@ -36,6 +36,7 @@ sub set_system {
$self->{cb_hook1} = 'get_type';
$self->{thresholds} = {
default => [
['Unknown', 'OK'],
['OK', 'OK'],
['Degraded', 'WARNING'],
@ -59,9 +60,10 @@ sub set_system {
['Completed', 'OK'],
['Power Mode', 'OK'],
['Relocating', 'WARNING'],
],
};
$self->{components_path} = 'apps::vmware::wsman::mode::components::components';
$self->{components_path} = 'apps::vmware::wsman::mode::components';
$self->{components_module} = ['omc_discretesensor', 'omc_fan', 'omc_psu', 'vmware_storageextent', 'vmware_controller',
'vmware_storagevolume', 'vmware_battery', 'vmware_sassataport', 'cim_card',
'cim_computersystem', 'cim_numericsensor', 'cim_memory', 'cim_processor', 'cim_recordlog'];
@ -83,14 +85,14 @@ sub new {
sub get_type {
my ($self, %options) = @_;
my $result = $options{wsman}->request(uri => 'http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_SMASHFirmwareIdentity');
$result = pop(@$result);
my $result = $options{wsman}->request(uri => 'http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_SMASHFirmwareIdentity', dont_quit => 1);
$result = pop(@$result) if (defined($result));
$self->{manufacturer} = 'unknown';
if (defined($result->{Manufacturer}) && $result->{Manufacturer} ne '') {
$self->{manufacturer} = $result->{Manufacturer};
}
$result = $self->{wsman}->request(uri => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Chassis');
$result = $options{wsman}->request(uri => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Chassis');
$result = pop(@$result);
my $model = defined($result->{Model}) && $result->{Model} ne '' ? $result->{Model} : 'unknown';