add a discovery mode per azure services

This commit is contained in:
Colin Gagnaire 2019-10-01 14:38:15 +02:00
parent 630deb2a75
commit 56fd9d2527
19 changed files with 554 additions and 71 deletions

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::compute::virtualmachine::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.Compute';
$self->{type} = 'virtualMachines';
}
1;
__END__
=head1 MODE
Virtual Machine discovery.
=over 8
=item B<--resource-group>
Specify resources resource group.
=item B<--location>
Specify resources location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -32,6 +32,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'cpu' => 'cloud::azure::compute::virtualmachine::mode::cpu', 'cpu' => 'cloud::azure::compute::virtualmachine::mode::cpu',
'discovery' => 'cloud::azure::compute::virtualmachine::mode::discovery',
'diskio' => 'cloud::azure::compute::virtualmachine::mode::diskio', 'diskio' => 'cloud::azure::compute::virtualmachine::mode::diskio',
'list-resources' => 'cloud::azure::compute::virtualmachine::mode::listresources', 'list-resources' => 'cloud::azure::compute::virtualmachine::mode::listresources',
'network' => 'cloud::azure::compute::virtualmachine::mode::network', 'network' => 'cloud::azure::compute::virtualmachine::mode::network',
@ -47,8 +48,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -44,8 +44,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-06-01-preview' }, 'api-version:s' => { name => 'api_version', default => '2018-06-01-preview' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::sqlserver::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.Sql';
$self->{type} = 'servers';
}
1;
__END__
=head1 MODE
SQL Server discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -31,6 +31,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'discovery' => 'cloud::azure::database::sqlserver::mode::discovery',
'server-status' => 'cloud::azure::database::sqlserver::mode::serverstatus', 'server-status' => 'cloud::azure::database::sqlserver::mode::serverstatus',
'list-servers' => 'cloud::azure::database::sqlserver::mode::listservers', 'list-servers' => 'cloud::azure::database::sqlserver::mode::listservers',
); );
@ -43,8 +44,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-06-01-preview' }, 'api-version:s' => { name => 'api_version', default => '2018-06-01-preview' },
}); });

View File

