From f727a05aa6b4bf9b6bfcd2b351ba628678176764 Mon Sep 17 00:00:00 2001 From: UrBnW <40244829+UrBnW@users.noreply.github.com> Date: Tue, 8 Sep 2020 11:32:32 +0200 Subject: [PATCH] enh(3cx) Add a global counter (#2201) --- apps/voip/3cx/restapi/mode/extension.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/voip/3cx/restapi/mode/extension.pm b/apps/voip/3cx/restapi/mode/extension.pm index 9699ef07d..319281a0c 100644 --- a/apps/voip/3cx/restapi/mode/extension.pm +++ b/apps/voip/3cx/restapi/mode/extension.pm @@ -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