Monitoring SQL Database - inside.
-
- Posts: 10
- Joined: Wed Mar 07, 2018 7:19 am
Re: Monitoring SQL Database - inside.
Thanks a lot mcapra, I have moved to the plugins proposed by you.
When I use the plugin "check_mssql_server.py" everything is good.
But now I have problem with plugin "check_mssql_database.py", typing the same data I get the error:
Any ideas?
When I use the plugin "check_mssql_server.py" everything is good.
Code: Select all
root@ubuntu:/usr/local/nagios/libexec# ./check_mssql_server.py -H x.x.x.x -U 'admin' -P 'pass' -p 1433 --time2connect
OK: Time to connect was 0.0201740264893s|time=0.0201740264893s;;;;
Code: Select all
root@ubuntu:/usr/local/nagios/libexec# ./check_mssql_database.py -H x.x.x.x -U 'admin' -P 'pass' -p 1433 -T 'ah_Area'
(18456, "Login failed for user 'admin'.DB-Lib error message 20018, severity 14:
\nGeneral SQL Server error: Check messages from the SQL Server\
nDB-Lib error message 20002, severity 9:
\nAdaptive Server connection failed (x.x.x.x:1433)\n")
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitoring SQL Database - inside.
Are you sure the user that you are using has full rights for the database you are specifying?Melanie123 wrote:Thanks a lot mcapra, I have moved to the plugins proposed by you.
When I use the plugin "check_mssql_server.py" everything is good.But now I have problem with plugin "check_mssql_database.py", typing the same data I get the error:Code: Select all
root@ubuntu:/usr/local/nagios/libexec# ./check_mssql_server.py -H x.x.x.x -U 'admin' -P 'pass' -p 1433 --time2connect OK: Time to connect was 0.0201740264893s|time=0.0201740264893s;;;;
Any ideas?Code: Select all
root@ubuntu:/usr/local/nagios/libexec# ./check_mssql_database.py -H x.x.x.x -U 'admin' -P 'pass' -p 1433 -T 'ah_Area' (18456, "Login failed for user 'admin'.DB-Lib error message 20018, severity 14: \nGeneral SQL Server error: Check messages from the SQL Server\ nDB-Lib error message 20002, severity 9: \nAdaptive Server connection failed (x.x.x.x:1433)\n")
-
- Posts: 10
- Joined: Wed Mar 07, 2018 7:19 am
Re: Monitoring SQL Database - inside.
Thanks for reply, scottwilkerson.
Yes, I'm sure. I finally gave up with the check_mssql_database.py plugin and came back to check_mssql.
And there is progress.
Now, I have a question about formatting the results of sql queries.
When I use:
I have something like that:
Where and how can I change the formatting so that the result of the plugin would be like:
And "learn" for others: check x times if you are sure to enter good data from the SQL database.
Regards!
Yes, I'm sure. I finally gave up with the check_mssql_database.py plugin and came back to check_mssql.
And there is progress.
Now, I have a question about formatting the results of sql queries.
When I use:
Code: Select all
./check_mssql -H x.x.x.x -U 'sa' -P xxx' -p 1433 -d database -q "SELECT ID_evt, name, evtTime, evtType, ID_tag FROM dbo.table WHERE name = 'alarm' AND ID_evt > 5157"
Code: Select all
OK: Query duration=0.004576 seconds. Query result=5158 Query result=Condition.Alarm Query result=2018-03-22 11:42:37 Query result=3 Query result=299 Query result=5161 Query result=Condition.Alarm Query result=2018-03-22 11:42:48 Query result=2 Query result=299 Query result=5162 Query result=Condition.Alarm Query result=2018-03-22 11:43:38 Query result=3 Query result=298 Query result=5163 Query result=Condition.Alarm Query result=2018-03-22 11:45:22 Query result=3 Query result=331
Code: Select all
OK: Query duration=0.004576 seconds. ID_evt = 5158, name = Condition.Alarm, evtTime = 2018-03-22 11:42:37, evtType = 3, ID_tag = 299
Regards!
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitoring SQL Database - inside.
when using the query function of this plugin, it expects you are going to just retuen a singe value, your query is returning many
example
this would generate a warning if the count was more than 2 and critical if more than 5
There are no options for formatting the output with this plugin.
example
Code: Select all
Example: check_mssql -H myserver -U myuser -P mypass -q "SELECT COUNT(*) FROM mytable" -W 2 -C 5
There are no options for formatting the output with this plugin.