Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[database::mssql::plugin] --mode=databases-size: returns OK even database not exists #4988

Open
joschi99 opened this issue Apr 9, 2024 · 2 comments

Comments

@joschi99
Copy link
Contributor

joschi99 commented Apr 9, 2024

If you are monitor a non existing MS SQL database using the option --filter-database= the plugin returns OK, when you filter for a non existing database. Example:

centreon_plugins.pl --server=<IP>:<PORT> --username=XXX --password=XXX --plugin=database::mssql::plugin --mode=databases-size --filter-database='ThisIsANonExistingDatabase'
OK:

This is a big issue and in this case the plugin should return CRITICAL or UNKNOWN, but not OK.

@joschi99
Copy link
Contributor Author

are there any news on this?

@lucie-dubrunfaut
Copy link
Contributor

lucie-dubrunfaut commented Jul 17, 2024

Hello :)

This is not a voluntarily generated OK in fact the result table is empty but no error is reported (which in itself is a problem I completely agree). At the end of the result parse (line 372) something like this should be added:

if (scalar(keys %{$self->{databases}}) <= 0 && defined($self->{option_results}->{filter_database}) && $self->{option_results}->{filter_database} ne '') {
        $self->{output}->add_option_msg(short_msg => "No database matching with filter: ".$self->{option_results}->{filter_database});
        $self->{output}->option_exit();
}

(This is a proposition that I was not able to test it on my own.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants