Grafana + OTRS Integration: Monitoring SLA and IMS Tickets in Real Time
In environments driven by governance and certified by ISO 9001 and ISO 20000 standards, IT ticket management and SLA (Service Level Agreements) compliance must be closely monitored. Traditional use of OTRS provides excellent logging features, but lacks real-time, consolidated visualization dashboards for executive management.
In this article, I show how I structured a transparent integration between the relational database of OTRS and dynamic Grafana dashboards for monitoring the Integrated Management System (IMS).
Data Modeling
To feed Grafana, we directly connect to a read replica of the MySQL/PostgreSQL database of OTRS (the queries below use MySQL syntax). We write SQL queries focused on extracting:
- First response time, from the OTRS column
escalation_response_time, not from the ticket's age. - Volume of open and closed tickets by service queue.
- Tickets whose
escalation_timeis already inside the breach window.
-- Total and closed tickets per queue.
-- In the default OTRS catalog, 2 and 3 are closed successful/unsuccessful.
-- An install that recreated states cannot trust these IDs.
SELECT
queue.name AS 'Queue',
COUNT(ticket.id) AS 'Total',
SUM(CASE WHEN ticket.ticket_state_id IN (2, 3) THEN 1 ELSE 0 END) AS 'Closed'
FROM ticket
JOIN queue ON ticket.queue_id = queue.id
GROUP BY queue.name;
Tickets about to miss the SLA
The per-queue volume query does not say which ticket will breach the window. The red OTRS SLA panel uses escalation_time and escalation_response_time (epoch seconds), not four hours since create_time. In the default catalog, 1 and 4 are new and open.
SELECT t.tn,
q.name AS queue_name,
FROM_UNIXTIME(t.escalation_response_time) AS first_response_deadline,
FROM_UNIXTIME(t.escalation_time) AS solution_deadline
FROM ticket t
JOIN queue q ON q.id = t.queue_id
WHERE t.ticket_state_id IN (1, 4)
AND t.escalation_time > 0
AND t.escalation_time < UNIX_TIMESTAMP(NOW() + INTERVAL 1 HOUR)
ORDER BY t.escalation_time;
In Grafana that query becomes a table panel ordered by the deadline. The alert leaves through the contact point that operations already uses, without waiting for the weekly OTRS report.
Practical Benefits
- Agile Decision Making: With monitors installed in support rooms, the infrastructure team sees incident peaks before they affect the SLA.
- Audit Compliance: Presenting automated and historical dashboards during ISO 9001/20000 audits demonstrates transparency and systemic control.
- Bottleneck Reduction: We easily identify which queues (e.g., SAP B1 ERP support vs. cloud infrastructure) required team reinforcement or first-level (L1) automation.
Related Articles
Modernizing UNIX Monitoring: Collecting Metrics from HP-UX, Solaris, and AIX with Grafana and Prometheus
A practical guide to architecting modern observability dashboards for legacy mission-critical systems using SNMP and exporters.
IT Governance Guidelines: Aligning Operations with ISO Standards
How to create corporate security and infrastructure policies that are in full compliance with ISO 9001, 14001, 45001, and 50001 standards.