Menu Close

A SQL query to get task output data from the OpsDB

Something I wrote to get a report on tasks being run on the OpsDB, and their output:

select tv.Name as TaskName, bme.fullname as ObjectName, jsv.SubmittedBy, jsv.TimeStarted, jsv.TimeFinished, jsv.Output, tv.Description as TaskDescription
from JobStatusView jsv
inner join TaskView tv on jsv.MonitoringTaskId = tv.Id
inner join BaseManagedEntity bme on jsv.TargetMonitoringObjectId = bme.BaseManagedEntityId
order by TimeStarted DESC

This could be used in a report, to email task output status on a schedule, if this was desired.  All of this information is fully available in the console, under the “Task Status” view.

Leave a Reply

Your email address will not be published.