@ -45,6 +45,11 @@ sub new {
sub check_options { sub check_options {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->SUPER::init(%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 { sub run {
@ -56,10 +61,10 @@ sub run {
$disco_stats->{start_time} = time(); $disco_stats->{start_time} = time();
my $resources = $options{custom}->azure_list_resources( my $resources = $options{custom}->azure_list_resources(
namespace => $self->{option_results}->{namespace}, namespace => $self->{namespace},
resource_type => $self->{option_results}->{type}, resource_type => $self->{type},
location => $self->{option_results}->{location}, location => $self->{location},
resource_group => $self->{option_results}->{resource_group} resource_group => $self->{resource_group}
); );
$disco_stats->{end_time} = time(); $disco_stats->{end_time} = time();

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::recovery::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.RecoveryServices';
$self->{type} = 'vaults';
}
1;
__END__
=head1 MODE
Vault discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -33,6 +33,7 @@ sub new {
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'backup-items-status' => 'cloud::azure::management::recovery::mode::backupitemsstatus', 'backup-items-status' => 'cloud::azure::management::recovery::mode::backupitemsstatus',
'backup-jobs-status' => 'cloud::azure::management::recovery::mode::backupjobsstatus', 'backup-jobs-status' => 'cloud::azure::management::recovery::mode::backupjobsstatus',
'discovery' => 'cloud::azure::management::recovery::mode::discovery',
'list-backup-jobs' => 'cloud::azure::management::recovery::mode::listbackupjobs', 'list-backup-jobs' => 'cloud::azure::management::recovery::mode::listbackupjobs',
'list-vaults' => 'cloud::azure::management::recovery::mode::listvaults', 'list-vaults' => 'cloud::azure::management::recovery::mode::listvaults',
); );
@ -45,8 +46,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-07-10' }, 'api-version:s' => { name => 'api_version', default => '2018-07-10' },
}); });

View File

@ -45,8 +45,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::network::expressroute::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.Network';
$self->{type} = 'expressRouteCircuits';
}
1;
__END__
=head1 MODE
Express Route discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -32,6 +32,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'circuit-status' => 'cloud::azure::network::expressroute::mode::circuitstatus', 'circuit-status' => 'cloud::azure::network::expressroute::mode::circuitstatus',
'discovery' => 'cloud::azure::network::expressroute::mode::discovery',
'list-circuits' => 'cloud::azure::network::expressroute::mode::listcircuits', 'list-circuits' => 'cloud::azure::network::expressroute::mode::listcircuits',
'traffic' => 'cloud::azure::network::expressroute::mode::traffic', 'traffic' => 'cloud::azure::network::expressroute::mode::traffic',
); );
@ -44,8 +45,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::network::networkinterface::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.Network';
$self->{type} = 'networkInterfaces';
}
1;
__END__
=head1 MODE
Network Interface discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -31,6 +31,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'discovery' => 'cloud::azure::network::networkinterface::mode::discovery',
'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources', 'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources',
'traffic' => 'cloud::azure::network::networkinterface::mode::traffic', 'traffic' => 'cloud::azure::network::networkinterface::mode::traffic',
); );
@ -43,8 +44,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::network::virtualnetwork::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.Network';
$self->{type} = 'virtualNetworks';
}
1;
__END__
=head1 MODE
Virtual Network discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -31,6 +31,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'discovery' => 'cloud::azure::network::virtualnetwork::mode::discovery',
'list-virtual-networks' => 'cloud::azure::network::virtualnetwork::mode::listvirtualnetworks', 'list-virtual-networks' => 'cloud::azure::network::virtualnetwork::mode::listvirtualnetworks',
'peerings-status' => 'cloud::azure::network::virtualnetwork::mode::peeringsstatus', 'peerings-status' => 'cloud::azure::network::virtualnetwork::mode::peeringsstatus',
); );
@ -43,8 +44,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::network::vpngateway::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.Network';
$self->{type} = 'virtualNetworkGateways';
}
1;
__END__
=head1 MODE
VPN Gateway discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -31,6 +31,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'discovery' => 'cloud::azure::network::vpngateway::mode::discovery',
'site-traffic' => 'cloud::azure::network::vpngateway::mode::sitetraffic', 'site-traffic' => 'cloud::azure::network::vpngateway::mode::sitetraffic',
'tunnel-traffic' => 'cloud::azure::network::vpngateway::mode::tunneltraffic', 'tunnel-traffic' => 'cloud::azure::network::vpngateway::mode::tunneltraffic',
'vpn-gateway-status' => 'cloud::azure::network::vpngateway::mode::vpngatewaystatus', 'vpn-gateway-status' => 'cloud::azure::network::vpngateway::mode::vpngatewaystatus',
@ -44,8 +45,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });

View File

@ -0,0 +1,60 @@
#
# Copyright 2019 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::storage::storageaccount::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.Storage';
$self->{type} = 'storageAccounts';
}
1;
__END__
=head1 MODE
Storage Account discovery.
=over 8
=item B<--resource-group>
Specify resource group.
=item B<--location>
Specify location.
=item B<--prettify>
Prettify JSON output.
=back
=cut

View File

@ -35,6 +35,7 @@ sub new {
'blob-capacity' => 'cloud::azure::storage::storageaccount::mode::blobcapacity', 'blob-capacity' => 'cloud::azure::storage::storageaccount::mode::blobcapacity',
'blob-container-count' => 'cloud::azure::storage::storageaccount::mode::blobcontainercount', 'blob-container-count' => 'cloud::azure::storage::storageaccount::mode::blobcontainercount',
'blob-count' => 'cloud::azure::storage::storageaccount::mode::blobcount', 'blob-count' => 'cloud::azure::storage::storageaccount::mode::blobcount',
'discovery' => 'cloud::azure::storage::storageaccount::mode::discovery',
'file-capacity' => 'cloud::azure::storage::storageaccount::mode::filecapacity', 'file-capacity' => 'cloud::azure::storage::storageaccount::mode::filecapacity',
'file-count' => 'cloud::azure::storage::storageaccount::mode::filecount', 'file-count' => 'cloud::azure::storage::storageaccount::mode::filecount',
'file-share-count' => 'cloud::azure::storage::storageaccount::mode::filesharecount', 'file-share-count' => 'cloud::azure::storage::storageaccount::mode::filesharecount',
@ -59,8 +60,7 @@ sub new {
sub init { sub init {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{options}->add_options(arguments => $self->{options}->add_options(arguments => {
{
'api-version:s' => { name => 'api_version', default => '2018-01-01' }, 'api-version:s' => { name => 'api_version', default => '2018-01-01' },
}); });