From 176ce337dbc4a44a074a38e6f3312490ccd28209 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Mon, 16 Feb 2015 10:15:55 +0100 Subject: [PATCH] Fix #6132 --- centreon/plugins/statefile.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/centreon/plugins/statefile.pm b/centreon/plugins/statefile.pm index 125ab9bf4..afa65334f 100644 --- a/centreon/plugins/statefile.pm +++ b/centreon/plugins/statefile.pm @@ -53,6 +53,7 @@ sub new { { "memcached:s" => { name => 'memcached' }, "statefile-dir:s" => { name => 'statefile_dir', default => $default_dir }, + "statefile-suffix:s" => { name => 'statefile_suffix', default => '' }, "statefile-concat-cwd" => { name => 'statefile_concat_cwd' }, "statefile-storable" => { name => 'statefile_storable' }, }); @@ -95,7 +96,8 @@ sub check_options { sub read { my ($self, %options) = @_; $self->{statefile_dir} = defined($options{statefile_dir}) ? $options{statefile_dir} : $self->{statefile_dir}; - $self->{statefile} = defined($options{statefile}) ? $options{statefile} : $self->{statefile}; + $self->{statefile} = defined($options{statefile}) ? $options{statefile} . $options{option_results}->{statefile_suffix} : + $self->{statefile} . $options{option_results}->{statefile_suffix}; if (defined($self->{memcached})) { # if "SUCCESS" or "NOT FOUND" is ok. Other with use the file @@ -218,6 +220,10 @@ Memcached server to use (only one server). Directory for statefile (Default: '/var/lib/centreon/centplugins'). +=item B<--statefile-suffix> + +Add a suffix for the statefile name (Default: ''). + =item B<--statefile-concat-cwd> Concat current working directory with option '--statefile-dir'.