Query-generated Annotations in Annotation Panel

  • What Grafana version and what operating system are you using?
    Grafana 9.0.3 (self-hosted) - Centos 8 Stream

  • What are you trying to achieve?
    Displaying annotations queried from a MySQL database in both a Time Series panel and an Annotations panel.

  • How are you trying to achieve it?
    Dashboard SQL query called “annotations” extracts messages sent by monitoring system in the format needed for query-based annotations supplying time_sec and text.

  • What happened?
    Annotations are displayed correctly in Time Series panel, but not in Annotations panel. Only manually-entered annotations appear in the Annotations panel.

  • What did you expect to happen?
    It seems that all annnotations should appear on the Annotations panel, whether query-based or manually-entered.

  • Can you copy/paste the configuration(s) that you are having problems with?

    • Dashboard query called “Notifications”:
SELECT 
  UNIX_TIMESTAMP(start_time) as time_sec, 
  output as text
FROM icinga_notifications n JOIN icinga_objects o ON n.object_id = o.object_id
WHERE $__timeFilter(start_time) 
  AND o.name1 = $sel_hostname 
  AND o.objecttype_id = 1
  AND o.is_active = 1
ORDER BY start_time ASC
LIMIT 100

$sel_hostname is a variable allowing the viewer to select a specific host.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors.

  • Did you follow any online instructions? If so, what is the URL?

1 Like

@jwilliams4 there’s a discussion about this in github feature requests here. With the way it is currently implemented only annotations in the grafana database are able to be shown in the list - which means only manually created ones.

I’ve asked the devs to take a look at the github discussion and let me know if this is intentional.

Thanks a bunch @melori.arellano . I think it’s pretty easy to make another panel that shows the query-based annotations, you just have to make it use the same query that the time series panel used. Other than it being additional space consumed on the dashboard that’s probably a sufficient solution.

Jeff