Monitoring SQL
Hi,
I want to monitor that my SQL database is up using the ODBCSQL check.
I have completed the ODBC Connection String - Driver, Servername, Database, Login and Password - and get a staus 'OK' when I run the test. (and a down if the password or database name is wrong).
I'm having problems with the SQL statement though...
I'm wanting just a simple query to the database to ensure its up - nothing more.
But whatever I type in SQL Statement or fieldname returns an 'OK'
Can you give me an example of a statement to use, and at least something to show it is actually querying the DB?
All I prove so far is the login name and password are ok.
Thanks
I want to monitor that my SQL database is up using the ODBCSQL check.
I have completed the ODBC Connection String - Driver, Servername, Database, Login and Password - and get a staus 'OK' when I run the test. (and a down if the password or database name is wrong).
I'm having problems with the SQL statement though...
I'm wanting just a simple query to the database to ensure its up - nothing more.
But whatever I type in SQL Statement or fieldname returns an 'OK'
Can you give me an example of a statement to use, and at least something to show it is actually querying the DB?
All I prove so far is the login name and password are ok.
Thanks
This discussion has been closed.
Comments
select name from sysusers where name='dbo'
Every database has a dbo user, so therefore if the check cannot resolve that query the database must be unavailalbe.
In your case, by modifying your SQL statement to a COUNT statement where name = 'dbo' and to set the value to alert on to less than one
Should do the trick.
However I see a good point raised here in terms of either doing a field comparison (like it is now) or a recordset verification (meaning if at least one record is returned then OK otherwise DOWN)
I now get a status reply of 1, and a zero when I take the database offline. - along with the alert the Database is down.
Good work!
Thanks