change google suite

This commit is contained in:
garnier-quentin 2020-10-14 17:18:08 +02:00
parent 521c8f5630
commit fbdc1212fe
5 changed files with 531 additions and 424 deletions

View File

@ -0,0 +1,190 @@
#
# Copyright 2020 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 apps::google::gsuite::custom::api;
use strict;
use warnings;
use centreon::plugins::http;
use JSON::XS;
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments => {
'hostname:s' => { name => 'hostname' },
'port:s' => { name => 'port' },
'proto:s' => { name => 'proto' },
'timeout:s' => { name => 'timeout' },
'language:s' => { name => 'language' },
'unknown-http-status:s' => { name => 'unknown_http_status' },
'warning-http-status:s' => { name => 'warning_http_status' },
'critical-http-status:s' => { name => 'critical_http_status' }
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{http} = centreon::plugins::http->new(%options);
return $self;
}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
}
sub set_defaults {}
sub check_options {
my ($self, %options) = @_;
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : 'www.google.com';
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
$self->{language} = (defined($self->{option_results}->{language}) && $self->{option_results}->{language} ne '') ? $self->{option_results}->{language} : 'en';
$self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_http_status} : '%{http_code} < 200 or %{http_code} >= 300';
$self->{warning_http_status} = (defined($self->{option_results}->{warning_http_status})) ? $self->{option_results}->{warning_http_status} : '';
$self->{critical_http_status} = (defined($self->{option_results}->{critical_http_status})) ? $self->{option_results}->{critical_http_status} : '';
if ($self->{hostname} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --hostname option.");
$self->{output}->option_exit();
}
return 0;
}
sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{timeout} = $self->{timeout};
}
sub settings {
my ($self, %options) = @_;
return if (defined($self->{settings_done}));
$self->build_options_for_httplib();
$self->{http}->add_header(key => 'Accept', value => 'application/json');
$self->{http}->add_header(key => 'Content-Type', value => 'application/json');
$self->{http}->set_options(%{$self->{option_results}});
$self->{settings_done} = 1;
}
sub get_hostname {
my ($self, %options) = @_;
return $self->{hostname};
}
sub request_api {
my ($self, %options) = @_;
$self->settings();
my $content = $self->{http}->request(
url_path => '/appsstatus/json/' . $self->{language},
unknown_status => $self->{unknown_http_status},
warning_status => $self->{warning_http_status},
critical_status => $self->{critical_http_status}
);
$content =~ s/dashboard.jsonp\((.+)\)\;$/$1/g;
if (!defined($content) || $content eq '') {
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
$self->{output}->option_exit();
}
my $decoded;
eval {
$decoded = JSON::XS->new->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)");
$self->{output}->option_exit();
}
if (defined($decoded->{error_code})) {
$self->{output}->add_option_msg(short_msg => "Error message : " . $decoded->{error});
$self->{output}->option_exit();
}
return $decoded;
}
1;
__END__
=head1 NAME
Gsuite Rest API
=head1 REST API OPTIONS
Gsuite Rest API
=over 8
=item B<--hostname>
Hostname (default: 'www.google.com').
=item B<--port>
Port used (Default: 443)
=item B<--proto>
Specify https if needed (Default: 'https')
=item B<--language>
Language (Default: 'en')
=item B<--timeout>
Set timeout in seconds (Default: 10).
=back
=head1 DESCRIPTION
B<custom>.
=cut

View File

