Service Management query
As a tenant administrator or an editor, you can use the Service Management query type to fetch the services data in your environment.
For more information, see Using MySQL in Grafana .
This query requires the following data:
Field | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Query Type | Use this field to select the query type | ||||||||||||||||||||||||
Type | Use one of the following options:
| ||||||||||||||||||||||||
Format As | Use one of the following options:
| ||||||||||||||||||||||||
Header | Add additional header properties in the request. Use the add icon to add a header. Depending on your selection, add the remaining details. Use the hide icon to prevent the headers from appearing in the panel. Use the add icon at the end of the field to add multiple headers. Select one of the following options:
| ||||||||||||||||||||||||
Option | Select details for the following options:
| ||||||||||||||||||||||||
Form | Select a clause to group your data in the panel. | ||||||||||||||||||||||||
Column | Use the icon next to Column to select a column from the available list. Depending on your selection, add the remaining details for the Column. Use the icon to prevent the columns from appearing in the panel. Use the icon at the end of the field to add multiple statements. | ||||||||||||||||||||||||
Where | Use the icon to add a calculation. Depending on your selection, add the remaining details. Use the icon to prevent the columns from appearing in the panel. Use the icon at the end of the field to add multiple statements. | ||||||||||||||||||||||||
Group By | Select the values to group items on your panels together. Use the icon to prevent these values from appearing in the panel. Use the icon at the end of the field to add multiple statements. | ||||||||||||||||||||||||
Having | Use the icon to add a calculation. Depending on your selection, add the remaining details. Use the icon to prevent the calculation appearing in the panel. Use the icon at the end of the field to add multiple statements. | ||||||||||||||||||||||||
Order By | Select an ascending or descending order to sort items in the panel. Use the icon to prevent these values appearing in the panel. Use the icon at the end of the field to add multiple statements. | ||||||||||||||||||||||||
Calculated Field | As a tenant administrator or editor, you can add one or more predefined, calculated fields to the service management query without writing any SQL script. Currently, the following calculated fields are supported by their respective IT service management modules:
Use the icon to prevent these values appearing in the panel. Use the icon at the end of the field to add multiple calculated fields. For more information about the supported calculated field queries, see Creating reports with advanced database functions by using Advanced Authoring. |
Example - Average open incident age
View the average open incident age in a selected time range. This query is of the type SQL, with the output in Table format.
SELECT
AVG(DATEDIFF('day',`HPD:Help Desk`.`Submit Date`, CurrentDate())) AS C1
FROM `HPD:Help Desk`
WHERE `HPD:Help Desk`.`Status` < 'Resolved'
and `HPD:Help Desk`.`Company` In ($company)
and (`HPD:Help Desk`.`Assigned Group` In ($AssignedGroup))
and (`HPD:Help Desk`.`Priority` In ($priority))
and (`HPD:Help Desk`.`Submit Date` >= $__from/1000 and `HPD:Help Desk`.`Submit Date` <= $__to/1000)
Example - Calculated fields for incident management
View the total number of incidents, open incidents, and MTTR by submitter and status. This query is of the type SQL, with the output in Table format.
SELECT DISTINCT
`HPD:Help Desk`.`Submitter` AS C1,
`HPD:Help Desk`.`Status` AS C2,
COUNT(`HPD:Help Desk`.`Incident Number`) AS Total_Incidents,
SUM(CASE WHEN `HPD:Help Desk`.`Status`<'Resolved' then 1 ELSE 0 END) AS Open_Incidents,
AVG(DateDiff('ss',`HPD:Help Desk`.`Submit Date`,`HPD:Help Desk`.`Last Resolved Date`)) AS MTTR
FROM
`HPD:Help Desk`
GROUP BY
`Submitter`,
`Status`
LIMIT 100
Example - Calculated fields for change management
View the total number of changes, open changes, and emergency changes by submitter. This query is of the type SQL, with the output in Table format.
SELECT DISTINCT
`CHG:Infrastructure Change`.`Submitter` AS C1,
`CHG:Infrastructure Change`.`Change Request Status` AS C2,
COUNT(`CHG:Infrastructure Change`.`Infrastructure Change ID`) AS Total_Changes,
SUM(CASE WHEN `CHG:Infrastructure Change`.`Change Request Status` > 'Draft' AND `CHG:Infrastructure Change`.`Change Request Status` > 'Completed' THEN 1 ELSE 0 END) AS Open_Changes,
SUM(CASE WHEN `CHG:Infrastructure Change`.`Change Timing` = 'Emergency' then 1 ELSE 0 END) AS Emergency_Changes
FROM
`CHG:Infrastructure Change`
GROUP BY
`Submitter`,
`Status`
LIMIT 100
Example - Calculated fields for problem management
View the total number of problems, major problems, and resolved problems by submitter. This query is of the type SQL, with the output in Table format.
SELECT DISTINCT
`PBM:Problem Investigation`.`Submitter` AS C1,
`HPD:Help Desk`.`Status` AS C2,
COUNT(`PBM:Problem Investigation`.`Problem Investigation ID`) AS Total_problems,
SUM(CASE WHEN `PBM:Problem Investigation`.`Priority` = 'Critical' THEN 1 ELSE 0 END) AS Major_Problems,
SUM(CASE WHEN `PBM:Problem Investigation`.`Investigation Status` IN ('Completed','Closed') THEN 1 ELSE 0 END) AS Resolved_Problems
FROM
`PBM:Problem Investigation`
GROUP BY
`Submitter`,
`Status`
LIMIT 100
Comments
Query for Example - Average open incident age seems to be incorrect, query fetches details from
CHG:Infrastructure Change
formThis has been corrected and will reflect in the upcoming release.
"Example - Calculated fields for change management" also seems to be incorrect. SUM(CASE WHEN
CHG:Infrastructure Change
.Change Request Status
> 'Draft' ANDCHG:Infrastructure Change
.Change Request Status
> 'Completed' THEN 1 ELSE 0 END) AS Open_Changes, needs to be < 'Completed' to reflect open changesAlso I do not see any sense in adding Incident status to that query. Rather should be Change status:
HPD:Help Desk
.Status
AS C2This has been corrected and will reflect in the upcoming release.
Log in or register to comment.