From b395c824bd9c6188dca1eae1f031f4f1ad6380ce Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 31 May 2019 09:08:47 +0200 Subject: [PATCH] add function in catalog --- centreon/plugins/templates/catalog_functions.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/centreon/plugins/templates/catalog_functions.pm b/centreon/plugins/templates/catalog_functions.pm index 9dee196ab..9e0cf76ab 100644 --- a/centreon/plugins/templates/catalog_functions.pm +++ b/centreon/plugins/templates/catalog_functions.pm @@ -25,7 +25,7 @@ use warnings; use Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(catalog_status_threshold); +our @EXPORT_OK = qw(catalog_status_threshold catalog_status_calc); sub catalog_status_threshold { my ($self, %options) = @_; @@ -59,6 +59,16 @@ sub catalog_status_threshold { return $status; } +sub catalog_status_calc { + my ($self, %options) = @_; + + foreach (keys %{$options{new_datas}}) { + if (/^$self->{instance}_(.*)/) { + $self->{result_values}->{$1} = $options{new_datas}->{$_}; + } + } +} + 1; __END__