This commit is contained in:
Quentin Garnier 2014-02-21 11:31:20 +01:00
parent 2812fb9fb6
commit 1f40958869
2 changed files with 14 additions and 2 deletions

View File

@ -142,7 +142,7 @@ sub check_auto {
} }
$self->{output}->output_add(long_msg => "Pool '" . $name . "' state: " . $state_map{$state}); $self->{output}->output_add(long_msg => "Pool '" . $name . "' state: " . $state_map{$state});
if ($state_map{$state} !~ /^starting$/i) { if ($state_map{$state} !~ /^started$/i) {
$self->{output}->output_add(severity => $self->{threshold}, $self->{output}->output_add(severity => $self->{threshold},
short_msg => "Service '" . $name . "' is " . $state_map{$state}); short_msg => "Service '" . $name . "' is " . $state_map{$state});
} }

View File

@ -37,6 +37,8 @@ package centreon::plugins::statefile;
use Data::Dumper; use Data::Dumper;
use vars qw($datas); use vars qw($datas);
my $default_dir = '/var/lib/centreon/centplugins';
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = {}; my $self = {};
@ -46,7 +48,8 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"memcached:s" => { name => 'memcached' }, "memcached:s" => { name => 'memcached' },
"statefile-dir:s" => { name => 'statefile_dir', default => '/var/lib/centreon/centplugins' }, "statefile-dir:s" => { name => 'statefile_dir', default => $default_dir },
"statefile-concat-cwd" => { name => 'statefile_concat_cwd' },
}); });
$options{options}->add_help(package => __PACKAGE__, sections => 'RETENTION OPTIONS', once => 1); $options{options}->add_help(package => __PACKAGE__, sections => 'RETENTION OPTIONS', once => 1);
} }
@ -69,6 +72,10 @@ sub check_options {
Memcached::libmemcached::memcached_server_add($self->{memcached}, $options{option_results}->{memcached}); Memcached::libmemcached::memcached_server_add($self->{memcached}, $options{option_results}->{memcached});
} }
$self->{statefile_dir} = $options{option_results}->{statefile_dir}; $self->{statefile_dir} = $options{option_results}->{statefile_dir};
if ($self->{statefile_dir} ne $default_dir && defined($options{option_results}->{statefile_concat_cwd})) {
require Cwd;
$self->{statefile_dir} = Cwd::cwd() . '/' . $self->{statefile_dir};
}
} }
sub read { sub read {
@ -179,6 +186,11 @@ Memcached server to use (only one server).
Directory for statefile (Default: '/var/lib/centreon/centplugins'). Directory for statefile (Default: '/var/lib/centreon/centplugins').
=item B<--statefile-concat-cwd>
Concat current working directory with option '--statefile-dir'.
Useful on Windows when plugin is compiled.
=back =back
=head1 DESCRIPTION =head1 DESCRIPTION