@ -0,0 +1,184 @@
#
# Copyright 2020 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 apps::google::gsuite::mode::applications;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
use POSIX qw(strftime);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf(
"(%s): '%s' (since '%s')",
$self->{result_values}->{status},
$self->{result_values}->{message},
$self->{result_values}->{time}
);
}
sub prefix_gapps_output {
my ($self, %options) = @_;
return $options{instance_value}->{name} . " ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'gapps', type => 1, cb_prefix_output => 'prefix_gapps_output', display_long => 1, cb_long_output => 'long_output', message_multiple => 'All Google Apps are ok' }
];
$self->{maps_counters}->{global} = [
{ label => 'apps', nlabel => 'google.apps.current.count', set => {
key_values => [ { name => 'apps' } ],
output_template => '%s GApps',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
$self->{maps_counters}->{gapps} = [
{
label => 'status',
type => 2,
warning_default => '%{status} eq "DEGRADED"',
critical_default => '%{status} eq "UNAVAILABLE"',
set => {
key_values => [ { name => 'status' }, { name => 'name' }, { name => 'message' }, { name => 'time' } ],
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
}
];
}
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-app:s' => { name => 'filter_app' },
'display-extra' => { name => 'display_extra'}
});
return $self;
}
my $status_mapping = {
1 => 'DEGRADED',
2 => 'UNAVAILABLE',
3 => 'RESOLVED',
4 => 'CLOSED'
};
sub manage_selection {
my ($self, %options) = @_;
my $results = $options{custom}->request_api();
my $time_now = strftime('%Y-%m-%dT%H:%M:%S', gmtime());
foreach my $mapping (@{$results->{services}}) {
next if (
defined($self->{option_results}->{filter_app})
&& $self->{option_results}->{filter_app} ne ''
&& $mapping->{name} !~ /(?i)$self->{option_results}->{filter_app}/
);
next if (
(!defined($self->{option_results}->{display_extra}))
&& $mapping->{type} != 0
);
$self->{gapps}->{ $mapping->{id} } = {
name => $mapping->{name},
type => $mapping->{type},
status => 'OK',
time => $time_now,
message => ''
};
};
$self->{global}->{issues} = 0;
foreach my $issue (@{$results->{messages}}) {
next if (!defined($self->{gapps}->{ $issue->{service} }));
next if (
(!defined($self->{option_results}->{display_extra}))
&& $self->{gapps}->{ $issue->{service} } != 0
);
next if ($issue->{resolved});
$self->{gapps}->{ $issue->{service} } = {
name => $self->{gapps}->{ $issue->{service} }->{name},
status => $status_mapping->{ $issue->{type} },
time => strftime('%Y-%m-%dT%H:%M:%S', gmtime($issue->{time} / 1000)),
message => $issue->{message},
resolved => $issue->{resolved},
type => $self->{gapps}->{ $issue->{service} }->{type}
};
}
$self->{global}->{apps} = scalar(keys %{$self->{gapps}});
}
1;
__END__
=head1 MODE
Check Google Gsuite Applications status
=over 8
=item B<--filter-app>
Only display the status for a specific app
(Example: --filter-app='gmail')
=item B<--display-extra>
Also display the status of the Google Apps not covered by G Suite Service Level Agreement
=item B<--warning-status>
Set warning threshold for the application status
(Default: '%{status} eq "DEGRADED"').
=item B<--critical-status>
Set warning threshold for the application status
(Default: '%{status} eq "UNAVALAIBLE"').
=back
=cut

View File

