Skip to content

Commit a1f265a

Browse files
committed
fix(counter): replaced the unit of the latencies ms --> µs
- refactored the help - removed unimplemented option - changed the latency unit from ms to µs
1 parent 519ccc3 commit a1f265a

File tree

2 files changed

+84
-20
lines changed

2 files changed

+84
-20
lines changed

src/apps/vmware/connector/mode/vsanclusterusage.pm

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ sub set_counters {
8383
]
8484
}
8585
},
86-
{ label => 'backend-latency-read', nlabel => 'cluster.vsan.backend.latency.read.milliseconds', display_ok => 0, set => {
86+
{ label => 'backend-latency-read', nlabel => 'cluster.vsan.backend.latency.read.microseconds', display_ok => 0, set => {
8787
key_values => [ { name => 'latencyAvgRead' } ],
88-
output_template => 'read latency: %s ms',
88+
output_template => 'read latency: %s µs',
8989
perfdatas => [
90-
{ template => '%s', unit => 'ms', min => 0 }
90+
{ template => '%s', unit => 'µs', min => 0 }
9191
]
9292
}
9393
},
94-
{ label => 'backend-latency-write', nlabel => 'cluster.vsan.backend.latency.write.milliseconds', display_ok => 0, set => {
94+
{ label => 'backend-latency-write', nlabel => 'cluster.vsan.backend.latency.write.microseconds', display_ok => 0, set => {
9595
key_values => [ { name => 'latencyAvgWrite' } ],
96-
output_template => 'write latency: %s ms',
96+
output_template => 'write latency: %s µs',
9797
perfdatas => [
98-
{ template => '%s', unit => 'ms', min => 0 }
98+
{ template => '%s', unit => 'µs', min => 0 }
9999
]
100100
}
101101
}
@@ -115,7 +115,6 @@ sub new {
115115

116116
$options{options}->add_options(arguments => {
117117
'cluster-name:s' => { name => 'cluster_name' },
118-
'filter' => { name => 'filter' },
119118
'scope-datacenter:s' => { name => 'scope_datacenter' }
120119
});
121120

@@ -133,11 +132,18 @@ sub manage_selection {
133132

134133
foreach my $cluster_id (keys %{$response->{data}}) {
135134
my $cluster_name = $response->{data}->{$cluster_id}->{name};
135+
next if ( !centreon::plugins::misc::is_empty($self->{option_results}->{cluster_name})
136+
and $cluster_name !~ /$self->{option_results}->{cluster_name}/ );
137+
136138
$self->{cluster}->{$cluster_name} = {
137139
display => $cluster_name,
138140
%{$response->{data}->{$cluster_id}->{cluster_domcompmgr}},
139141
};
140-
}
142+
}
143+
if ( scalar(keys(%{$self->{cluster}}) ) == 0) {
144+
my $explanation = centreon::plugins::misc::is_empty($self->{option_results}->{cluster_name}) ? '' : ' matching /' . $self->{option_results}->{cluster_name} . '/';
145+
$self->{output}->output_add(severity => 'UNKNOWN', short_msg => "No clusters found" . $explanation);
146+
}
141147
}
142148

143149
1;
@@ -146,30 +152,83 @@ __END__
146152
147153
=head1 MODE
148154
149-
Check Vsan cluster usage
155+
Check VMware vSAN cluster usage.
150156
151157
=over 8
152158
153159
=item B<--cluster-name>
154160
155-
cluster to check.
156-
If not set, we check all clusters.
161+
Define which clusters should be monitored based on their name.
162+
This option will be treated as a regular expression.
157163
158-
=item B<--filter>
164+
=item B<--scope-datacenter>
159165
160-
Cluster name is a regexp.
166+
Define which clusters to monitor based on their datacenter's name.
167+
This option will be treated as a regular expression.
161168
162-
=item B<--scope-datacenter>
169+
=item B<--warning-backend-write-usage>
170+
171+
Thresholds.
172+
173+
=item B<--critical-backend-write-usage>
174+
175+
Thresholds.
176+
177+
=item B<--warning-backend-read-usage>
178+
179+
Thresholds.
180+
181+
=item B<--critical-backend-read-usage>
182+
183+
Thresholds.
184+
185+
=item B<--warning-backend-outstanding-io>
186+
187+
Thresholds.
188+
189+
=item B<--critical-backend-outstanding-io>
190+
191+
Thresholds.
192+
193+
=item B<--warning-backend-congestions>
163194
164-
Search in following datacenter(s) (can be a regexp).
195+
Thresholds.
196+
197+
=item B<--critical-backend-congestions>
198+
199+
Thresholds.
165200
166-
=item B<--warning-*> B<--critical-*>
201+
=item B<--warning-backend-throughput-read>
167202
168203
Thresholds.
169-
Can be: 'backend-write-usage', 'backend-read-usage',
170-
'backend-outstanding-io', 'backend-congestions',
171-
'backend-throughput-read', 'backend-throughput-write'
172-
.
204+
205+
=item B<--critical-backend-throughput-read>
206+
207+
Thresholds.
208+
209+
=item B<--warning-backend-throughput-write>
210+
211+
Thresholds.
212+
213+
=item B<--critical-backend-throughput-write>
214+
215+
Thresholds.
216+
217+
=item B<--warning-backend-latency-read>
218+
219+
Thresholds in microseconds.
220+
221+
=item B<--critical-backend-latency-read>
222+
223+
Thresholds in microseconds.
224+
225+
=item B<--warning-backend-latency-write>
226+
227+
Thresholds in microseconds.
228+
229+
=item B<--critical-backend-latency-write>
230+
231+
Thresholds in microseconds.
173232
174233
=back
175234

tests/resources/spellcheck/stopwords.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
--cacert-file
1111
--cert-pkcs12
1212
--cert-pwd
13+
--critical-backend-congestions
14+
--critical-backend-outstanding-io
1315
--critical-bytesallocatedpercentage
1416
--dfsr
1517
--display-transform-dst
@@ -49,6 +51,8 @@
4951
--sql-errors-exit
5052
--urlpath
5153
--use-ucd
54+
--warning-backend-congestions
55+
--warning-backend-outstanding-io
5256
--warning-bytesallocatedpercentage
5357
-EncodedCommand
5458
-InputFormat
@@ -118,6 +122,7 @@ VDSL2
118122
VM
119123
VPN
120124
Veeam
125+
vSAN
121126
WSMAN
122127
XPath
123128
allCapacity

0 commit comments

Comments
 (0)