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

@ -35,33 +35,35 @@ sub set_system {
$self->{cb_hook1} = 'get_type'; $self->{cb_hook1} = 'get_type';
$self->{thresholds} = { $self->{thresholds} = {
['Unknown', 'OK'], default => [
['OK', 'OK'], ['Unknown', 'OK'],
['Degraded', 'WARNING'], ['OK', 'OK'],
['Minor failure', 'WARNING'], ['Degraded', 'WARNING'],
['Major failure', 'CRITICAL'], ['Minor failure', 'WARNING'],
['Critical failure', 'CRITICAL'], ['Major failure', 'CRITICAL'],
['Non-recoverable error', 'CRITICAL'], ['Critical failure', 'CRITICAL'],
['Non-recoverable error', 'CRITICAL'],
['Other', 'UNKNOWN'],
['Stressed', 'WARNING'], ['Other', 'UNKNOWN'],
['Predictive Failure', 'WARNING'], ['Stressed', 'WARNING'],
['Error', 'CRITICAL'], ['Predictive Failure', 'WARNING'],
['Starting', 'OK'], ['Error', 'CRITICAL'],
['Stopping', 'WARNING'], ['Starting', 'OK'],
['In Service', 'OK'], ['Stopping', 'WARNING'],
['No Contact', 'CRITICAL'], ['In Service', 'OK'],
['Lost Communication', 'CRITICAL'], ['No Contact', 'CRITICAL'],
['Aborted', 'CRITICAL'], ['Lost Communication', 'CRITICAL'],
['Dormant', 'OK'], ['Aborted', 'CRITICAL'],
['Supporting Entity in Error', 'CRITICAL'], ['Dormant', 'OK'],
['Completed', 'OK'], ['Supporting Entity in Error', 'CRITICAL'],
['Power Mode', 'OK'], ['Completed', 'OK'],
['Relocating', 'WARNING'], ['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', $self->{components_module} = ['omc_discretesensor', 'omc_fan', 'omc_psu', 'vmware_storageextent', 'vmware_controller',
'vmware_storagevolume', 'vmware_battery', 'vmware_sassataport', 'cim_card', 'vmware_storagevolume', 'vmware_battery', 'vmware_sassataport', 'cim_card',
'cim_computersystem', 'cim_numericsensor', 'cim_memory', 'cim_processor', 'cim_recordlog']; 'cim_computersystem', 'cim_numericsensor', 'cim_memory', 'cim_processor', 'cim_recordlog'];
@ -83,14 +85,14 @@ sub new {
sub get_type { sub get_type {
my ($self, %options) = @_; my ($self, %options) = @_;
my $result = $options{wsman}->request(uri => 'http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/OMC_SMASHFirmwareIdentity'); 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); $result = pop(@$result) if (defined($result));
$self->{manufacturer} = 'unknown'; $self->{manufacturer} = 'unknown';
if (defined($result->{Manufacturer}) && $result->{Manufacturer} ne '') { if (defined($result->{Manufacturer}) && $result->{Manufacturer} ne '') {
$self->{manufacturer} = $result->{Manufacturer}; $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); $result = pop(@$result);
my $model = defined($result->{Model}) && $result->{Model} ne '' ? $result->{Model} : 'unknown'; my $model = defined($result->{Model}) && $result->{Model} ne '' ? $result->{Model} : 'unknown';