diff --git a/centreon/plugins/script.pm b/centreon/plugins/script.pm index 4f184b2e0..f18494cc8 100644 --- a/centreon/plugins/script.pm +++ b/centreon/plugins/script.pm @@ -93,12 +93,13 @@ sub get_plugin { $self->{options}->set_output(output => $self->{output}); $self->{options}->add_options(arguments => { - 'plugin:s' => { name => 'plugin' }, - 'list-plugin' => { name => 'list_plugin' }, - 'help' => { name => 'help' }, - 'version' => { name => 'version' }, - 'runas:s' => { name => 'runas' }, - 'environment:s%' => { name => 'environment' }, + 'plugin:s' => { name => 'plugin' }, + 'list-plugin' => { name => 'list_plugin' }, + 'help' => { name => 'help' }, + 'ignore-warn-msg' => { name => 'ignore_warn_msg' }, + 'version' => { name => 'version' }, + 'runas:s' => { name => 'runas' }, + 'environment:s%' => { name => 'environment' }, } ); $self->{options}->parse_options(); @@ -249,6 +250,9 @@ sub run { $self->{output}->add_option_msg(short_msg => "Need to specify '--plugin' option."); $self->{output}->option_exit(); } + if (defined($self->{ignore_warn_msg})) { + $SIG{__WARN__} = sub {}; + } $self->check_relaunch(); @@ -292,6 +296,10 @@ Print plugin version. Print a brief help message and exits. +=item B<--ignore-warn-msg> + +Perl warn messages are ignored (not displayed). + =item B<--runas> Run the script as a different user (prefer to use directly the good user).