From 1f40958869a835c9e28874bddc3fac35c5954788 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Fri, 21 Feb 2014 11:31:20 +0100 Subject: [PATCH] Refs #5213 --- apps/iis/local/mode/applicationpoolstate.pm | 2 +- centreon/plugins/statefile.pm | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/iis/local/mode/applicationpoolstate.pm b/apps/iis/local/mode/applicationpoolstate.pm index 2a4152e48..94514e069 100644 --- a/apps/iis/local/mode/applicationpoolstate.pm +++ b/apps/iis/local/mode/applicationpoolstate.pm @@ -142,7 +142,7 @@ sub check_auto { } $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}, short_msg => "Service '" . $name . "' is " . $state_map{$state}); } diff --git a/centreon/plugins/statefile.pm b/centreon/plugins/statefile.pm index 7077757a5..3a4f6c200 100644 --- a/centreon/plugins/statefile.pm +++ b/centreon/plugins/statefile.pm @@ -37,6 +37,8 @@ package centreon::plugins::statefile; use Data::Dumper; use vars qw($datas); +my $default_dir = '/var/lib/centreon/centplugins'; + sub new { my ($class, %options) = @_; my $self = {}; @@ -46,7 +48,8 @@ sub new { $options{options}->add_options(arguments => { "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); } @@ -69,6 +72,10 @@ sub check_options { Memcached::libmemcached::memcached_server_add($self->{memcached}, $options{option_results}->{memcached}); } $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 { @@ -179,6 +186,11 @@ Memcached server to use (only one server). 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 =head1 DESCRIPTION