From 067f3a27177f92f011234ba22c5211d2c0ed9d9c Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 25 Apr 2019 17:35:11 +0200 Subject: [PATCH] + add option for empty sql result in sql-string mode --- centreon/common/protocols/sql/mode/sqlstring.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/centreon/common/protocols/sql/mode/sqlstring.pm b/centreon/common/protocols/sql/mode/sqlstring.pm index 5a7ac9491..d43436b2e 100644 --- a/centreon/common/protocols/sql/mode/sqlstring.pm +++ b/centreon/common/protocols/sql/mode/sqlstring.pm @@ -115,6 +115,7 @@ sub new { "printf-format:s" => { name => 'printf_format' }, "printf-value:s" => { name => 'printf_value' }, "dual-table" => { name => 'dual_table' }, + "empty-sql-string:s" => { name => 'empty_sql_string', default => 'No row returned or --key-column/--value-column do not correctly match selected field' }, }); return $self; @@ -159,7 +160,7 @@ sub manage_selection { } if (scalar(keys %{$self->{rows}}) <= 0) { - $self->{output}->add_option_msg(short_msg => "No row returned or --key-column/--value-column do not correctly match selected field"); + $self->{output}->add_option_msg(short_msg => $self->{option_results}->{empty_sql_string}); $self->{output}->option_exit(); } @@ -211,6 +212,11 @@ Set critical condition (if statement syntax) for status evaluation. Set this option to ensure compatibility with dual table and Oracle. +=item B<--empty-sql-string> + +Set this option to change the output message when the sql statement result is empty. +(Default: 'No row returned or --key-column/--value-column do not correctly match selected field') + =back =cut