Forum Discussion
You do not need to have the SPID in the WHERE statement of your sql query. You could, but you’d have to change from BATCHSCRIPT to SCRIPT, which would spawn an individual task on the collector for each SPID and you don’t want to do that.
BATCHSCRIPT lets you execute one query and return all the data at once, for all the instances. I assumed you needed the database name in your SQL query to return the right SPIDs. If you don’t need that, don’t have a where statement at all. Just query all the SPIDs and return all the data for all the SPIDs.
You don’t need a different datasource for cmd and time_blocked. If they were both numerical, you’d have separate datapoints. So you’d have a datapoint for blocked, a datapoint for cmd, and a datapoint for time_blocked.
- Blocked is already numerical, so you’re good there.
- cmd is not numerical, so you can’t put it in a datapoint. The best you could do would be to put it in an instance level property (which could be used for grouping if you wanted).
- time_blocked is almost numerical. In the script above, I coded how you could translate the time_blocked to a numerical value that could then be stored in the datapoint.
Related Content
- 2 years ago
- 3 days ago
- 2 years ago