Merge pull request #4 from centreon/master

Update repo
This commit is contained in:
Bertrand Cournaud 2016-09-15 08:25:46 +02:00 committed by GitHub
commit 69e786a4d0
1386 changed files with 34939 additions and 10708 deletions

View File

@ -27,7 +27,7 @@ It seems that 'os::linux::snmp::plugin' is the good one. So i verify with the op
Plugin Description:
Check Linux operating systems in SNMP.
It's exactly what i need. Now i'll the option ``--list-mode`` to know what can i do with it:
It's exactly what i need. Now i'll add the option ``--list-mode`` to know what can i do with it:
$ perl centreon_plugins.pl --plugin=os::linux::snmp::plugin --list-mode
...

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -360,14 +360,14 @@ Threshold for HTTP timeout
Threshold unit (Default: '%'. Can be: '%' or 'absolute')
=item B<--warning>
=item B<--warning-*>
Warning threshold.
Can be: 'busy', 'free', 'waiting', 'starting', 'reading',
'sending', 'keepalive', 'dns-lookup', 'closing',
'logging', 'gracefuly-finished', 'idle-cleanup-worker'.
=item B<--critical>
=item B<--critical-*>
Critical threshold.
Can be: 'busy', 'free', 'waiting', 'starting', 'reading',

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -41,7 +41,7 @@ sub getdata {
my ($value);
#print $stdout;
foreach (split(/\n/, $stdout)) {
if (/^$searchpattern\s*:\s*(.*)\s(Percent Load Capacity|Percent|Minutes|Seconds|Volts|Hz|seconds|C|F Internal)/i) {
if (/^$searchpattern\s*:\s*(.*)\s(Percent Load Capacity|Percent|Minutes|Seconds|Volts|Hz|seconds|C Internal|F Internal|C|F)/i) {
$valueok = "1";
$value = $1;
#print $value;

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -82,7 +82,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -0,0 +1,267 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::dedupstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'status : ' . $self->{result_values}->{status};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'pool', type => 1, cb_prefix_output => 'prefix_pool_output', message_multiple => 'All dedup status are ok' }
];
$self->{maps_counters}->{pool} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
{ label => 'usage', set => {
key_values => [ { name => 'usage' }, { name => 'display' } ],
output_template => 'Use: %s %%',
perfdatas => [
{ label => 'used', value => 'usage_absolute', template => '%s',
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'nbdevquery' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-listdv -U -stype PureDisk' },
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /up/i' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub prefix_pool_output {
my ($self, %options) = @_;
return "Disk pool name '" . $options{instance_value}->{display} . "' ";
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{pool} = {};
#Disk Pool Name : NBU-MASTER-DP
#Disk Type : PureDisk
#Disk Volume Name : PureDiskVolume
#Disk Media ID : @aaaah
#Total Capacity (GB) : 9777.56
#Free Space (GB) : 837.72
#Use% : 91
#Status : UP
#Flag : ReadOnWrite
#Flag : AdminUp
#Flag : InternalUp
while ($stdout =~ /^(Disk Pool Name.*?)(?=Disk Pool Name|\z)/msig) {
my $pool = $1;
my ($display, $usage, $status);
$display = centreon::plugins::misc::trim($1) if ($pool =~ /^Disk Pool Name\s*:\s*(.*?)\n/msi);
$status = $1 if ($pool =~ /^Status\s*:\s*(.*?)\n/msi);
$usage = $1 if ($pool =~ /^Use%\s*:\s*(.*?)\n/msi);
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$display !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $display . "': no matching filter.", debug => 1);
next;
}
$self->{pool}->{$display} = { display => $display, usage => $usage, status => $status };
}
if (scalar(keys %{$self->{pool}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No pool found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check deduplication status.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'nbdevquery').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-listdv -U -stype PureDisk').
=item B<--filter-name>
Filter pool name (can be a regexp).
=item B<--warning-usage>
Set warning threshold in percent.
=item B<--critical-usage>
Set critical threshold in percent.
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{display}, %{status}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} !~ /up/i').
Can used special variables like: %{display}, %{status}
=back
=cut

View File

@ -0,0 +1,179 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::drivecleaning;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'drive', type => 0 }
];
$self->{maps_counters}->{drive} = [
{ label => 'cleaning', set => {
key_values => [ { name => 'num_cleaning' }, { name => 'total' } ],
output_template => '%d drives needs a reset mount time',
perfdatas => [
{ label => 'cleaning', value => 'num_cleaning_absolute', template => '%s',
min => 0, max => 'total_absolute' },
],
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'tpconfig' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-l' },
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{drive} = { total => 0, num_cleaning => 0 };
#Drive Name Type Mount Time Frequency Last Cleaned Comment
#********** **** ********** ********* **************** *******
#IBM.ULT3580-HH5.000 hcart2* 18.3 96 05:29 21/12/2015
#IBM.ULT3580-HH5.002 hcart2* 36.8 0 11:10 20/12/2015
my @lines = split /\n/, $stdout;
splice(@lines, 0, 2);
foreach my $line (@lines) {
$line =~ /^(\S+)/;
my $name = $1;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{output}->output_add(long_msg => "drive '" . $name . "' checked.", debug => 1);
$self->{drive}->{total}++;
if ($line =~ /NEEDS CLEANING/i) {
$self->{drive}->{num_cleaning}++;
}
}
if (scalar(keys %{$self->{drive}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No drives found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check drive cleaning.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'tpconfig').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-l').
=item B<--filter-name>
Filter drive name (can be a regexp).
=item B<--warning-*>
Threshold warning.
Can be: 'cleaning'.
=item B<--critical-*>
Threshold critical.
Can be: 'cleaning'.
=back
=cut

View File

@ -0,0 +1,239 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::drivestatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'status : ' . $self->{result_values}->{status};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'drive', type => 1, cb_prefix_output => 'prefix_drive_output', message_multiple => 'All drive status are ok' }
];
$self->{maps_counters}->{drive} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'tpconfig' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-l' },
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /up/i' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub prefix_drive_output {
my ($self, %options) = @_;
return "Drive '" . $options{instance_value}->{display} . "' ";
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{drive} = {};
#robot 0 - TLD - - - - {3,0,0,1}
# drive - 0 hcart2 2 UP - IBM.ULT3580-HH5.000 {3,0,1,0}
# drive - 2 hcart2 1 UP - IBM.ULT3580-HH5.002 {3,0,0,0}
while ($stdout =~ /^robot\s+(\d+)(.*?)(?=robot\s+\d+|\z)/msig) {
my ($robot_num, $drives) = ($1, $2);
while ($drives =~ /drive\s+\S+\s+(\d+)\s+\S+\s+\S+\s+(\S+)/msig) {
my $name = $robot_num . '.' . $1;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{drive}->{$name} = { display => $name, status => $2 };
}
}
if (scalar(keys %{$self->{drive}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No drives found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check drive status.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'tpconfig').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-l').
=item B<--filter-name>
Filter drive name (can be a regexp).
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{display}, %{status}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} !~ /up/i').
Can used special variables like: %{display}, %{status}
=back
=cut

View File

@ -0,0 +1,437 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::jobstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
use Digest::MD5 qw(md5_hex);
my $instance_mode;
sub custom_status_threshold {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
# To exclude some OK
if (defined($instance_mode->{option_results}->{ok_status}) && $instance_mode->{option_results}->{ok_status} ne '' &&
eval "$instance_mode->{option_results}->{ok_status}") {
$status = 'ok';
} elsif (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'status : ' . $self->{result_values}->{status};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_type'};
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
return 0;
}
sub custom_long_threshold {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_long}) && $instance_mode->{option_results}->{critical_long} ne '' &&
eval "$instance_mode->{option_results}->{critical_long}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_long}) && $instance_mode->{option_results}->{warning_long} ne '' &&
eval "$instance_mode->{option_results}->{warning_long}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_long_output {
my ($self, %options) = @_;
my $msg = 'started since : ' . centreon::plugins::misc::change_seconds(value => $self->{result_values}->{elapsed});
return $msg;
}
sub custom_long_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{elapsed} = $options{new_datas}->{$self->{instance} . '_elapsed'};
$self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_type'};
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
return -11 if ($self->{result_values}->{state} !~ /queued|active/);
return 0;
}
my $last_status_frozen;
sub custom_frozen_threshold {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_frozen}) && $instance_mode->{option_results}->{critical_frozen} ne '' &&
eval "$instance_mode->{option_results}->{critical_frozen}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_frozen}) && $instance_mode->{option_results}->{warning_frozen} ne '' &&
eval "$instance_mode->{option_results}->{warning_frozen}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
$last_status_frozen = $status;
return $status;
}
sub custom_frozen_output {
my ($self, %options) = @_;
my $msg = 'frozen : no';
if (!$self->{output}->is_status(value => $last_status_frozen, compare => 'ok', litteral => 1)) {
$msg = 'frozen: yes';
}
return $msg;
}
sub custom_frozen_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{elapsed} = $options{new_datas}->{$self->{instance} . '_elapsed'};
$self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_type'};
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{kb} = $options{new_datas}->{$self->{instance} . '_kb'} - $options{old_datas}->{$self->{instance} . '_kb'};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'policy', type => 2, cb_prefix_output => 'prefix_policy_output', cb_long_output => 'policy_long_output', message_multiple => 'All policies are ok',
group => [ { name => 'job', cb_prefix_output => 'prefix_job_output', skipped_code => { -11 => 1 } } ]
}
];
$self->{maps_counters}->{job} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' }, { name => 'type' }, { name => 'state' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_status_threshold'),
}
},
{ label => 'long', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'display' }, { name => 'elapsed' }, { name => 'type' }, { name => 'state' } ],
closure_custom_calc => $self->can('custom_long_calc'),
closure_custom_output => $self->can('custom_long_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_long_threshold'),
}
},
{ label => 'frozen', threshold => 0, set => {
key_values => [ { name => 'kb', diff => 1 }, { name => 'status' }, { name => 'display' }, { name => 'elapsed' }, { name => 'type' }, { name => 'state' } ],
closure_custom_calc => $self->can('custom_frozen_calc'),
closure_custom_output => $self->can('custom_frozen_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_frozen_threshold'),
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'bpdbjobs' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-report -most_columns' },
"filter-policy-name:s" => { name => 'filter_policy_name' },
"filter-end-time:s" => { name => 'filter_end_time', default => 86400 },
"ok-status:s" => { name => 'ok_status', default => '%{status} == 0' },
"warning-status:s" => { name => 'warning_status', default => '%{status} == 1' },
"critical-status:s" => { name => 'critical_status', default => '%{status} > 1' },
"warning-long:s" => { name => 'warning_long' },
"critical-long:s" => { name => 'critical_long' },
"warning-frozen:s" => { name => 'warning_frozen' },
"critical-frozen:s" => { name => 'critical_frozen', default => '%{state} =~ /active|queue/ && %{kb} == 0' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub policy_long_output {
my ($self, %options) = @_;
return "checking policy '" . $options{instance_value}->{display} . "'";
}
sub prefix_policy_output {
my ($self, %options) = @_;
return "policy '" . $options{instance_value}->{display} . "' ";
}
sub prefix_job_output {
my ($self, %options) = @_;
return "job '" . $options{instance_value}->{display} . "' ";
}
sub change_macros {
my ($self, %options) = @_;
foreach (('ok_status', 'warning_status', 'critical_status', 'warning_long', 'critical_long', 'warning_frozen', 'critical_frozen')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %job_type = (
0 => 'backup', 1 => 'archive', 2 => 'restore', 3 => 'verify', 4 => 'duplicate', 5 => 'phase 1 or phase 2 import',
6 => 'catalog backup', 7 => 'vault duplicate', 8 => 'label tape', 9 => 'erase tape',
10 => 'tape request', 11 => 'clean tape', 12 => 'format tape', 13 => 'physical inventory of robotic library',
14 => 'qualification test of drive or robotic library', 15 => 'catalog recovery', 16 => 'media contents',
17 => 'image cleanup', 18 => 'LiveUpdate', 20 => 'Replication (Auto Image Replication)', 21 => 'Import (Auto Image Replication)',
22 => 'backup From Snapshot', 23 => 'Replication (snap)', 24 => 'Import (snap)', 25 => 'application state capture',
26 => 'indexing', 27 => 'index cleanup', 28 => 'Snapshot',
29 => 'SnapIndex', 30 => 'ActivateInstantRecovery', 31 => 'DeactivateInstantRecovery',
32 => 'ReactivateInstantRecovery', 33 => 'StopInstantRecovery', 34 => 'InstantRecovery',
);
my %job_state = (
0 => 'queued and awaiting resources',
1 => 'active',
2 => 'requeued and awaiting resources',
3 => 'done', 4 => 'suspended', 5 => 'incomplete',
);
sub manage_selection {
my ($self, %options) = @_;
$self->{cache_name} = "netbackup_" . $self->{mode} . '_' . (defined($self->{option_results}->{hostname}) ? $self->{option_results}->{sudo} : 'me') . '_' .
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{policy} = {};
my $current_time = time();
foreach my $line (split /\n/, $stdout) {
my @values = split /,/, $line;
my ($job_id, $job_type, $job_state, $job_status, $job_pname, $job_start_time, $job_end_time, $job_kb) =
($values[0], $values[1], $values[2], $values[3], $values[4], $values[8], $values[10], $values[14]);
$job_pname = defined($job_pname) && $job_pname ne '' ? $job_pname : 'unknown';
$job_status = defined($job_status) && $job_status =~ /[0-9]/ ? $job_status : undef;
if (defined($self->{option_results}->{filter_policy_name}) && $self->{option_results}->{filter_policy_name} ne '' &&
$job_pname !~ /$self->{option_results}->{filter_policy_name}/) {
$self->{output}->output_add(long_msg => "skipping job '" . $job_pname . "/" . $job_id . "': no matching filter.", debug => 1);
next;
}
if (defined($self->{option_results}->{filter_end_time}) && $self->{option_results}->{filter_end_time} =~ /[0-9]+/ &&
defined($job_end_time) && $job_end_time =~ /[0-9]+/ && $job_end_time < $current_time - $self->{option_results}->{filter_end_time}) {
$self->{output}->output_add(long_msg => "skipping job '" . $job_pname . "/" . $job_id . "': too old.", debug => 1);
next;
}
$self->{policy}->{$job_pname} = { job => {}, display => $job_pname } if (!defined($self->{policy}->{$job_pname}));
my $elapsed_time = $current_time - $job_start_time;
$self->{policy}->{$job_pname}->{job}->{$job_id} = { display => $job_id, elapsed => $elapsed_time,
status => $job_status, state => $job_state{$job_state}, type => $job_type{$job_type},
kb => defined($job_kb) && $job_kb =~ /[0-9]+/ ? $job_kb : undef };
}
if (scalar(keys %{$self->{policy}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No job found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check job status.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'bpdbjobs').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-report -most_columns').
=item B<--filter-policy-name>
Filter job policy name (can be a regexp).
=item B<--filter-end-time>
Filter job with end time greater than current time less value in seconds (Default: 86400).
=item B<--ok-status>
Set ok threshold for status (Default: '%{status} == 0')
Can used special variables like: %{display}, %{status}
=item B<--warning-status>
Set warning threshold for status (Default: '%{status} == 1')
Can used special variables like: %{display}, %{status}, %{type}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} > 1').
Can used special variables like: %{display}, %{status}, %{type}
=item B<--warning-long>
Set warning threshold for long jobs (Default: none)
Can used special variables like: %{display}, %{status}, %{elapsed}, %{type}
=item B<--critical-long>
Set critical threshold for long jobs (Default: none).
Can used special variables like: %{display}, %{status}, %{elapsed}, %{type}
=item B<--warning-frozen>
Set warning threshold for frozen jobs (Default: none)
Can used special variables like: %{display}, %{status}, %{elapsed}, %{type}, %{kb}
=item B<--critical-frozen>
Set critical threshold for frozen jobs (Default: '%{state} =~ /active|queue/ && %{kb} == 0').
Can used special variables like: %{display}, %{status}, %{elapsed}, %{type}, %{kb}
=back
=cut

View File

@ -0,0 +1,189 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::listpolicies;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::misc;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'bppllist' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '' },
"command2:s" => { name => 'command2', default => 'bpplinfo %{policy_name} -L' },
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach (sort keys %{$self->{policies}}) {
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$_ !~ /$self->{option_results}->{filter_name}/i) {
$self->{output}->output_add(long_msg => "skipping policy '" . $_ . "': no type or no matching filter type");
next;
}
$self->{output}->output_add(long_msg => "'" . $_ . "' [active = " . $self->{policies}->{$_}->{active} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List policy:');
$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', 'active']);
}
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach (sort keys %{$self->{policies}}) {
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$_ !~ /$self->{option_results}->{filter_name}/i);
$self->{output}->add_disco_entry(name => $_,
active => $self->{policies}->{$_}->{active}
);
}
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{policies} = {};
my @lines = split /\n/, $stdout;
foreach my $policy_name (@lines) {
my $command2 = $self->{option_results}->{command2};
$command2 =~ s/%{policy_name}/$policy_name/g;
my ($stdout2) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $command2);
#Policy Type: NBU-Catalog (35)
#Active: yes
my $active = '';
$active = $1 if ($stdout2 =~ /^Active\s*:\s+(\S+)/msi);
$self->{policies}->{$policy_name} = { active => $active };
}
}
1;
__END__
=head1 MODE
List policies.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'bppllist').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: none).
=item B<--command2>
Command to get active policy information (Default: 'bpplinfo %{policy_name} -L').
Can be changed if you have output in a file.
=item B<--filter-name>
Filter policy name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,256 @@
#
# Copyright 2016 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::backup::netbackup::local::mode::tapeusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
my $instance_mode;
sub custom_usage_perfdata {
my ($self, %options) = @_;
my $label = 'used';
my $value_perf = $self->{result_values}->{used};
if (defined($instance_mode->{option_results}->{free})) {
$label = 'free';
$value_perf = $self->{result_values}->{free};
}
my %total_options = ();
if ($instance_mode->{option_results}->{units} eq '%') {
$total_options{total} = $self->{result_values}->{total};
$total_options{cast_int} = 1;
}
$self->{output}->perfdata_add(label => $label,
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
min => 0, max => $self->{result_values}->{total});
}
sub custom_usage_threshold {
my ($self, %options) = @_;
my ($exit, $threshold_value);
$threshold_value = $self->{result_values}->{used};
$threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free}));
if ($instance_mode->{option_results}->{units} eq '%') {
$threshold_value = $self->{result_values}->{prct_used};
$threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free}));
}
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
return $exit;
}
sub custom_usage_output {
my ($self, %options) = @_;
my $msg = sprintf("Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
$self->{result_values}->{total},
$self->{result_values}->{used}, $self->{result_values}->{prct_used},
$self->{result_values}->{free}, $self->{result_values}->{prct_free});
return $msg;
}
sub custom_usage_calc {
my ($self, %options) = @_;
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'};
$self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
$self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used};
$self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'usage', set => {
key_values => [ { name => 'total' }, { name => 'used' } ],
closure_custom_calc => \&custom_usage_calc,
closure_custom_output => \&custom_usage_output,
closure_custom_perfdata => \&custom_usage_perfdata,
closure_custom_threshold_check => \&custom_usage_threshold,
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"remote" => { name => 'remote' },
"ssh-option:s@" => { name => 'ssh_option' },
"ssh-path:s" => { name => 'ssh_path' },
"ssh-command:s" => { name => 'ssh_command', default => 'ssh' },
"timeout:s" => { name => 'timeout', default => 30 },
"sudo" => { name => 'sudo' },
"command:s" => { name => 'command', default => 'vmquery' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-a -w' },
"filter-scratch:s" => { name => 'filter_scratch', default => 'scratch' },
"units:s" => { name => 'units', default => '%' },
"free" => { name => 'free' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
}
sub manage_selection {
my ($self, %options) = @_;
my ($stdout) = centreon::plugins::misc::execute(output => $self->{output},
options => $self->{option_results},
sudo => $self->{option_results}->{sudo},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
$self->{global} = { total => 0, used => 0 };
#media optical media barcode robot robot robot robot side/ volume prev # of max # of create assigned first mount last mount expiration off sent off return off off
#ID partner type barcode partner host type # slot face group pool pool # pool mounts mounts cleanings datetime datetime datetime datetime datetime status offsite location datetime datetime slot ses id version description
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#000001 - HCART2 000001L5 - - NONE - - - --- VP-05WEEKS-EXT 9 VP-SCRATCH 1250 0 - 30/11/2012 15:30 29/02/2016 20:43 27/01/2013 17:57 02/03/2016 01:36 00/00/0000 00:00 0 - 00/00/0000 00:00 00/00/0000 00:00 - - 50 ---
#000002 - HCART2 000002L5 - XXX-NBU-XXX TLD 0 8 - 000_00000_TLD VP-SCRATCH 4 VP-05WEEKS-EXT
# Remove header
$stdout =~ s/\x00//msg;
$stdout =~ s/^.*?----.*?\n//ms;
foreach my $line (split /\n/, $stdout) {
$line =~ /^\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)/;
my ($robot_host, $robot_slot, $pool) = ($1, $2, $3);
next if ($robot_slot !~ /[0-9]/);
$self->{global}->{total}++;
if (defined($self->{option_results}->{filter_scratch}) && $self->{option_results}->{filter_scratch} ne '' &&
$pool !~ /$self->{option_results}->{filter_scratch}/i) {
$self->{global}->{used}++;
}
}
if ($self->{global}->{total} == 0) {
$self->{output}->add_option_msg(short_msg => "No tape found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check tapes available in library.
=over 8
=item B<--remote>
Execute command remotely in 'ssh'.
=item B<--hostname>
Hostname to query (need --remote).
=item B<--ssh-option>
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
=item B<--ssh-path>
Specify ssh command path (default: none)
=item B<--ssh-command>
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
=item B<--timeout>
Timeout in seconds for the command (Default: 30).
=item B<--sudo>
Use 'sudo' to execute the command.
=item B<--command>
Command to get information (Default: 'vmquery').
Can be changed if you have output in a file.
=item B<--command-path>
Command path (Default: none).
=item B<--command-options>
Command options (Default: '-a -w').
=item B<--filter-scratch>
Filter tape scratch (Default: 'scratch').
=item B<--units>
Units of thresholds (Default: '%') ('%', 'absolute').
=item B<--free>
Thresholds are on free tape left.
=item B<--warning-*>
Threshold warning.
Can be: 'usage'.
=item B<--critical-*>
Threshold critical.
Can be: 'usage'.
=back
=cut

View File

@ -0,0 +1,53 @@
#
# Copyright 2016 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::backup::netbackup::local::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}} = (
'dedup-status' => 'apps::backup::netbackup::local::mode::dedupstatus',
'drive-cleaning' => 'apps::backup::netbackup::local::mode::drivecleaning',
'drive-status' => 'apps::backup::netbackup::local::mode::drivestatus',
'job-status' => 'apps::backup::netbackup::local::mode::jobstatus',
'list-policies' => 'apps::backup::netbackup::local::mode::listpolicies',
'tape-usage' => 'apps::backup::netbackup::local::mode::tapeusage',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Netbackup through local commands (the plugin can use SSH).
=cut

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -29,7 +29,6 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,4 +1,4 @@
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,4 +1,4 @@
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,4 +1,4 @@
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -55,7 +55,6 @@ sub check_options {
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{connector} = $options{custom};
$self->{request} = [

View File

@ -1,4 +1,4 @@
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -55,7 +55,6 @@ sub check_options {
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{connector} = $options{custom};
$self->{request} = [

View File

@ -1,4 +1,4 @@
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -27,7 +27,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -0,0 +1,139 @@
#
# Copyright 2016 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::centreon::sql::mode::countservices;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'poller', type => 1, cb_prefix_output => 'prefix_poller_output', message_multiple => 'All poller hosts/services are ok' }
];
$self->{maps_counters}->{poller} = [
{ label => 'host', set => {
key_values => [ { name => 'hosts' }, { name => 'display' } ],
output_template => 'Number of hosts : %s',
perfdatas => [
{ label => 'total_hosts', value => 'hosts_absolute', template => '%s',
min => 0, label_extra_instance => 1 },
],
}
},
{ label => 'service', set => {
key_values => [ { name => 'services' }, { name => 'display' } ],
output_template => 'Number of services : %s',
perfdatas => [
{ label => 'total_services', value => 'services_absolute', template => '%s',
min => 0, label_extra_instance => 1 },
],
}
},
];
}
sub prefix_poller_output {
my ($self, %options) = @_;
return "Poller '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-poller:s" => { name => 'filter_poller' },
"centreon-storage-database:s" => { name => 'centreon_storage_database', default => 'centreon_storage' },
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $query = "SELECT instances.name, COUNT(DISTINCT hosts.host_id) as num_hosts, count(DISTINCT services.host_id, services.service_id) as num_services
FROM " . $self->{option_results}->{centreon_storage_database} . ".instances, " . $self->{option_results}->{centreon_storage_database} . ".hosts, " . $self->{option_results}->{centreon_storage_database} . ".services WHERE instances.running = '1' AND instances.instance_id = hosts.instance_id AND hosts.enabled = '1' AND hosts.host_id = services.host_id AND services.enabled = '1' GROUP BY hosts.instance_id";
$options{sql}->connect();
$options{sql}->query(query => $query);
# check by poller
$self->{poller} = {};
while ((my $row = $options{sql}->fetchrow_hashref())) {
if (defined($self->{option_results}->{filter_poller}) && $self->{option_results}->{filter_poller} ne '' &&
$row->{name} !~ /$self->{option_results}->{filter_poller}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $row->{name} . "': no matching filter.", debug => 1);
next;
}
$self->{poller}->{$row->{name}} = { display => $row->{name}, hosts => $row->{num_hosts}, services => $row->{num_services} };
}
if (scalar(keys %{$self->{poller}}) == 0) {
$self->{output}->add_option_msg(short_msg => "No poller found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check the number of hosts/services by poller.
=over 8
=item B<--centreon-storage-database>
Centreon storage database name (default: 'centreon_storage').
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^services$'
=item B<--warning-*>
Threshold warning.
Can be: 'host', 'service'.
=item B<--critical-*>
Threshold critical.
Can be: Can be: 'host', 'service'.
=item B<--filter-poller>
Filter by poller name (regexp can be used).
=back
=cut

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -29,7 +29,6 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '1.0';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -0,0 +1,128 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::listnodes;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use Win32::OLE;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
my %map_state = (
-1 => 'unknown',
0 => 'up',
1 => 'down',
2 => 'paused',
3 => 'joining',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
$self->{nodes} = {};
my $query = "Select * from MSCluster_Node";
my $resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{nodes}->{$name} = { name => $name, state => $state };
}
}
sub run {
my ($self, %options) = @_;
$self->manage_selection();
foreach my $name (sort keys %{$self->{nodes}}) {
$self->{output}->output_add(long_msg => "'" . $name . "' [state = " . $self->{nodes}->{$name}->{state} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List Nodes:');
$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', 'state']);
}
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(disco => 1);
foreach my $name (sort keys %{$self->{nodes}}) {
$self->{output}->add_disco_entry(name => $name, state => $self->{nodes}->{$name}->{state});
}
}
1;
__END__
=head1 MODE
List nodes.
=over 8
=item B<--filter-name>
Filter node name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,150 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::listresources;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use Win32::OLE;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
my %map_state = (
-1 => 'unknown',
0 => 'inherited',
1 => 'initializing',
2 => 'online',
3 => 'offline',
4 => 'failed',
128 => 'pending',
129 => 'online pending',
130 => 'offline pending',
);
my %map_class = (
0 => 'unknown',
1 => 'storage',
2 => 'network',
32768 => 'user',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
$self->{resources} = {};
my $query = "Select * from MSCluster_Resource";
my $resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $class = defined($obj->{ResourceClass}) ? $map_class{$obj->{ResourceClass}} : '-';
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{resources}->{$id} = { name => $name, state => $state, owner_node => $owner_node,
class => $class };
}
}
sub run {
my ($self, %options) = @_;
$self->manage_selection();
foreach my $id (sort keys %{$self->{resources}}) {
$self->{output}->output_add(long_msg => "'" . $self->{resources}->{$id}->{name} .
"' [state = " . $self->{resources}->{$id}->{state} . "]" .
"[owner node = " . $self->{resources}->{$id}->{owner_node} . "]" .
"[class = " . $self->{resources}->{$id}->{class} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List Resources:');
$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', 'state', 'id', 'owner_node', 'class']);
}
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(disco => 1);
foreach my $id (sort keys %{$self->{resources}}) {
$self->{output}->add_disco_entry(name => $self->{resources}->{$id}->{name},
state => $self->{resources}->{$id}->{state},
id => $id,
owner_node => $self->{resources}->{$id}->{owner_node},
class => $self->{resources}->{$id}->{class});
}
}
1;
__END__
=head1 MODE
List resources.
=over 8
=item B<--filter-name>
Filter resource name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,200 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::networkstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Win32::OLE;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'network', type => 1, cb_prefix_output => 'prefix_network_output', message_multiple => 'All networks are ok' }
];
$self->{maps_counters}->{network} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'state' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
} elsif (defined($instance_mode->{option_results}->{unknown_status}) && $instance_mode->{option_results}->{unknown_status} ne '' &&
eval "$instance_mode->{option_results}->{unknown_status}") {
$status = 'unknown';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'state : ' . $self->{result_values}->{state};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
sub prefix_network_output {
my ($self, %options) = @_;
return "Network '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /down|paritioned|unavailable/' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status', 'unknown_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_state = (
-1 => 'unknown',
0 => 'unavailable',
1 => 'down',
2 => 'paritioned',
3 => 'up',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
$self->{network} = {};
my $query = "Select * from MSCluster_Network";
my $resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{ID}) ? $obj->{ID} : $name;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{network}->{$id} = { display => $name, state => $state };
}
}
1;
__END__
=head1 MODE
Check network status.
=over 8
=item B<--filter-name>
Filter interface name (can be a regexp).
=item B<--unknown-status>
Set warning threshold for status (Default: '%{state} =~ /unknown/').
Can used special variables like: %{state}, %{display}
=item B<--warning-status>
Set warning threshold for status (Default: none).
Can used special variables like: %{state}, %{display}
=item B<--critical-status>
Set critical threshold for status (Default: '%{state} =~ /down|paritioned|unavailable/').
Can used special variables like: %{state}, %{display}
=back
=cut

View File

@ -0,0 +1,199 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::nodestatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Win32::OLE;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'node', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All nodes are ok' }
];
$self->{maps_counters}->{node} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'state' }, { name => 'display' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
} elsif (defined($instance_mode->{option_results}->{unknown_status}) && $instance_mode->{option_results}->{unknown_status} ne '' &&
eval "$instance_mode->{option_results}->{unknown_status}") {
$status = 'unknown';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'state : ' . $self->{result_values}->{state};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
return 0;
}
sub prefix_node_output {
my ($self, %options) = @_;
return "Node '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
"warning-status:s" => { name => 'warning_status', default => '%{state} =~ /pause|joining/' },
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /down/' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status', 'unknown_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_state = (
-1 => 'unknown',
0 => 'up',
1 => 'down',
2 => 'paused',
3 => 'joining',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
$self->{node} = {};
my $query = "Select * from MSCluster_Node";
my $resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{node}->{$name} = { display => $name, state => $state };
}
}
1;
__END__
=head1 MODE
Check node status.
=over 8
=item B<--filter-name>
Filter node name (can be a regexp).
=item B<--unknown-status>
Set warning threshold for status (Default: '%{state} =~ /unknown/').
Can used special variables like: %{state}, %{display}
=item B<--warning-status>
Set warning threshold for status (Default: '%{state} =~ /pause|joining/').
Can used special variables like: %{state}, %{display}
=item B<--critical-status>
Set critical threshold for status (Default: '%{state} =~ /down/').
Can used special variables like: %{state}, %{display}
=back
=cut

View File

@ -0,0 +1,244 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::resourcegroupstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Win32::OLE;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'rg', type => 1, cb_prefix_output => 'prefix_rg_output', message_multiple => 'All resource groups are ok' }
];
$self->{maps_counters}->{rg} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'state' }, { name => 'display' }, { name => 'owner_node' }, { name => 'preferred_owners' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
my $instance_mode;
my $instance_current;
sub is_preferred_node {
if (!defined($instance_current->{result_values}->{preferred_owners}) ||
scalar(@{$instance_current->{result_values}->{preferred_owners}}) == 0) {
return 1;
}
foreach my $pref_node (@{$instance_current->{result_values}->{preferred_owners}}) {
if ($pref_node eq $instance_current->{result_values}->{owner_node}) {
return 1;
}
}
return 0;
}
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
$instance_current = $self;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
} elsif (defined($instance_mode->{option_results}->{unknown_status}) && $instance_mode->{option_results}->{unknown_status} ne '' &&
eval "$instance_mode->{option_results}->{unknown_status}") {
$status = 'unknown';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $pref_nodes = 'any';
if (defined($instance_current->{result_values}->{preferred_owners}) &&
scalar(@{$instance_current->{result_values}->{preferred_owners}}) > 0) {
$pref_nodes = join(', ', @{$instance_current->{result_values}->{preferred_owners}});
}
my $msg = 'state : ' . $self->{result_values}->{state} . ' [node: ' . $self->{result_values}->{owner_node} . '] [preferred nodes: ' . $pref_nodes . ']';
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{owner_node} = $options{new_datas}->{$self->{instance} . '_owner_node'};
$self->{result_values}->{preferred_owners} = $options{new_datas}->{$self->{instance} . '_preferred_owners'};
return 0;
}
sub prefix_rg_output {
my ($self, %options) = @_;
return "Resource group '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
"warning-status:s" => { name => 'warning_status', default => 'not is_preferred_node()' },
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /failed|offline/' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status', 'unknown_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_state = (
-1 => 'unknown',
0 => 'online',
1 => 'offline',
2 => 'failed',
3 => 'partial online',
4 => 'pending',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
my $query = "Select * from MSCluster_ResourceGroupToPreferredNode";
my $resultset = $wmi->ExecQuery($query);
my $preferred_nodes = {};
foreach my $obj (in $resultset) {
use Data::Dumper;
# MSCluster_ResourceGroup.Name="xxx"
if ($obj->GroupComponent =~ /MSCluster_ResourceGroup.Name="(.*?)"/i) {
my $rg = $1;
next if ($obj->PartComponent !~ /MSCluster_Node.Name="(.*?)"/i);
my $node = $1;
$preferred_nodes->{$rg} = [] if (!defined($preferred_nodes->{$rg}));
push @{$preferred_nodes->{$rg}}, $node;
}
}
$self->{rg} = {};
$query = "Select * from MSCluster_ResourceGroup";
$resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{rg}->{$id} = { display => $name, state => $state, owner_node => $owner_node,
preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] };
}
}
1;
__END__
=head1 MODE
Check resource group status.
=over 8
=item B<--filter-name>
Filter resource group name (can be a regexp).
=item B<--unknown-status>
Set warning threshold for status (Default: '%{state} =~ /unknown/').
Can used special variables like: %{state}, %{display}, %{owner_node}
=item B<--warning-status>
Set warning threshold for status (Default: 'not is_preferred_node()').
Can used special variables like: %{state}, %{display}, %{owner_node}
=item B<--critical-status>
Set critical threshold for status (Default: '%{state} =~ /failed|offline/').
Can used special variables like: %{state}, %{display}, %{owner_node}
=back
=cut

