Hi all,
I’m adding a few things in my influxdb from telegraf clients and I’m struggling with “string” values.
My linux clients are sending every 48h their
- linux_version (ie “CentOS Linux”)
- pretty_name (ie “Debian GNU/Linux 11 (bullseye)”)
- kernel version (ie “5.10.0-18-amd64”)
Now I’m trying to make a simple “count” of how many machines I have per “linux_version” and displays that in grafana with one gauge per version and the corresponding count.
So something like
Debian Linux: ||||||||||||||| 48
CentOS Linux: |||| 12
SomethingElse: ||3
As flux is not the clearest language, I’m a bit lost and for now the only thing I could get is a table with each machine and it’s “linux_name”.
from(bucket: "servers")
|> range(start: -48h)
|> filter(fn: (r) => r["_measurement"] == "os-information")
|> filter(fn: (r) => r["_field"] == "linux_version")
|> drop(columns: ["_time", "_measurement", "_start", "_stop", "tag1", "_field"])
|> last()
|> group()
-------------------------------------
| Debian GNU/Linux | prod-server |
| Debian GNU/Linux | test-server |
| Debian GNU/Linux | backup-server |
| CentOS Linux | other-server |
| CentOS Linux | file-server |
-------------------------------------
Every time I’m trying to “count()” things, I end up with an unique number.
What should I do to get what I need?
Many thanks in advance!