Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctor 146 escalation microsoft hyperv 2012 add option for powershell module version in node integration service mode #5080

7 changes: 4 additions & 3 deletions .github/scripts/pod_spell_check.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use Test::More;
use Test::Spelling;

if (!@ARGV) {
die "Missing perl file to check.";
die "Usage: perl pod_spell_check.t module.pm stopwords.t";
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
}

my $stopword_filename='tests/resources/spellcheck/stopwords.t';
Expand All @@ -14,9 +14,10 @@ if(defined($ARGV[1])){
}
open(FILE, "<", $stopword_filename)
or die "Could not open $stopword_filename";
printf("stopword file use : ".$stopword_filename." \n");
printf("Using dictionary: ".$stopword_filename." \n");

add_stopwords(<FILE>);
close(FILE);
set_spell_cmd('hunspell -l');
all_pod_files_spelling_ok($ARGV[0]);
close(FILE);

Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,34 @@ sub manage_selection {
my $services = (ref($node->{services}) eq 'ARRAY') ? $node->{services} : [ $node->{services} ];

foreach my $service (@$services) {
my $primary_status;
my $secondary_status;
if ( defined($service->{primary_operational_status}) ) {
omercier marked this conversation as resolved.
Show resolved Hide resolved
if ( defined($node_vm_integration_service_operational_status->{ $service->{primary_operational_status}}) ) {
$primary_status = $node_vm_integration_service_operational_status->{ $service->{primary_operational_status} };
} else {
$primary_status = $service->{primary_operational_status};
}
} else {
$primary_status = '-';
}
if ( defined($service->{secondary_operational_status}) ) {
if ( defined($node_vm_integration_service_operational_status->{ $service->{secondary_operational_status}}) ) {
$secondary_status = $node_vm_integration_service_operational_status->{ $service->{secondary_operational_status} };
} else {
$secondary_status = $service->{secondary_operational_status};
}
} else {
$secondary_status = '-';
}


$self->{vm}->{$id}->{service}->{$id2} = {
vm => $node->{name},
service => $service->{service},
enabled => $service->{enabled} =~ /True|1/i ? 1 : 0,
primary_status =>
defined($service->{primary_operational_status}) && defined($node_vm_integration_service_operational_status->{ $service->{primary_operational_status} }) ?
$node_vm_integration_service_operational_status->{ $service->{primary_operational_status} } : '-',
secondary_status =>
defined($service->{secondary_operational_status}) && defined($node_vm_integration_service_operational_status->{ $service->{secondary_operational_status} }) ?
$node_vm_integration_service_operational_status->{ $service->{secondary_operational_status} } : '-'
primary_status => $primary_status,
secondary_status => $secondary_status
};
$id2++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/trendmicro/iwsva/snmp/plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ __END__

=head1 PLUGIN DESCRIPTION

Check TendMicro Iwsva equipments in SNMP.
Check TrendMicro Iwsva equipments in SNMP.

=cut
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ $culture = new-object "System.Globalization.CultureInfo" "en-us"
$ps .= centreon::common::powershell::functions::escape_jsonstring(%options);
$ps .= centreon::common::powershell::functions::convert_to_json(%options);

# if the version of HyperV Powershell module is higher than 2.0.0 and not compatible with
# the following script, then use this Import-Module instead:
# Import-Module -Name "Hyper-V" -MaximumVersion "2.0.0"
$ps .= '
$ProgressPreference = "SilentlyContinue"

Expand Down Expand Up @@ -68,8 +71,19 @@ Try {

$item_service.service = $service.Name
$item_service.enabled = $service.Enabled

# this works for sure on v1.1 of HyperV Powershell module
$item_service.primary_operational_status = $service.PrimaryOperationalStatus.value__
$item_service.secondary_operational_status = $service.SecondaryOperationalStatus.value__

# this works for sure on v2.0.0 of HyperV Powershell module
if (($service.PrimaryStatusDescription -ne $null) -and ($service.PrimaryStatusDescription -ne "")) {
$item_service.primary_operational_status = $service.PrimaryStatusDescription
}
if (($service.SecondaryStatusDescription -ne $null) -and ($service.SecondaryStatusDescription -ne "")) {
$item_service.secondary_operational_status = $service.SecondaryStatusDescription
}

$services.Add($item_service)
}

Expand All @@ -96,6 +110,6 @@ __END__

=head1 DESCRIPTION

Method to get hyper-v informations.
Method to get Hyper-V information.

=cut
7 changes: 7 additions & 0 deletions tests/resources/spellcheck/stopwords.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
--exclude-fs
--filter-fs
--filter-vdom
--filter-vm
--force-counters32
--force-counters64
--force-oid
Expand All @@ -34,6 +35,9 @@
--oid-filter
--urlpath
--warning-bytesallocatedpercentage
-EncodedCommand
-InputFormat
-NoLogo
2c
ADSL
Avigilon
Expand All @@ -60,7 +64,9 @@ SSH
Sansymphony
SureBackup
TendMicro
omercier marked this conversation as resolved.
Show resolved Hide resolved
TrendMicro
VDSL2
VM
Veeam
WSMAN
XPath
Expand All @@ -86,6 +92,7 @@ out-mcast
out-ucast
perfdata
powershell
powershell.exe
proto
psu
queue-messages-inflighted
Expand Down
Loading
Loading