Page 1 of 2
Monitoring SQL Database - inside.
Posted: Fri Mar 16, 2018 9:58 am
by Melanie123
Hello again,
I come with another question from my side.
Specifically, I mean the SQL database.
I have a database on a separate server to which data goes over the TCP/IP port.
I would like (if it is possible) to get inside the sql database from the server Nagios also on the TCP/IP port.
In the database from time to time appear "errors" from my application (defined by me). Can I call a plugin to let Nagios detect this and inform me about it when the line with the keyword "1" appears in the "error" column?
What agent to install?
How can you possibly approach this topic?
I will be grateful for every tips, because I have no idea how to counter it and if it is possible.
Regards!
Re: Monitoring SQL Database - inside.
Posted: Fri Mar 16, 2018 3:18 pm
by npolovenko
Hello,
@Melanie123. I would recommend using one of MySQL query plugins, to query the data table and get the check in a critical state based on specified thresholds. For example, this one:
https://www.monitoring-plugins.org/doc/ ... query.html
cd /usr/local/nagios/libexec/
[root@centos7x64 libexec]# ./check_mysql_query
Must specify a SQL query to run
Usage:
check_mysql_query -q SQL_query [-w warn] [-c crit] [-H host] [-P port] [-s socket]
[-d database] [-u user] [-p password] [-f optfile] [-g group]
It's a standard plugin, so you should already have it in the /usr/local/nagios/libexec/ directory.
Re: Monitoring SQL Database - inside.
Posted: Mon Mar 19, 2018 8:33 am
by Melanie123
Yes, that's it!
But... How can this plugin also support the MS SQL database?
I found "check_mssql" (
https://exchange.nagios.org/directory/P ... ql/details), i think this is what i search.
Re: Monitoring SQL Database - inside.
Posted: Mon Mar 19, 2018 10:27 am
by Melanie123
I configured everything - I think.
And when I tried plugin:
Code: Select all
./check_mssql -H x.x.x.x -U Administrator -P 'xxx' -p 1433 -d test -q "SELECT COUNT(*) FROM test"
I have this:
Code: Select all
CRITICAL: Could not connect to dblib:host=x.x.x.x;dbname=test as Administrator (Exception: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)).
And I have no idea what else to change.
Re: Monitoring SQL Database - inside.
Posted: Mon Mar 19, 2018 12:26 pm
by npolovenko
Re: Monitoring SQL Database - inside.
Posted: Tue Mar 20, 2018 7:18 am
by Melanie123
npolovenko, I tried everything, but nothing changed. Do you have any idea yet?
Re: Monitoring SQL Database - inside.
Posted: Tue Mar 20, 2018 8:20 pm
by mcapra
You might try some of the various Python based plugins for SQL Server:
https://github.com/NagiosEnterprises/ch ... ollection/
This will help identify if it's a SQL Server connection issue, or an issue with the check_mssql plugin you used previously.
Re: Monitoring SQL Database - inside.
Posted: Wed Mar 21, 2018 9:35 am
by tmcdonald
Thanks for the assist,
@mcapra!
@Melanie123, let us know if you have further (related) questions.
Re: Monitoring SQL Database - inside.
Posted: Thu Mar 22, 2018 8:28 am
by Melanie123
Are these plugins compatible with MS SQL 2014?
I found the information in all that they support to the 2008/2012 server version.
Now I have problems with connecting to the SQL server and I'm looking for the source of the problem.
Re: Monitoring SQL Database - inside.
Posted: Fri Mar 23, 2018 8:26 am
by mcapra
Melanie123 wrote:Are these plugins compatible with MS SQL 2014?
I haven't encountered any issues with using these plugins against SQL Server 2014. Admittedly, I haven't tested every possible use of the plugins.
Melanie123 wrote:Now I have problems with connecting to the SQL server and I'm looking for the source of the problem.
Can you share the error message that the plugins are producing? It may give us useful insights for troubleshooting.