Monitoring SQL

[Deleted User][Deleted User]
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

Comments

  • AdministratorAdministrator
    What is your SQL statement and your rule definition?
  • [Deleted User][Deleted User]
    I want to use a generic query so I can run the same test on all the SQL databases....so



    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.
  • AdministratorAdministrator
    Currently it verifies against a numeric value: meaning you need to enter the field name and the value it is compared against.



    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)
  • [Deleted User][Deleted User]
    It worked!



    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
  • AdministratorAdministrator
    Glad it is sorted out. I have asked to improve the help file on this check to make it clearer.
This discussion has been closed.