I may be wrong minded here so feel free to respond with a sanity check. I am trying to find, or modify, an input plugin for Telegraf (using a TIG config) that includes a list of usernames logged in to the system at the time the input plugin runs and constructs a influxdb data string to forward to InfluxDB.
The thought is, graphing the n_unique_users numeric value and as an option being able to hover on a point in the graph and having the tooltip hover list show a list of the usernames associated with the n_unique_users value.
For example, hovering over a point with a value of 3 and the tooltip shows:
lskywalker
bkenobi
dvader
I assumed something like this already existed somehow but I can’t seem to find it. input.system looks at utmp and the data is there but only produces an integer value for n_unique_users and no method of reporting the actual usernames, once per since the value is n_unique_users and not n_users.
Am I not finding a plugin or plugin option that does this already? Am I crazy? I’d think, for example, if you recorded load1 going through the roof you might want to be able to see how many users were logged in at the time and who was logged in.
Thanks to all who read this, and more to anyone that responds.
In general, metrics that Telegraf generates are values you can actually graph (numeric). Hence, the return value is the number of users and not a list of users. Line protocol also does not represent a list of strings very well, and is commonly done by a csv of values (e.g. users n_unique_users=3,users="joe,bob,alice)
Is there a way, given your example of having the list appended in the line protocol output, showing “users” in the tooltip as a tag or something? Like directing Grafana to show $tag_users as the tooltip?
Pardon my questions, I’m a hack at best, and question my own crazy notions sometimes.
No problem with the questions, that’s what this forum is for
Today you would need to use the inputs.exec plugin to be able to collect that data with some external tool or method. For example on linux I could use who | awk '{print $1}' | tr '\n' ',' | tr ',' '\n' in a script:
This part, I’m not so certain about as I’m not a grafana expert but with my last comment you could at least get the data into your data source and go from there.
I’ll mess with a bash script and inputs.exec. input.system looked like it had it already via utmp and just offered the integer value and not an optional csv string of unique usernames.