Griesbacher / histou

Adds templates to Grafana in combination with nagflux
GNU General Public License v2.0
35 stars 16 forks source link

I don't get the idea of templates #17

Closed PiotrKlimek closed 6 years ago

PiotrKlimek commented 6 years ago

I have successfully installed naglux and histou on my machine. I have pretty graphs in my nagios/thruk that can be seen via grafana. But I have a feeling that I miss something. What is the idea of writing own templates, it's unclear to me how to write them and what for.

Is histou "only" a way to generate graphs on demand in grafana? Or maybe there is a way to browse thru all the graphs in some other way? Sorry for stupid question I have already spend a while to configure it and than trying to get the idea using the docker image that you provide. I have also read the prosentation that you make but looks like I'm missing something.

I'd be grateful for enlightenment.

simonmeggle commented 6 years ago

If you are fine with the default graphs, then you won't need custom templates. But I guess you want CPU graphs to look different from the "top 10 error messages in logfile" graph, for example.
A histou template defines how a grafana dashboard looks like. (Don't mix it with "templating" in Grafana.)

If you click on the gear icon in Grafana, you can view the JSON structure of a dashboard. That's the only format Grafana understands to draw a dashboard. In the most simple way, you could simply create and save a Grafana dashboard for hostA, serviceB, hostX, serviceY, ... , ... within Grafana and each dashboard pulls out the correct data from the influxDB. But that does not scale very well.

When you save the JSON structure for ''check_foo'' into a check_foo.simple template file with a rule header which matches exactly those services, you just have to call the histou URL with host and service as parameters and you will be forwarded to grafana which displays the right dashboard. The host/service parameters are passed to the influxDB queries.

If you want to generate advanced dashboards (e.g. create rows for a indeterminable subset of perflabels), create ''check_foo.php", prepend the header (see above) and write PHP code which in the end produces again a valid JSON structure. There are few examples in the default template folder.

Hope that helps.

PiotrKlimek commented 6 years ago

Thank you for your reply. It was very helpful. Now I got the idea.