View File

@ -0,0 +1,206 @@
#
# Copyright 2016 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::cluster::mscs::local::mode::resourcestatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Win32::OLE;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'resource', type => 1, cb_prefix_output => 'prefix_resource_output', message_multiple => 'All resources are ok' }
];
$self->{maps_counters}->{resource} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'state' }, { name => 'display' }, { name => 'owner_node' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_threshold_output'),
}
},
];
}
my $instance_mode;
sub custom_threshold_output {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
} elsif (defined($instance_mode->{option_results}->{unknown_status}) && $instance_mode->{option_results}->{unknown_status} ne '' &&
eval "$instance_mode->{option_results}->{unknown_status}") {
$status = 'unknown';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'state : ' . $self->{result_values}->{state} . ' [node: ' . $self->{result_values}->{owner_node} . ']';
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
$self->{result_values}->{owner_node} = $options{new_datas}->{$self->{instance} . '_owner_node'};
return 0;
}
sub prefix_resource_output {
my ($self, %options) = @_;
return "Resource '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"unknown-status:s" => { name => 'unknown_status', default => '%{state} =~ /unknown/' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{state} =~ /failed|offline/' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status', 'unknown_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_state = (
-1 => 'unknown',
0 => 'inherited',
1 => 'initializing',
2 => 'online',
3 => 'offline',
4 => 'failed',
128 => 'pending',
129 => 'online pending',
130 => 'offline pending',
);
sub manage_selection {
my ($self, %options) = @_;
# winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\.\root\mscluster
my $wmi = Win32::OLE->GetObject('winmgmts:root\mscluster');
if (!defined($wmi)) {
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
$self->{output}->option_exit();
}
$self->{resource} = {};
my $query = "Select * from MSCluster_Resource";
my $resultset = $wmi->ExecQuery($query);
foreach my $obj (in $resultset) {
my $name = $obj->{Name};
my $state = $map_state{$obj->{State}};
my $id = defined($obj->{Id}) ? $obj->{Id} : $name;
my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-';
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$name !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
next;
}
$self->{resource}->{$id} = { display => $name, state => $state, owner_node => $owner_node };
}
}
1;
__END__
=head1 MODE
Check resource status.
=over 8
=item B<--filter-name>
Filter resource name (can be a regexp).
=item B<--unknown-status>
Set warning threshold for status (Default: '%{state} =~ /unknown/').
Can used special variables like: %{state}, %{display}
=item B<--warning-status>
Set warning threshold for status (Default: none).
Can used special variables like: %{state}, %{display}, %{owner_node}
=item B<--critical-status>
Set critical threshold for status (Default: '%{state} =~ /failed|offline/').
Can used special variables like: %{state}, %{display}, %{owner_node}
=back
=cut

