From 0d0bfa89ea8bb249c9a5456ad181a6bfa0580923 Mon Sep 17 00:00:00 2001 From: omercier Date: Mon, 12 Aug 2024 12:04:31 +0200 Subject: [PATCH] =?UTF-8?q?fix(counter):=20replaced=20the=20unit=20of=20th?= =?UTF-8?q?e=20latencies=20ms=20-->=20=C2=B5s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - refactored the help - removed unimplemented option - changed the latency unit from ms to µs - fix spell --- .../vmware/connector/mode/vsanclusterusage.pm | 99 +++++++++++++++---- tests/resources/spellcheck/stopwords.txt | 57 +++++------ 2 files changed, 108 insertions(+), 48 deletions(-) diff --git a/src/apps/vmware/connector/mode/vsanclusterusage.pm b/src/apps/vmware/connector/mode/vsanclusterusage.pm index 16d622863f..49edcf37d9 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. +Define which clusters should be monitored based on their name. +This option will be treated as a regular expression. -=item B<--filter> +=item B<--scope-datacenter> -Cluster name is 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<--scope-datacenter> +=item B<--warning-backend-write-usage> + +Thresholds. + +=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> -Search in following datacenter(s) (can be a regexp). +Thresholds. + +=item B<--critical-backend-congestions> + +Thresholds. -=item B<--warning-*> B<--critical-*> +=item B<--warning-backend-throughput-read> Thresholds. -Can be: 'backend-write-usage', 'backend-read-usage', -'backend-outstanding-io', 'backend-congestions', -'backend-throughput-read', 'backend-throughput-write' -. + +=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 d3e7205b11..510f7d13bb 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 --dfsr --display-transform-dst @@ -46,9 +47,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 -EncodedCommand -InputFormat @@ -61,38 +65,24 @@ Alcatel Ansible Avigilon 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 @@ -103,21 +93,24 @@ OID PKCS1 Primera QoS -RestAPI RRDCached -Sansymphony +RestAPI SNMP SSDCapacity SSH +Sansymphony SureBackup SysVol TCP +Teldat TrendMicro UCD VDSL2 VM +VMware VPN Veeam +VeloCloud WSMAN XPath allCapacity @@ -125,12 +118,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 @@ -141,9 +140,17 @@ in-ucast interface-dsl-name jobqueue jobqueues +kccevent keepass ldap license-instances-usage-prct +machineaccount +module-cellradio-csq +module-cellradio-rscp +module-cellradio-rsrp +module-cellradio-rsrq +module-cellradio-snr +modules-cellradio-detected okta oneaccess-sys-mib out-bcast @@ -160,7 +167,6 @@ queue-messages-inflighted sfp.temperature space-usage-prct teampass -Teldat timeframe topic-messages-inflighted total-offline-prct @@ -173,9 +179,4 @@ usage-prct userpass v1 v2 -VDSL2 -Veeam -VeloCloud -VMware -WSMAN -Kubernetes \ No newline at end of file +vSAN