Mikesch-mp / icingaweb2-module-grafana

Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
https://icinga.com/community/
GNU General Public License v2.0
241 stars 95 forks source link

No Data in Graph of Icinga Performance Graph and Grafana #277

Closed e36Alex closed 3 years ago

e36Alex commented 3 years ago

Hello!

I am new to Icinga2 and InfluxDB and got a problem displaying the Performance Graph. --> Icinga writes successfully into InfluxDB-Bucket --> Grafana can successfully read the data from InfluxDB-Bucket --> But i just get emtpy graphs in Icinga and Grafana

Expected Behavior

Data should be shown in the graphs.

Current Behavior

Steps to Reproduce (for bugs)

  1. Icinga writes successfully into InfluxDB-Bucket: grafik

  2. Grafana can successfully read the data from InfluxDB-Bucket grafik

  3. But i just get emtpy graphs in Icinga and Grafana grafik

grafik http://grafana.xxx.de:3000/d/IGce-p7nk/icinga2-default?var-hostname=xxx.domain.de&var-service=check_ping4&var-command=ping4&from=now-3h&to=now&orgId=1&viewPanel=1

grafik

Context

Your Environment

I am using the following setup:

grafik

grafik

grafik

Mikesch-mp commented 3 years ago

Did you install the grafana renderer plugin ?

e36Alex commented 3 years ago

Yes, installed it. Sorry i missed to mention it. For the import of dashboards I used the templates from this repo.

e36Alex commented 3 years ago

Any other idea, what I could check to get it running? I am wondering that even in grafana i just get "no data". Could there be anything wrong in my template?

cthiemann commented 3 years ago

I ran into the same issue this week and it looks like it's because we're using InfluxDB 2.x (i.e., Flux query language instead of InfluxQL). When you edit the dashboard's panel and add the following query, I at least get the ping stats:

from(bucket: v.defaultBucket)
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["hostname"] == "${hostname}" and r["_measurement"] == "hostalive")
  |> filter(fn: (r) => r["_field"] == "value")
  |> aggregateWindow(every: v.windowPeriod, fn: mean)
  |> yield(name: "mean")

However, they are just a series of dots (not connected lines) and it's showing the hostalive ping stats for every service (unsurprisingly, since I don't filter for "${service}" anywhere).

I don't know Grafana/Flux well enough to fix this myself, so I'll stick with InfluxDB 1.x for now. Support for InfluxDB 2.x in Icinga2 is fairly new as well, I think, but maybe @Mikesch-mp is already working on porting the templates to influxdb2?

haytxy commented 3 years ago

hello,

  1. install and enable Icinga influxdb2 writer.
  2. In influxdb v2 create a proper bucket for Icinga with the desired retention settings.
  3. use this instruction to create compatible influx user and database settings pointing to already created bucket for Icinga. Those settings you will be use in the Grafana configuration for data source influxdb. https://www.netways.de/blog/2021/01/28/icinga2-und-influx2-so-bringen-wir-beide-zum-reden/
  4. In the Grafana configuration for data source influxdb use InfluxQL.
  5. in Icinga2 web configurations for Grafana you should place user and password for Grafana, not Influxdb token.

Marcin

cthiemann commented 3 years ago

Brilliant, I didn't know about the v1 compatibility mode!

The most recent Icinga2 version with Influxdb2Writer can write to InfluxDB without it, but creating v1 API mappings fixed the "no data" problem in my Grafana graphs. I slightly adapted your instructions for this:

I hope this will be useful to fellow internet travellers sent here by search engines.

Thanks for your help!

e36Alex commented 3 years ago

Thanks for your help! I tried it as @cthiemann mentioned in his last post and it works fine!

8191 commented 2 years ago

This should be mentioned in the installation instructions, or at least the issue kept open until documented well…