View File

@ -0,0 +1,53 @@
#
# Copyright 2016 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::cluster::mscs::local::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-nodes' => 'apps::cluster::mscs::local::mode::listnodes',
'list-resources' => 'apps::cluster::mscs::local::mode::listresources',
'network-status' => 'apps::cluster::mscs::local::mode::networkstatus',
'node-status' => 'apps::cluster::mscs::local::mode::nodestatus',
'resource-status' => 'apps::cluster::mscs::local::mode::resourcestatus',
'resourcegroup-status' => 'apps::cluster::mscs::local::mode::resourcegroupstatus',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Microsoft Cluster Service.
=cut

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -65,12 +65,12 @@ sub check_options {
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*?),(.*)$/) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload option '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
$self->{output}->option_exit();
}
my ($section, $status, $filter) = ($1, $2, $3);
if ($self->{output}->is_litteral_status(status => $status) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload status '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
$self->{output}->option_exit();
}
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -72,12 +72,12 @@ sub check_options {
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*?),(.*)$/) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload option '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
$self->{output}->option_exit();
}
my ($section, $status, $filter) = ($1, $2, $3);
if ($self->{output}->is_litteral_status(status => $status) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload status '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
$self->{output}->option_exit();
}
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -74,7 +74,7 @@ sub check_options {
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = "/search/issues?q=state:open+repo:" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository};
$self->{option_results}->{url_path} = "/search/issues?q=state:open+is:issue+repo:" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository};
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
$self->{option_results}->{url_path} .= "+label:" . $self->{option_results}->{label};
}

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -26,6 +26,7 @@ use strict;
use warnings;
use centreon::plugins::http;
use JSON;
use Data::Dumper;
sub new {
my ($class, %options) = @_;
@ -79,8 +80,7 @@ sub run {
};
if ($@) {
use Data::Dumper;
$self->{output}->add_option_msg(short_msg => "Cannot decode json response");
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
$self->{output}->output_add(long_msg => Data::Dumper::Dumper(), debug => 1);
$self->{output}->option_exit();
}
@ -93,11 +93,14 @@ sub run {
short_msg => sprintf("%d forks - %d watchers - %d stars", $forks, $watchers, $stars));
$self->{output}->perfdata_add(label => 'forks',
value => $forks);
value => $forks,
min => 0);
$self->{output}->perfdata_add(label => 'watchers',
value => $watchers);
value => $watchers,
min => 0);
$self->{output}->perfdata_add(label => 'stars',
value => $stars);
value => $stars,
min => 0);
$self->{output}->display();
$self->{output}->exit();
@ -143,6 +146,8 @@ Specify password
=item B<--timeout>
Threshold for HTTP timeout (Default: 5)
=back
=cut

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -65,12 +65,12 @@ sub check_options {
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*)$/) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload option '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
$self->{output}->option_exit();
}
my ($section, $status, $filter) = ('status', $1, $2);
if ($self->{output}->is_litteral_status(status => $status) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong treshold-overload status '" . $val . "'.");
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
$self->{output}->option_exit();
}
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -28,7 +28,6 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -157,6 +157,10 @@ Specify https if needed (Default: 'http')
Set path to get Jenkins information
=item B <--credentials>
Required to use username/password authentication method
=item B<--username>
Specify username for API authentification

View File

@ -1,5 +1,5 @@
#
# Copyright 2015 Centreon (http://www.centreon.com/)
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
@ -29,7 +29,6 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '0.1';
%{$self->{modes}} = (

Some files were not shown because too many files have changed in this diff Show More