From b1c870c0e847d6be14abddeddcead0c8e2994b39 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 19 Apr 2023 13:48:57 +0200 Subject: [PATCH] (plugin) cloud::azure::database::postgres - new (#4365) --- .../deb.json | 5 + .../pkg.json | 10 + .../rpm.json | 6 + .../database/postgres/mode/connections.pm | 175 +++++++++++++++++ src/cloud/azure/database/postgres/mode/cpu.pm | 154 +++++++++++++++ .../azure/database/postgres/mode/discovery.pm | 145 ++++++++++++++ .../database/postgres/mode/ioconsumption.pm | 154 +++++++++++++++ .../azure/database/postgres/mode/memory.pm | 154 +++++++++++++++ .../database/postgres/mode/replication.pm | 160 ++++++++++++++++ .../azure/database/postgres/mode/storage.pm | 181 ++++++++++++++++++ .../azure/database/postgres/mode/traffic.pm | 156 +++++++++++++++ src/cloud/azure/database/postgres/plugin.pm | 66 +++++++ 12 files changed, 1366 insertions(+) create mode 100644 packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/deb.json create mode 100644 packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/pkg.json create mode 100644 packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/rpm.json create mode 100644 src/cloud/azure/database/postgres/mode/connections.pm create mode 100644 src/cloud/azure/database/postgres/mode/cpu.pm create mode 100644 src/cloud/azure/database/postgres/mode/discovery.pm create mode 100644 src/cloud/azure/database/postgres/mode/ioconsumption.pm create mode 100644 src/cloud/azure/database/postgres/mode/memory.pm create mode 100644 src/cloud/azure/database/postgres/mode/replication.pm create mode 100644 src/cloud/azure/database/postgres/mode/storage.pm create mode 100644 src/cloud/azure/database/postgres/mode/traffic.pm create mode 100644 src/cloud/azure/database/postgres/plugin.pm diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/deb.json b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/deb.json new file mode 100644 index 000000000..8133a85e5 --- /dev/null +++ b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libdatetime-perl" + ] +} diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/pkg.json b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/pkg.json new file mode 100644 index 000000000..499323977 --- /dev/null +++ b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/pkg.json @@ -0,0 +1,10 @@ +{ + "pkg_name": "centreon-plugin-Cloud-Azure-Database-Postgres-Api", + "pkg_summary": "Centreon Plugin to monitor Microsoft Azure Database for Postgres service using CLI or RestAPI", + "plugin_name": "centreon_azure_database_postgres_api.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "cloud/azure/custom/", + "cloud/azure/database/postgres/" + ] +} diff --git a/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/rpm.json b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/rpm.json new file mode 100644 index 000000000..4db4877ce --- /dev/null +++ b/packaging/centreon-plugin-Cloud-Azure-Database-Postgres-Api/rpm.json @@ -0,0 +1,6 @@ +{ + "dependencies": [ + "perl(DateTime)", + "perl(Digest::SHA)" + ] +} diff --git a/src/cloud/azure/database/postgres/mode/connections.pm b/src/cloud/azure/database/postgres/mode/connections.pm new file mode 100644 index 000000000..8ddd116d6 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/connections.pm @@ -0,0 +1,175 @@ +# +# Copyright 2022 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::database::postgres::mode::connections; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'active_connections' => { + 'output' => 'Active Connections', + 'label' => 'connections-active', + 'nlabel' => 'azpostgres.connections.active.count', + 'unit' => '', + 'min' => '0' + }, + 'connections_failed' => { + 'output' => 'Failed Connections', + 'label' => 'connections-failed', + 'nlabel' => 'azpostgres.connections.failed.count', + 'unit' => '', + 'min' => '0' + }, + 'aborted_connections' => { + 'output' => 'Aborted Connections', + 'label' => 'connections-aborted', + 'nlabel' => 'azpostgres.connections.aborted.count', + 'unit' => '', + 'min' => '0' + } + }; + + 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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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)); + } + } + } + + my $resource_mapping = { + 'servers' => [ 'active_connections', 'connections_failed' ], + 'flexibleServers' => [ 'active_connections', 'connections_failed' ] + }; + + my $metrics_mapping_transformed; + foreach my $metric_type (@{$resource_mapping->{$resource_type}}) { + $metrics_mapping_transformed->{$metric_type} = $self->{metrics_mapping}->{$metric_type}; + } + + foreach my $metric (keys %{$metrics_mapping_transformed}) { + 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 Database for PostgreSQL connections status. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=connections --custommode=api +--resource= --resource-group= --aggregation='total' +--warning-connections-active='1000' --critical-connections-active='2000' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=connections --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='total' --warning-connections-active='1000' --critical-connections-active='2000' + +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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-*> B<--critical-*> + +Thresholds where '*' can be: +'connections-active', 'connections-failed', 'connections-aborted', +'connections-total'. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/cpu.pm b/src/cloud/azure/database/postgres/mode/cpu.pm new file mode 100644 index 000000000..8f379e453 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/cpu.pm @@ -0,0 +1,154 @@ +# +# Copyright 2022 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::database::postgres::mode::cpu; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'cpu_percent' => { + 'output' => 'CPU percent', + 'label' => 'cpu-usage', + 'nlabel' => 'azpostgresql.cpu.utilization.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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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 Database for PostgreSQL CPU usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=cpu --custommode=api +--resource= --resource-group= --aggregation='average' +--warning-cpu-usage='80' --critical-cpu-usage='90' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=cpu --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='average' --warning-cpu-usage='80' --critical-cpu-usage='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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-cpu-usage> + +Set warning threshold for CPU utilization percentage. + +=item B<--critical-cpu-usage> + +Set critical threshold for CPU utilization percentage. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/discovery.pm b/src/cloud/azure/database/postgres/mode/discovery.pm new file mode 100644 index 000000000..12848fab7 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/discovery.pm @@ -0,0 +1,145 @@ +# +# Copyright 2022 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::database::postgres::mode::discovery; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use JSON::XS; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => { + 'namespace:s' => { name => 'namespace' }, + 'type:s' => { name => 'type' }, + 'resource-group:s' => { name => 'resource_group' }, + 'location:s' => { name => 'location' }, + 'prettify' => { name => 'prettify' } + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + $self->{namespace} = $self->{option_results}->{namespace}; + $self->{type} = $self->{option_results}->{type}; + $self->{location} = $self->{option_results}->{location}; + $self->{resource_group} = $self->{option_results}->{resource_group}; +} + +sub run { + my ($self, %options) = @_; + + my @disco_data; + my $disco_stats; + + $disco_stats->{start_time} = time(); + + my $resources = $options{custom}->azure_list_resources( + namespace => $self->{namespace}, + resource_type => $self->{type}, + location => $self->{location}, + resource_group => $self->{resource_group} + ); + + $disco_stats->{end_time} = time(); + $disco_stats->{duration} = $disco_stats->{end_time} - $disco_stats->{start_time}; + + foreach my $resource (@{$resources}) { + next if ($resource->{type} !~ /Microsoft\.DBforPostgreSQL/); + $resource->{type} =~ s/Microsoft\.DBforPostgreSQL\///; + my $resource_group = ''; + $resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup})); + $resource_group = $1 if ($resource_group eq '' && defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/); + $resource->{resourceGroup} = $resource_group; + + foreach my $entry (keys %{$resource}) { + next if (ref($resource->{$entry}) ne "HASH"); + my @array; + foreach my $key (keys %{$resource->{$entry}}) { + push @array, { key => $key, value => $resource->{$entry}->{$key} }; + } + $resource->{$entry} = \@array; + } + + push @disco_data, $resource; + } + + $disco_stats->{discovered_items} = @disco_data; + $disco_stats->{results} = \@disco_data; + + my $encoded_data; + eval { + if (defined($self->{option_results}->{prettify})) { + $encoded_data = JSON::XS->new->utf8->pretty->encode($disco_stats); + } else { + $encoded_data = JSON::XS->new->utf8->encode($disco_stats); + } + }; + if ($@) { + $encoded_data = '{"code":"encode_error","message":"Cannot encode discovered data into JSON format"}'; + } + + $self->{output}->output_add(short_msg => $encoded_data); + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Resources discovery. + +=over 8 + +=item B<--namespace> + +Specify resources namespace. + +=item B<--type> + +Specify resources type. + +=item B<--resource-group> + +Specify resources resource group. + +=item B<--location> + +Specify resources location. + +=item B<--prettify> + +Prettify JSON output. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/ioconsumption.pm b/src/cloud/azure/database/postgres/mode/ioconsumption.pm new file mode 100644 index 000000000..3da78aa75 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/ioconsumption.pm @@ -0,0 +1,154 @@ +# +# Copyright 2022 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::database::postgres::mode::ioconsumption; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'disk_iops_consumed_percentage' => { + 'output' => 'IO Percent', + 'label' => 'ioconsumption-usage', + 'nlabel' => 'azpostgres.ioconsumption.usage.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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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} = ['Maximum']; + 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 Database for PostgreSQL IO comsuption usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=io-consumption --custommode=api +--resource= --resource-group= --aggregation='maximum' +--warning-ioconsumption-usage='80' --critical-ioconsumption-usage='90' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=io-consumption --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='maximum' --warning-ioconsumption-usage='80' --critical-ioconsumption-usage='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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-ioconsumption-usage> + +Set warning threshold for IO comsuption usage. + +=item B<--critical-ioconsumption-usage> + +Set critical threshold for IO comsuption usage. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/memory.pm b/src/cloud/azure/database/postgres/mode/memory.pm new file mode 100644 index 000000000..ce643bac5 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/memory.pm @@ -0,0 +1,154 @@ +# +# Copyright 2022 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::database::postgres::mode::memory; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'memory_percent' => { + 'output' => 'Memory percent', + 'label' => 'memory-usage', + 'nlabel' => 'azpostgres.memory.usage.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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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 Database for PostgreSQL memory usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=memory --custommode=api +--resource= --resource-group= --aggregation='average' +--warning-memory-usage='80' --critical-memory-usage='90' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=memory --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='average' --warning-memory-usage='80' --critical-memory-usage='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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-memory-usage> + +Set warning threshold for memory utilization percentage. + +=item B<--critical-memory-usage> + +Set critical threshold for memory utilization percentage. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/replication.pm b/src/cloud/azure/database/postgres/mode/replication.pm new file mode 100644 index 000000000..957deda82 --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/replication.pm @@ -0,0 +1,160 @@ +# +# Copyright 2022 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::database::postgres::mode::replication; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'physical_replication_delay_in_seconds' => { + 'output' => 'Replication Lag In Seconds', + 'label' => 'replication-lag', + 'nlabel' => 'azpostgres.replication.lag.seconds', + 'unit' => 's', + 'min' => '0' + } + }; + + 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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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} = ['Maximum']; + 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)); + } + } + } + + my $resource_mapping = { + 'servers' => [ 'physical_replication_delay_in_seconds' ], + 'flexibleServers' => [ 'physical_replication_delay_in_seconds' ] + }; + + my $metrics_mapping_transformed; + foreach my $metric_type (@{$resource_mapping->{$resource_type}}) { + $metrics_mapping_transformed->{$metric_type} = $self->{metrics_mapping}->{$metric_type}; + } + + foreach my $metric (keys %{$metrics_mapping_transformed}) { + 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 Database for PostgreSQL replication status. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=connections --custommode=api +--resource= --resource-group= --aggregation='maximum' +--warning-replication-lag='1000' --critical-replication-lag='2000' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=connections --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='maximum' --warning-replication-lag='1000' --critical-replication-lag='2000' + +Default aggregation: 'maximum' / 'average', 'minimum' and 'total' 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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-*> B<--critical-*> + +Thresholds where '*' can be: +'replication-lag'. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/storage.pm b/src/cloud/azure/database/postgres/mode/storage.pm new file mode 100644 index 000000000..b4668967b --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/storage.pm @@ -0,0 +1,181 @@ +# +# Copyright 2022 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::database::postgres::mode::storage; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'backup_storage_used' => { + 'output' => 'Backup Storage used', + 'label' => 'storage-backup', + 'nlabel' => 'azpostgres.storage.backup.usage.bytes', + 'unit' => 'B', + 'min' => '0' + }, + 'txlogs_storage_used' => { + 'output' => 'Server Log storage used', + 'label' => 'serverlog-usage', + 'nlabel' => 'azpostgres.storage.serverlog.usage.bytes', + 'unit' => 'B', + 'min' => '0' + }, + 'storage_percent' => { + 'output' => 'Storage Percent', + 'label' => 'storage-percent', + 'nlabel' => 'azpostgres.storage.usage.percentage', + 'unit' => '%', + 'min' => '0' + }, + 'storage_used' => { + 'output' => 'Storage Used', + 'label' => 'storage-used', + 'nlabel' => 'azpostgres.storage.usage.bytes', + 'unit' => 'B', + 'min' => '0' + } + }; + + 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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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} : 'PT15M'; + $self->{az_aggregations} = ['Maximum']; + 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)); + } + } + } + + my $resource_mapping = { + 'servers' => [ 'backup_storage_used', 'txlogs_storage_used', 'storage_percent', 'storage_used' ], + 'flexibleServers' => [ 'backup_storage_used', 'txlogs_storage_used', 'storage_percent', 'storage_used' ] + }; + + my $metrics_mapping_transformed; + foreach my $metric_type (@{$resource_mapping->{$resource_type}}) { + $metrics_mapping_transformed->{$metric_type} = $self->{metrics_mapping}->{$metric_type}; + } + + foreach my $metric (keys %{$metrics_mapping_transformed}) { + 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 Database for PostgreSQL storage usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=storage --custommode=api +--resource= --resource-group= --aggregation='maximum' +--warning-storage-used='1000' --critical-storage-used='2000' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=storage --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='maximum' --warning-storage-used='1000' --critical-storage-used='2000' + +Default aggregation: 'maximum' / 'average', 'minimum' and 'total' 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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-*> B<--critical-*> + +Thresholds where '*' can be: +'storage-backup', 'serverlog-usage', 'storage-percent', 'storage-used'. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/mode/traffic.pm b/src/cloud/azure/database/postgres/mode/traffic.pm new file mode 100644 index 000000000..e99a9212d --- /dev/null +++ b/src/cloud/azure/database/postgres/mode/traffic.pm @@ -0,0 +1,156 @@ +# +# Copyright 2022 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::database::postgres::mode::traffic; + +use base qw(cloud::azure::custom::mode); + +use strict; +use warnings; + +sub get_metrics_mapping { + my ($self, %options) = @_; + + my $metrics_mapping = { + 'network_bytes_egress' => { + 'output' => 'Network Out', + 'label' => 'traffic-out', + 'nlabel' => 'azpostgres.traffic.out.bytes', + 'unit' => 'B', + 'min' => '0' + }, + 'network_bytes_ingress' => { + 'output' => 'Network In', + 'label' => 'traffic-in', + 'nlabel' => 'azpostgres.traffic.in.bytes', + 'unit' => 'B', + 'min' => '0' + } + }; + + 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' }, + 'resource-type:s' => { name => 'resource_type' } + }); + + 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 with --resource-group option or --resource .'); + $self->{output}->option_exit(); + } + + if (!defined($self->{option_results}->{resource_type}) || $self->{option_results}->{resource_type} eq '') { + $self->{output}->add_option_msg(short_msg => 'Need to specify --resource-type option'); + $self->{output}->option_exit(); + } + + my $resource = $self->{option_results}->{resource}; + my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : ''; + my $resource_type = $self->{option_results}->{resource_type}; + if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.DBforPostgreSQL\/(.*)\/(.*)$/) { + $resource_group = $1; + $resource_type = $2; + $resource = $3; + } + + $self->{az_resource} = $resource; + $self->{az_resource_group} = $resource_group; + $self->{az_resource_type} = $resource_type; + $self->{az_resource_namespace} = 'Microsoft.DBforPostgreSQL'; + $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 Database for PostgreSQL network usage. + +Example: + +Using resource name : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=traffic --custommode=api +--resource= --resource-group= --aggregation='average' +--warning-traffic-out='80' --critical-traffic-out='90' + +Using resource id : + +perl centreon_plugins.pl --plugin=cloud::azure::database::postgres::plugin --mode=traffic --custommode=api +--resource='/subscriptions//resourceGroups//providers/Microsoft.DBforPostgreSQL/servers/' +--aggregation='average' --warning-traffic-out='80' --critical-traffic-out='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<--resource-type> + +Set resource type (Default: 'servers'). Can be 'servers', 'flexibleServers'. + +=item B<--warning-*> B<--critical-*> + +Thresholds where '*' can be: 'traffic-out', 'traffic-in'. + +=back + +=cut diff --git a/src/cloud/azure/database/postgres/plugin.pm b/src/cloud/azure/database/postgres/plugin.pm new file mode 100644 index 000000000..c98f0a2f2 --- /dev/null +++ b/src/cloud/azure/database/postgres/plugin.pm @@ -0,0 +1,66 @@ +# +# Copyright 2022 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::database::postgres::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->{modes} = { + 'connections' => 'cloud::azure::database::postgres::mode::connections', + 'cpu' => 'cloud::azure::database::postgres::mode::cpu', + 'discovery' => 'cloud::azure::database::postgres::mode::discovery', + 'io-consumption' => 'cloud::azure::database::postgres::mode::ioconsumption', + 'memory' => 'cloud::azure::database::postgres::mode::memory', + 'replication' => 'cloud::azure::database::postgres::mode::replication', + 'storage' => 'cloud::azure::database::postgres::mode::storage', + 'traffic' => 'cloud::azure::database::postgres::mode::traffic' + }; + + $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 Database for PostgreSQL resources. + +=cut