How to create tag with more strings enabling filter (Grafana + Telegraf)?

Hello,

I administrate many servers where on every server run from one to many apps. On every server is running Telegraf monitoring OS. In Telegraf I would like to create some multi-tag containing names of all apps. And in Grafana create filter according AppX name.

For example:

  • Telegraf: APPS = "AppName1 AppName2 AppName3 ..."
  • Grafana: Set filter according AppName1 (which can run on multiple servers)

In fact I’m asking because I don’t know how to exactly do it. If is there another way how to do it I would like if somebody tell me about. :]

Many thx!

I guess you store a data in InfluxDB. You can use regexp syntax in Grafana
APPS =~ /.App1./. But bear in mind it’s regexp, so it will select also App10, App11, etc.

It will be better to save it with delimiter, for example APPS="-App1-App2-App3-’ and query APPS =~ /.-App1-./.

IMHO it’s still not a best solution, because you can’t create list of available applications with InfluxDB query. The best option will be inserting of multiple records with different APP names.

Hello Jangaraj,

great thx for your answer. In APPS tag should be AppName (I fixed it in my question). Now example - I have these tags on two servers:

APPS"=‘WAS-K8S-TOMCAT’
APPS"=‘K8S-TOMCAT-INFLUX’

I have this query in Grafana SHOW TAG VALUES FROM system WITH KEY = "APPS" with RegEx /([^-]*)/. But it returns me just K8S and WAS - only first string in the tag.

I’m not possible to create RegEx which returns me all strings. I tried it in Online Simulator (with JavaScript) and it works. Can I ask you for help, please?

I already told you: you can’t create list of all available applications with InfluxDB query with this approach.

Store only one value in the tag; instead of:
value=x,APPS=APP1,APP2
store it as:
value=x,APP=APP1
value=x,APP=APP2

You may have have a lot of problems (grouping by app, …) with your approach.

Yes, you’re right. I’m sorry I needed to confirm it myself and now I found it… very bad bad way :]

I’ll try to describe what I have and what I need. If you have time I appreciate your diea(s):

  • I have around thousand servers.
  • That’s why I need to have one universal configuration file for Telegraf (you don’t want to change it on every servers).
  • My original idea was to have one APPS tag containing all App installed on the server. Which I load from ENV variables. But it doesn’t work.

… is there another way how to have one universal Telegraf configuration file and save values as you wrote?

value=x, APP=AppName1
value=x, APP=AppName2

Build POC with your current approach and you will see if you find any show stopper for your use cases.

You can’t build variable apps with SHOW TAG VALUES FROM system WITH KEY = “APPS”, but you have option to create variable as a static list, which will be managed manually. But if you have thousand servers, then it can be a problem.
Automation tool (puppet, ansible, chef, …) may help you to set proper tags in the configuration file for Telegraf on every server.

Hmmm, it’s not easy to solve. I have to find another solution.

Thx for your advices. :]

Dear Waldauf,

Do you find solution for this? am also having similar situation . Kindly let me know if you have any suggestions

Hello danishv,

I’m sorry but I can’t help you. Finally I chose another solution. But I can’t you say which because I don’t remember it. :]