Skip to content

Commit

Permalink
fix(counter): replaced the unit of the latencies ms --> µs
Browse files Browse the repository at this point in the history
- refactored the help
- removed unimplemented option
- changed the latency unit from ms to µs

- fix spell
  • Loading branch information
omercier committed Sep 5, 2024
1 parent 519ccc3 commit 0d0bfa8
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 48 deletions.
99 changes: 79 additions & 20 deletions src/apps/vmware/connector/mode/vsanclusterusage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
}
}
Expand All @@ -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' }
});

Expand All @@ -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;
Expand All @@ -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
Expand Down
57 changes: 29 additions & 28 deletions tests/resources/spellcheck/stopwords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
--add-sysdesc
--api-filter-orgs
--api-password
--api-password
--api-path
--api-token
--api-username
--api-version
--cacert-file
--cert-pkcs12
--cert-pwd
--critical-backend-congestions
--critical-backend-outstanding-io
--critical-bytesallocatedpercentage
--dfsr
--display-transform-dst
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -103,34 +93,43 @@ 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
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
Expand All @@ -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
Expand All @@ -160,7 +167,6 @@ queue-messages-inflighted
sfp.temperature
space-usage-prct
teampass
Teldat
timeframe
topic-messages-inflighted
total-offline-prct
Expand All @@ -173,9 +179,4 @@ usage-prct
userpass
v1
v2
VDSL2
Veeam
VeloCloud
VMware
WSMAN
Kubernetes
vSAN

0 comments on commit 0d0bfa8

Please sign in to comment.