Griesbacher / histou

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

Support for UOM of nagios plugins / Counter support #6

Closed dpeer77 closed 7 years ago

dpeer77 commented 7 years ago

Hi,

I like to know if you plan adding UOM (Nagios plugins unit of measurement). I use Histou to gather network I/O of docker containers and those values are continous counter of bytes. (like the auto generated template to detect that and show the right data) if not, can you give me a hint where to start and I will try to add it and share( if I make it of course)

Thanks, David

Griesbacher commented 7 years ago

Hi David, I'm not sure if I got your question, but if you want to add the units which were returned by the check, it's implemented. There is a lookup table which converts conmen units to supported "grafana units". Here is an example: https://demo.thruk.org/thruk/cgi-bin/extinfo.cgi?type=2&host=icinga2&service=disk%20%2F&backend=cacb0 - admin/admin Check_disk returns Megabytes and they are converted to Gigabytes. Is it what're looking for?

Greets, Philip

dpeer77 commented 7 years ago

Hi Philip,

Sorry for the late response, was out for few days.

Regarding your reply, I was referring to counters that are always incremented, nagios pref data API mark it as "c" for the measurement unit. Now PNP does it well, plotting only the delta from the last measurement and I just wonder if grafana or histou can do similar....

Thanks, David

Griesbacher commented 7 years ago

Ahh OK, it is not implemented at the moment but it sounds good, seems I've missed that one. Do you have a check, which I can run without special hard/software on a Linuxserver to generate such Perfdata?

dpeer77 commented 7 years ago

I have a plugin that I still working on, that check docker containers stats via remote TCP API... not ready yet but the block IOps are counters that always increase.

But here is a quick and "dirty" example of interface network packets traffic that does what you need:

check_traffic:

#!/bin/sh

INT=$2

NET_RAW=`netstat -i | grep ^$INT`
if [ -z "$NET_RAW" ]; then
    echo "Could not find $INT Interface"
    exit 2
fi

NET_IN=`echo "$NET_RAW" | awk '{print $4}'`
NET_OUT=`echo "$NET_RAW" | awk '{print $8}'`

echo "OK - network traffic is, IN: $NET_IN OUT: $NET_OUT | ${INT}_IN=${NET_IN}c;; ${INT}_OUT=${NET_OUT}c;;"
exit 0

to run it, ./check_traffic -i eth0

Example output: OK - network traffic is, IN: 4965649 OUT: 5456768 | eth0_IN=4965649c;; eth0_OUT=5456768c;;

Many thanks, David

sni commented 7 years ago

Or just use:

echo "TIME OK - $(date)|seconds=$(date +%s)c;;;;"

This should roughly result in a graph showing seconds at a 1 second per second interval :-)

Griesbacher commented 7 years ago

That would be too easy :-D

I'll have a look at it, how to implement it best, because it breaks with the current handling of units.

dpeer77 commented 7 years ago

Yeh :-) what ever works for you.

Thanks again, David

sni commented 7 years ago

If influxdb has a rate() function, then you could just add a exception for the unit "c" and use a rate function in the default template. Maybe derivative() like in https://github.com/influxdata/influxdb/issues/4081 does the trick already.

Griesbacher commented 7 years ago

Yes I was thinking about that too, but that requires that the query is dependent on the unit, which is current not implemented.

The result will be something like this, for the time check: unbenannt (At the beginning, I was impatient)

sni commented 7 years ago

looks good :-)

Griesbacher commented 7 years ago

I've made a release which should satisfy this issue. The panels in the default template are using difference, when the unit is c: counter

There's just one thing, which is not so pretty, due to the 'c' in the perflables you've got no unit in the graph... but if you write your own template, e.g. for the time check you could set your unit hardcoded to seconds. Then you would see that my check interval is not just 60 but 60s.

dpeer77 commented 7 years ago

Thank you very much! You are super :-)

Griesbacher commented 7 years ago

Your welcome!