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. :]
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.
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?
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.