add(plugin): Azure Application Insights (#2762)
This commit is contained in:
parent
9125d889e4
commit
3ea61efaad
|
@ -0,0 +1,159 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::availability;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'availabilityresults/availabilitypercentage' => {
|
||||
'output' => 'Availability',
|
||||
'label' => 'availability',
|
||||
'nlabel' => 'appinsights.availability.percentage',
|
||||
'unit' => '%',
|
||||
'min' => '0',
|
||||
'max' => '100'
|
||||
},
|
||||
'availabilityresults/count' => {
|
||||
'output' => 'Availability tests',
|
||||
'label' => 'tests-count',
|
||||
'nlabel' => 'appinsights.availability.tests.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'availabilityresults/duration' => {
|
||||
'output' => 'Availability test duration',
|
||||
'label' => 'tests-duration',
|
||||
'nlabel' => 'appinsights.availability.tests.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights availability status.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=availability --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-availability='80:' --critical-availability='90:'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=availability --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='average' --warning-availability='80:' --critical-availability='90:'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'availability', 'tests-count', 'tests-duration'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'availability', 'tests-count', 'tests-duration'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,177 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::browsertimings;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'browsertimings/networkduration' => {
|
||||
'output' => 'Page load network connect time',
|
||||
'label' => 'network-duration',
|
||||
'nlabel' => 'appinsights.processing.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'browsertimings/processingduration' => {
|
||||
'output' => 'Client processing time',
|
||||
'label' => 'processing-duration',
|
||||
'nlabel' => 'appinsights.processing.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'browsertimings/receiveduration' => {
|
||||
'output' => 'Receiving response time',
|
||||
'label' => 'receive-duration',
|
||||
'nlabel' => 'appinsights.receive.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'browsertimings/sendduration' => {
|
||||
'output' => 'Send request time',
|
||||
'label' => 'send-duration',
|
||||
'nlabel' => 'appinsights.send.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'browsertimings/totalduration' => {
|
||||
'output' => 'Browser page load time',
|
||||
'label' => 'total-duration',
|
||||
'nlabel' => 'appinsights.total.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights browser timings.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=browser-timings --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-total-duration='1' --critical-total-duration='2'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=browser-timings --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='average' --warning-total-duration='1' --critical-total-duration='2'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'network-duration', 'processing-duration', 'receive-duration', 'send-duration',
|
||||
'total-duration'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'network-duration', 'processing-duration', 'receive-duration', 'send-duration',
|
||||
'total-duration'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,151 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::cpu;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'performancecounters/processcpupercentage' => {
|
||||
'output' => 'Process CPU',
|
||||
'label' => 'w3wp-utilization-percentage',
|
||||
'nlabel' => 'appinsights.cpu.w3wp.utilization.percentage',
|
||||
'unit' => '%',
|
||||
'min' => '0',
|
||||
'max' => '100'
|
||||
},
|
||||
'performancecounters/processorcpupercentage' => {
|
||||
'output' => 'Processor time',
|
||||
'label' => 'nonidle-time-percentage',
|
||||
'nlabel' => 'appinsights.cpu.nonidle.time.percentage',
|
||||
'unit' => '%',
|
||||
'min' => '0',
|
||||
'max' => '100'
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights CPU utilization.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=cpu --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-nonidle-time-percentage='80' --critical-process='90'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=cpu --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='average' --warning-nonidle-time-percentage='80' --critical-process='90'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'w3wp-utilization-percentage', 'nonidle-time-percentage'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'w3wp-utilization-percentage', 'nonidle-time-percentage'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::discovery;
|
||||
|
||||
use base qw(cloud::azure::management::monitor::mode::discovery);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{namespace} = 'Microsoft.Insights';
|
||||
$self->{type} = 'Components';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Discover Azure Network Application Gateway resources.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Specify resource group.
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Specify location.
|
||||
|
||||
=item B<--prettify>
|
||||
|
||||
Prettify JSON output.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,159 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::exceptions;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'exceptions/browser' => {
|
||||
'output' => 'Browser exceptions',
|
||||
'label' => 'browser-exceptions-count',
|
||||
'nlabel' => 'appinsights.exceptions.browser.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'exceptions/count' => {
|
||||
'output' => 'Exceptions',
|
||||
'label' => 'total-exeptions-count',
|
||||
'nlabel' => 'appinsights.exceptions.total.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'exceptions/server' => {
|
||||
'output' => 'Server exceptions',
|
||||
'label' => 'server-exceptions-count',
|
||||
'nlabel' => 'appinsights.exceptions.server.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights uncaught exceptions.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=exceptions --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-total-exeptions-count='800' --critical-total-exeptions-count='900'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=exceptions --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='total' --warning-total-exeptions-count='800' --critical-total-exeptions-count='900'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'browser-exceptions-count', 'total-exeptions-count', 'server-exceptions-count'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'browser-exceptions-count', 'total-exeptions-count', 'server-exceptions-count'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,159 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::externalcalls;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'dependencies/count' => {
|
||||
'output' => 'Dependency calls',
|
||||
'label' => 'calls-count',
|
||||
'nlabel' => 'appinsights.calls.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'dependencies/duration' => {
|
||||
'output' => 'Dependency duration',
|
||||
'label' => 'calls-duration',
|
||||
'nlabel' => 'appinsights.calls.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'dependencies/failed' => {
|
||||
'output' => 'Dependency call failures',
|
||||
'label' => 'calls-failure',
|
||||
'nlabel' => 'appinsights.calls.failure.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights calls made by the application to external resources.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=externalcalls --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-calls-count='800' --critical-calls-count='900'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=externalcalls --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='total' --warning-calls-count='800' --critical-calls-count='900'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'calls-count', 'calls-duration', 'calls-failure'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'calls-count', 'calls-duration', 'calls-failure'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,141 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::iooperations;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'performancecounters/processiobytespersecond' => {
|
||||
'output' => 'Process IO rate',
|
||||
'label' => 'process-bytes-operations',
|
||||
'nlabel' => 'appinsights.process.bytes.operations.bytesperseconds',
|
||||
'unit' => 'B/s',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights io-operations status.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=io-operations --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-process-bytes-operations='8000' --critical-process-bytes-operations='9000'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=io-operations --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='average' --warning-process-bytes-operations='8000' --critical-process-bytes-operations='9000'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-process-bytes-operations>
|
||||
|
||||
Bytes operations per second warning threshold.
|
||||
|
||||
=item B<--critical-process-bytes-operations>
|
||||
|
||||
Bytes operations per second critical threshold.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,151 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::memory;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'performancecounters/memoryavailablebytes' => {
|
||||
'output' => 'Available memory',
|
||||
'label' => 'memory-available',
|
||||
'nlabel' => 'appinsights.memory.available.bytes',
|
||||
'unit' => 'B',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'performancecounters/processprivatebytes' => {
|
||||
'output' => 'Process private bytes',
|
||||
'label' => 'memory-private',
|
||||
'nlabel' => 'appinsights.memory.private.bytes',
|
||||
'unit' => 'B',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Average'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights memory usage.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=memory --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='average'
|
||||
--warning-memory-available='8000' --critical-memory-available='900'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=memory --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='average' --warning-memory-available='8000' --critical-memory-available='900'
|
||||
|
||||
Default aggregation: 'average' / 'total', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'memory-available', 'memory-private'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'memory-available', 'memory-private'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,151 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::pageviews;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'pageviews/count' => {
|
||||
'output' => 'Page views',
|
||||
'label' => 'views-count',
|
||||
'nlabel' => 'appinsights.pageviews.total.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'pageviews/duration' => {
|
||||
'output' => 'Page view load time',
|
||||
'label' => 'load-time',
|
||||
'nlabel' => 'appinsights.pageviews.load.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights page views statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=pageviews --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-views-count='800' --critical-views-count='900'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=pageviews --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='total' --warning-views-count='800' --critical-views-count='900'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'views-count', 'load-time'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'views-count', 'load-time'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,193 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::mode::requests;
|
||||
|
||||
use base qw(cloud::azure::custom::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub get_metrics_mapping {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $metrics_mapping = {
|
||||
'requests/count' => {
|
||||
'output' => 'Server requests',
|
||||
'label' => 'requests-count',
|
||||
'nlabel' => 'appinsights.requests.total.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'requests/duration' => {
|
||||
'output' => 'Server response time',
|
||||
'label' => 'requests-duration',
|
||||
'nlabel' => 'appinsights.requests.duration.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'requests/failed' => {
|
||||
'output' => 'Failed requests',
|
||||
'label' => 'requests-failed',
|
||||
'nlabel' => 'appinsights.requests.failed.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'requests/rate' => {
|
||||
'output' => 'Server request rate',
|
||||
'label' => 'requests-rate',
|
||||
'nlabel' => 'appinsights.requests.perseconds',
|
||||
'unit' => 'requests/s',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'performancecounters/requestexecutiontime' => {
|
||||
'output' => 'HTTP request execution time',
|
||||
'label' => 'requests-execution-time',
|
||||
'nlabel' => 'appinsights.requests.execution.time.milliseconds',
|
||||
'unit' => 'ms',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'performancecounters/requestsinqueue' => {
|
||||
'output' => 'HTTP requests in application queue',
|
||||
'label' => 'requests-queued',
|
||||
'nlabel' => 'appinsights.requests.failed.count',
|
||||
'unit' => '',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
},
|
||||
'performancecounters/requestspersecond' => {
|
||||
'output' => 'HTTP request rate',
|
||||
'label' => 'requests-http-rate',
|
||||
'nlabel' => 'appinsights.requests.http.perseconds',
|
||||
'unit' => 'requests/s',
|
||||
'min' => '0',
|
||||
'max' => ''
|
||||
}
|
||||
};
|
||||
|
||||
return $metrics_mapping;
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'resource:s' => { name => 'resource' },
|
||||
'resource-group:s' => { name => 'resource_group' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource}) || $self->{option_results}->{resource} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify either --resource <name> with --resource-group option or --resource <id>.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.Insights\/components\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
||||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'Components';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Insights';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT5M';
|
||||
$self->{az_aggregations} = ['Total'];
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
$self->{az_aggregations} = [];
|
||||
foreach my $stat (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($stat ne '') {
|
||||
push @{$self->{az_aggregations}}, ucfirst(lc($stat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $metric (keys %{$self->{metrics_mapping}}) {
|
||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||
push @{$self->{az_metrics}}, $metric;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Azure Application Insights HTTP request statistics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::applicationinsights::plugin --mode=http-requests --custommode=api
|
||||
--resource=<component_id> --resource-group=<resourcegroup_id> --aggregation='total'
|
||||
--warning-requests-count='800' --critical-requests-count='900'
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::integration::servicebus::plugin --mode=http-requests --custommode=api
|
||||
--resource='/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.Insights/Components/<component_id>'
|
||||
--aggregation='total' --warning-requests-count='800' --critical-requests-count='900'
|
||||
|
||||
Default aggregation: 'total' / 'average', 'minimum' and 'maximum' are valid.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource>
|
||||
|
||||
Set resource name or id (Required).
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Warning threshold where '*' can be:
|
||||
'requests-count', 'requests-duration', 'requests-failed', 'requests-rate',
|
||||
'requests-execution-time', 'requests-queued', 'requests-http-rate'.
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Critical threshold where '*' can be:
|
||||
'requests-count', 'requests-duration', 'requests-failed', 'requests-rate',
|
||||
'requests-execution-time', 'requests-queued', 'requests-http-rate'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::management::applicationinsights::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
$self->{modes} = {
|
||||
'availability' => 'cloud::azure::management::applicationinsights::mode::availability',
|
||||
'browser-timings' => 'cloud::azure::management::applicationinsights::mode::browsertimings',
|
||||
'cpu' => 'cloud::azure::management::applicationinsights::mode::cpu',
|
||||
'discovery' => 'cloud::azure::management::applicationinsights::mode::discovery',
|
||||
'exceptions' => 'cloud::azure::management::applicationinsights::mode::exceptions',
|
||||
'external-calls' => 'cloud::azure::management::applicationinsights::mode::externalcalls',
|
||||
'io-operations' => 'cloud::azure::management::applicationinsights::mode::iooperations',
|
||||
'health' => 'cloud::azure::management::applicationinsights::mode::health',
|
||||
'memory' => 'cloud::azure::management::applicationinsights::mode::memory',
|
||||
'page-views' => 'cloud::azure::management::applicationinsights::mode::pageviews',
|
||||
'requests' => 'cloud::azure::management::applicationinsights::mode::requests',
|
||||
};
|
||||
|
||||
$self->{custom_modes}->{azcli} = 'cloud::azure::custom::azcli';
|
||||
$self->{custom_modes}->{api} = 'cloud::azure::custom::api';
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{options}->add_options(arguments => {
|
||||
'api-version:s' => { name => 'api_version', default => '2018-01-01' },
|
||||
});
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure Application Insights resources.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue