This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How do I convert a SQL query into a proper SWQL custom query widget?

I've got a query that pulls out OpsGenie oncall status results but am not sure how to craft that into a working SWQL query within the widget. Data is generated via an application monitor that uses powershell to write the data from the api call into the Orion DB but not in a way that shows up when I tried to use the custom table widget.

FYI I am new to DBA work so likely have overlooked the obvious.

Below is the SQL query I used to find the entries I'd made. 

SELECT
ccs.ComponentID, de.ComponentStatusID,
de.ColumnSchemaID, de.ColumnType, de.ColumnDisabled, de.ColumnName, de.ColumnLabel,
de.ColumnThresholdWarning, de.ColumnThresholdCritical, de.ColumnThresholdOperator,
de.ColumnComputeBaseline, de.ColumnUseBaseline, de.ColumnWarningFormula, de.ColumnCriticalFormula,
de.ColumnBaselineFrom, de.ColumnBaselineTo, de.ColumnBaselineApplied, de.ColumnBaselineApplyError,
de.ColumnWarningPolls, de.ColumnWarningPollsInterval, de.ColumnCriticalPolls, de.ColumnCriticalPollsInterval,
de.RowNumber, de.AvgNumericData AS NumericData, de.StringData,
de.ErrorCode, ec.ErrorDescription, de.OSErrorCode, de.StatusCode, sc.StatusDescription, de.StatusCodeType, de.ErrorMessage
FROM APM_DynamicEvidence AS de WITH(NOLOCK)
JOIN APM_CurrentComponentStatus AS ccs on ccs.ComponentStatusID = de.ComponentStatusID
LEFT JOIN APM_ErrorCode AS ec ON ec.ID = de.ErrorCode
LEFT JOIN APM_StatusCodeType AS sct ON sct.ID = de.StatusCodeType
LEFT JOIN APM_StatusCode AS sc ON sc.ID = de.StatusCode AND sc.StatusCodeTypeID = de.StatusCodeType
WHERE ccs.ComponentID =
  • Have you installed SWQL studio yet? Its bundled with the Orion SDK and its pretty much fundamental in making swql widgets.

    Basically to convert this you just need to find the SWQL table that is equivalent to the tables/views used in your SQL query.
    apm_dynamicEvidence would be orion.apm.dynamicEvidence. MOST tables have a 1 to 1 equivalent but there are a few exceptions you run into.