Can the APM 3.1 SQL User Experience support adhoc queries?
I have a query that works in SQL so I am trying to put it into APM so I can monitor it from there and alert based upon the value returned.
Thanks!
Hello sotherls,You can use any SQL query that works on SQL server itself and returns at least one numeric value. When query is executed, first column in first returned row must be a number and it is stored as statistic for particular monitor.
You can be limited only be used user credentials. If used user has no permission to do something on SQL server, you can't do that from APM either.
Thanks Jiri, that is what I thought but when I run the query below in SQL i get data back but when I put it into the SQL User Experience monitor I get errors:
Query:
select count((availability*100)/100) as UpFROM OPENROWSET('SQLOLEDB','1xx.1xx.1xx.2xx\OVISREPORTER';'MyUserName';'MyPassword', 'SELECT * FROM OVOPS.dbo.Probes') twhere probename = 'exchange' and target like '9%'
Results: 68
If I try to do the same in APM and fill in all fields except for credentials (none) I get this error:
Testing on node <servername>: failed with 'NotAvailable' status Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
If I try this using the credentials which match in the adhoc query I get this error:
Testing on node <servername>: failed with 'NotAvailable' status Cannot open database requested in login 'Probes'. Login fails. Login failed for user 'MyUserName'.
Ideas?
There are obviously some permission issues. SQL monitor has option to use SQL or Windows authentication. Have you tried second option here?
Just to be clear, you are connecting to one database and there in SQL query you try to open connection to another database using different credentials in OPENROWSET, right? Why don't you connect directly to the other DB and query it without using OPENROWSET?