@ -1,135 +1,107 @@
#
# Copyright 2020 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 apps::google::gsuite::mode::listapplications;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
use JSON::XS;
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 => {
'hostname:s' => { name => 'hostname', default => 'www.google.com' },
'port:s' => { name => 'port', default => '443'},
'proto:s' => { name => 'proto', default => 'https' },
'urlpath:s' => { name => 'url_path', default => '/appsstatus/json' },
'language:s' => { name => 'language', default => 'en' },
'timeout:s' => { name => 'timeout', default => '30' },
'filter-name:s' => { name => 'filter_name' },
});
$self->{http} = centreon::plugins::http->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
$self->{option_results}->{url_path} .= "/" . $self->{option_results}->{language};
$self->{http}->set_options(%{$self->{option_results}});
}
sub manage_selection {
my ($self, %options) = @_;
my $content = $self->{http}->request(%options);
$content =~ s/dashboard.jsonp\((.+)\)\;$/$1/g;
if (!defined($content) || $content eq '') {
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
$self->{output}->option_exit();
}
my $decoded;
eval {
$decoded = JSON::XS->new->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)");
$self->{output}->option_exit();
}
if (defined($decoded->{error_code})) {
$self->{output}->output_add(long_msg => "Error message : " . $decoded->{error}, debug => 1);
$self->{output}->option_exit();
}
foreach my $application (@{$decoded->{services}}) {
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
&& $application->{name} !~ /$self->{option_results}->{filter_name}/);
$self->{applications}{$application->{id}} = $application->{name};
};
}
sub run {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach (keys %{$self->{applications}}) {
$self->{output}->output_add(
long_msg => sprintf("[name = %s]", $self->{applications}{$_})
);
}
$self->{output}->output_add(severity => 'OK', short_msg => 'Google Gsuite Applications');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['name']);
}
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach (keys %{$self->{applications}}) {
$self->{output}->add_disco_entry(
name => $self->{applications}{$_}
);
}
}
1;
__END__
=head1 MODE
List Google Gsuite applications.
=over 8
=item B<--filter-name>
Filter application name (Can be a regexp).
=back
=cut
#
# Copyright 2020 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 apps::google::gsuite::mode::listapplications;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
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-name:s' => { name => 'filter_name' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub manage_selection {
my ($self, %options) = @_;
my $results = $options{custom}->request_api();
my $applications = {};
foreach my $application (@{$results->{services}}) {
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
&& $application->{name} !~ /$self->{option_results}->{filter_name}/);
$applications->{ $application->{id} } = $application->{name};
}
return $applications;
}
sub run {
my ($self, %options) = @_;
my $applications = $self->manage_selection(%options);
foreach (keys %$applications) {
$self->{output}->output_add(
long_msg => sprintf("[name = %s]", $applications->{$_})
);
}
$self->{output}->output_add(severity => 'OK', short_msg => 'Google Gsuite Applications:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['name']);
}
sub disco_show {
my ($self, %options) = @_;
my $applications = $self->manage_selection(%options);
foreach (keys %$applications) {
$self->{output}->add_disco_entry(
name => $applications->{$_}
);
}
}
1;
__END__
=head1 MODE
List Google Gsuite applications.
=over 8
=item B<--filter-name>
Filter application name (Can be a regexp).
=back
=cut

View File

@ -1,240 +0,0 @@
#
# Copyright 2020 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 apps::google::gsuite::mode::status;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::http;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use JSON::XS;
use POSIX qw(strftime);
sub custom_status_output {
my ($self, %options) = @_;
return sprintf(
" (%s): '%s' (since '%s')",
$self->{result_values}->{status},
$self->{result_values}->{message},
$self->{result_values}->{time}
);
}
sub prefix_gapps_output {
my ($self, %options) = @_;
return $options{instance_value}->{name} . " ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'gapps', type => 1, cb_prefix_output => 'prefix_gapps_output', display_long => 1, cb_long_output => 'long_output', message_multiple => 'All Google Apps are ok' }
];
$self->{maps_counters}->{global} = [
{ label => 'apps', nlabel => 'google.apps.current.count', set => {
key_values => [ { name => 'apps' } ],
output_template => '%s GApps',
perfdatas => [
{ template => '%s',
min => 0 },
],
}
}
];
$self->{maps_counters}->{gapps} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'name' }, { name => 'message' }, { name => 'time' },],
#closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
},
];
}
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 => {
'hostname:s' => { name => 'hostname', default => 'www.google.com' },
'port:s' => { name => 'port', default => '443'},
'proto:s' => { name => 'proto', default => 'https' },
'urlpath:s' => { name => 'url_path', default => '/appsstatus/json' },
'language:s' => { name => 'language', default => 'en' },
'timeout:s' => { name => 'timeout', default => '30' },
'filter-app:s' => { name => 'filter_app' },
'display-extra' => { name => 'display_extra'},
'warning-status:s' => { name => 'warning_status', default => '%{status} eq "DEGRADED"' },
'critical-status:s' => { name => 'critical_status', default => '%{status} eq "UNAVAILABLE"' },
});
$self->{http} = centreon::plugins::http->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->{option_results}->{url_path} .= "/" . $self->{option_results}->{language};
$self->{http}->set_options(%{$self->{option_results}});
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
sub manage_selection {
my ($self, %options) = @_;
my $content = $self->{http}->request(%options);
$content =~ s/dashboard.jsonp\((.+)\)\;$/$1/g;
if (!defined($content) || $content eq '') {
$self->{output}->add_option_msg(short_msg => "API returns empty content [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");
$self->{output}->option_exit();
}
my $decoded;
eval {
$decoded = JSON::XS->new->utf8->decode($content);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode response (add --debug option to display returned content)");
$self->{output}->option_exit();
}
if (defined($decoded->{error_code})) {
$self->{output}->output_add(long_msg => "Error message : " . $decoded->{error}, debug => 1);
$self->{output}->option_exit();
}
my %status_mapping = (
1 => 'DEGRADED',
2 => 'UNAVAILABLE',
3 => 'RESOLVED',
4 => 'CLOSED'
);
my $time_now = strftime('%Y-%m-%dT%H:%M:%S', gmtime());
foreach my $mapping (@{$decoded->{services}}) {
next if (
defined($self->{option_results}->{filter_app})
&& $self->{option_results}->{filter_app} ne ''
&& $mapping->{name} !~ /(?i)$self->{option_results}->{filter_app}/
);
next if (
(!defined($self->{option_results}->{display_extra}))
&& $mapping->{type} != '0'
);
$self->{gapps}->{$mapping->{id}} = {
name => $mapping->{name},
type => $mapping->{type},
status => 'OK',
time => $time_now,
message => ''
};
};
$self->{global}->{issues} = 0;
foreach my $issue (@{$decoded->{messages}}) {
next if (!defined($self->{gapps}->{$issue->{service}}));
next if (
(!defined($self->{option_results}->{display_extra}))
&& $self->{gapps}->{$issue->{service}} != '0'
);
next if $issue->{resolved};
$self->{gapps}->{$issue->{service}} = {
name => $self->{gapps}->{$issue->{service}}->{name},
status => $status_mapping{$issue->{type}},
time => strftime('%Y-%m-%dT%H:%M:%S', gmtime($issue->{time} / 1000)),
message => $issue->{message},
resolved => $issue->{resolved},
type => $self->{gapps}->{$issue->{service}}->{type}
};
}
$self->{global}->{apps} = scalar (keys %{$self->{gapps}});
}
1;
__END__
=head1 MODE
Check Google Gsuite Applications status
=over 8
=item B<--hostname>
IP Addr/FQDN of the Google Appstatus site (Default:'www.google.com')
=item B<--port>
Port used by Google's status website (Default: '443')
=item B<--proto>
Specify the HTTP protocol if needed (Default: 'https')
=item B<--urlpath>
URL path to get Google's status information (Default: '/appsstatus/json')
=item B<--language>
Set the language to be used in the response (Two letters, Default: 'en')
=item B<--timeout>
Threshold for HTTP timeout (Default: 5)
=item B<--filter-app>
Only display the status for a specific app
(Example: --filter-app='gmail')
=item B<--display-extra>
Also display the status of the Google Apps not covered by G Suite Service Level Agreement
=item B<--warning-status>
Set warning threshold for the application status
(Default: '%{status} eq "DEGRADED"').
=item B<--critical-status>
Set warning threshold for the application status
(Default: '%{status} eq "UNAVALAIBLE"').
=back
=cut

View File

@ -1,49 +1,50 @@
#
# Copyright 2020 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 apps::google::gsuite::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_simple);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '0.1';
%{$self->{modes}} = (
'list-applications' => 'apps::google::gsuite::mode::listapplications',
'status' => 'apps::google::gsuite::mode::status'
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Google GApps status.
=cut
#
# Copyright 2020 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 apps::google::gsuite::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} = {
'applications' => 'apps::google::gsuite::mode::applications',
'list-applications' => 'apps::google::gsuite::mode::listapplications'
};
$self->{custom_modes}->{api} = 'apps::google::gsuite::custom::api';
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Google GApps status.
=cut