enh(3cx) Add a global counter (#2201)

This commit is contained in:
UrBnW 2020-09-08 11:32:32 +02:00 committed by GitHub
parent 85ad90b734
commit f727a05aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -53,9 +53,21 @@ sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'extension', type => 1, cb_prefix_output => 'prefix_service_output', message_multiple => 'All extensions are ok' }
];
$self->{maps_counters}->{global} = [
{ label => 'count', nlabel => '3cx.extensions.count', display_ok => 0, set => {
key_values => [ { name => 'count' } ],
output_template => 'Extensions count : %d',
perfdatas => [
{ template => '%d', min => 0 }
]
}
}
];
$self->{maps_counters}->{extension} = [
{ label => 'status', type => 2, set => {
key_values => [
@ -118,6 +130,8 @@ sub manage_selection {
next;
}
$self->{global}->{count}++;
$self->{extension}->{$item->{_str}} = {
extension => $item->{_str},
registered => $item->{IsRegistered} ? 'true' : 'false',
@ -163,6 +177,10 @@ Can used special variables like: %{extension}, %{registered}, %{dnd}, %{profile}
Set critical threshold for status.
Can used special variables like: %{extension}, %{registered}, %{dnd}, %{profile}, %{status}, %{duration}
=item B<--warning-*> B<--critical-*>
Thresholds (Can be: 'count').
=back
=cut