From 95bff5ff6b1593f5a53f597872bc942b14d12ce6 Mon Sep 17 00:00:00 2001 From: omercier <32134301+omercier@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:58:19 +0200 Subject: [PATCH] fix(counter): replaced the unit of the latency for vmware vsan-cluster-usage + other small changes (#5139) REFS: CTOR-760 --- .../vmware/connector/mode/vsanclusterusage.pm | 101 ++++++++++++++---- tests/resources/spellcheck/stopwords.txt | 53 +++++---- 2 files changed, 110 insertions(+), 44 deletions(-) diff --git a/src/apps/vmware/connector/mode/vsanclusterusage.pm b/src/apps/vmware/connector/mode/vsanclusterusage.pm index 16d622863..49edcf37d 100644 --- a/src/apps/vmware/connector/mode/vsanclusterusage.pm +++ b/src/apps/vmware/connector/mode/vsanclusterusage.pm @@ -83,19 +83,19 @@ sub set_counters { ] } }, - { label => 'backend-latency-read', nlabel => 'cluster.vsan.backend.latency.read.milliseconds', display_ok => 0, set => { + { label => 'backend-latency-read', nlabel => 'cluster.vsan.backend.latency.read.microseconds', display_ok => 0, set => { key_values => [ { name => 'latencyAvgRead' } ], - output_template => 'read latency: %s ms', + output_template => 'read latency: %s µs', perfdatas => [ - { template => '%s', unit => 'ms', min => 0 } + { template => '%s', unit => 'µs', min => 0 } ] } }, - { label => 'backend-latency-write', nlabel => 'cluster.vsan.backend.latency.write.milliseconds', display_ok => 0, set => { + { label => 'backend-latency-write', nlabel => 'cluster.vsan.backend.latency.write.microseconds', display_ok => 0, set => { key_values => [ { name => 'latencyAvgWrite' } ], - output_template => 'write latency: %s ms', + output_template => 'write latency: %s µs', perfdatas => [ - { template => '%s', unit => 'ms', min => 0 } + { template => '%s', unit => 'µs', min => 0 } ] } } @@ -115,7 +115,6 @@ sub new { $options{options}->add_options(arguments => { 'cluster-name:s' => { name => 'cluster_name' }, - 'filter' => { name => 'filter' }, 'scope-datacenter:s' => { name => 'scope_datacenter' } }); @@ -133,11 +132,18 @@ sub manage_selection { foreach my $cluster_id (keys %{$response->{data}}) { my $cluster_name = $response->{data}->{$cluster_id}->{name}; + next if ( !centreon::plugins::misc::is_empty($self->{option_results}->{cluster_name}) + and $cluster_name !~ /$self->{option_results}->{cluster_name}/ ); + $self->{cluster}->{$cluster_name} = { display => $cluster_name, %{$response->{data}->{$cluster_id}->{cluster_domcompmgr}}, }; - } + } + if ( scalar(keys(%{$self->{cluster}}) ) == 0) { + my $explanation = centreon::plugins::misc::is_empty($self->{option_results}->{cluster_name}) ? '' : ' matching /' . $self->{option_results}->{cluster_name} . '/'; + $self->{output}->output_add(severity => 'UNKNOWN', short_msg => "No clusters found" . $explanation); + } } 1; @@ -146,30 +152,83 @@ __END__ =head1 MODE -Check Vsan cluster usage +Check VMware vSAN cluster usage. =over 8 =item B<--cluster-name> -cluster to check. -If not set, we check all clusters. - -=item B<--filter> - -Cluster name is a regexp. +Define which clusters should be monitored based on their name. +This option will be treated as a regular expression. =item B<--scope-datacenter> -Search in following datacenter(s) (can be a regexp). +Define which clusters to monitor based on their data center's name. +This option will be treated as a regular expression. -=item B<--warning-*> B<--critical-*> +=item B<--warning-backend-write-usage> Thresholds. -Can be: 'backend-write-usage', 'backend-read-usage', -'backend-outstanding-io', 'backend-congestions', -'backend-throughput-read', 'backend-throughput-write' -. + +=item B<--critical-backend-write-usage> + +Thresholds. + +=item B<--warning-backend-read-usage> + +Thresholds. + +=item B<--critical-backend-read-usage> + +Thresholds. + +=item B<--warning-backend-outstanding-io> + +Thresholds. + +=item B<--critical-backend-outstanding-io> + +Thresholds. + +=item B<--warning-backend-congestions> + +Thresholds. + +=item B<--critical-backend-congestions> + +Thresholds. + +=item B<--warning-backend-throughput-read> + +Thresholds. + +=item B<--critical-backend-throughput-read> + +Thresholds. + +=item B<--warning-backend-throughput-write> + +Thresholds. + +=item B<--critical-backend-throughput-write> + +Thresholds. + +=item B<--warning-backend-latency-read> + +Thresholds in microseconds. + +=item B<--critical-backend-latency-read> + +Thresholds in microseconds. + +=item B<--warning-backend-latency-write> + +Thresholds in microseconds. + +=item B<--critical-backend-latency-write> + +Thresholds in microseconds. =back diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index 9bdc043ba..c50fe041f 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -2,7 +2,6 @@ --add-sysdesc --api-filter-orgs --api-password ---api-password --api-path --api-token --api-username @@ -10,6 +9,8 @@ --cacert-file --cert-pkcs12 --cert-pwd +--critical-backend-congestions +--critical-backend-outstanding-io --critical-bytesallocatedpercentage --critical-na --dfsr @@ -48,9 +49,12 @@ --oid-display --oid-extra-display --oid-filter +--scope-datacenter --sql-errors-exit --urlpath --use-ucd +--warning-backend-congestions +--warning-backend-outstanding-io --warning-bytesallocatedpercentage --warning-na -EncodedCommand @@ -65,38 +69,24 @@ Ansible Avigilon Backbox Centreon -cpu-utilization-1m -cpu-utilization-5m -cpu-utilization-5s -Datacore DC4 -dcdiag -dfsrevent +Datacore FCCapacity Fortigate Fortinet -frsevent HPE HashiCorp -ISAM IMEI -IpAddr ISAM +IpAddr Iwsva JOBQ -kccevent +Kubernetes Loggly MBean MIB MQTT -machineaccount Meraki -module-cellradio-rscp -module-cellradio-csq -module-cellradio-rsrp -module-cellradio-rsrq -module-cellradio-snr -modules-cellradio-detected Mosquitto NLCapacity NTLMv2 @@ -110,19 +100,23 @@ QoS RestAPI RFC1628 RRDCached -Sansymphony +RestAPI SNMP SSDCapacity SSH +Sansymphony SureBackup SysVol TCP +Teldat TrendMicro UCD VDSL2 VM +VMware VPN Veeam +VeloCloud WSMAN XPath allCapacity @@ -130,12 +124,18 @@ api.meraki.com cardtemperature connections-dhcp connections-dns -deduplication +cpu-utilization-1m +cpu-utilization-5m +cpu-utilization-5s datasource +dcdiag +deduplication deltaps df +dfsrevent eth fanspeed +frsevent hashicorpvault ifAlias ifDesc @@ -148,10 +148,18 @@ ipv4 ipv6 jobqueue jobqueues +kccevent keepass Kubernetes ldap license-instances-usage-prct +machineaccount +module-cellradio-csq +module-cellradio-rscp +module-cellradio-rsrp +module-cellradio-rsrq +module-cellradio-snr +modules-cellradio-detected multiple NTP nagios @@ -171,7 +179,6 @@ queue-messages-inflighted sfp.temperature space-usage-prct teampass -Teldat timeframe topic-messages-inflighted total-offline-prct @@ -189,5 +196,5 @@ VDSL2 Veeam VeloCloud VMware -WSMAN - +vSAN +WSMAN \ No newline at end of file