TL;DR InfluxDB Tech Tips - Template Variables, Query Building, & User Management in Chronograf

Navigate to:

In this post, we recap some new material that you might have missed in the past week or so. Check in next week for the most interesting TICK-stack related issues, workarounds, how-tos, and Q&A from GitHub, IRC, and the InfluxData Community.

Template variables in Chronograf

Q: I have a tag key with fifteen different tag values and I want to view data for each tag key-value pair on its own graph. I’m using Chronograf’s dashboards to visualize my data - is there a way to do what I want without having to create fifteen different graphs that have nearly identical queries?

A: There is! Starting in version 1.2.0-beta10, Chronograf supports dashboard template variables. Dashboard template variables offer the functionality that you’re looking for; they allow you to alter specific components of a cell’s query without having to navigate away from the dashboard or create several nearly-identical cells.

Here’s an example of a dashboard template variable in action. The template variable :frenchie-name: stores the three tag values (brinkely, princess, and speckles) associated with a specific tag key. Change the data displayed in the dashboard graph by choosing the different tag values from the template variable dropdown.


Query building in Chronograf

Q: I’ve been using Chronograf to create dashboards. I recently upgraded to version 1.2.0-beta9 and I’ve noticed that the raw query editor is missing; I can no longer select the InfluxQL option when creating a new query in the Explorer. Is this feature gone? Can I manually edit a query in Chronograf in the current version?

A: Starting with version 1.2.0-beta9, we’ve effectively merged the raw query editor and the builder. We did this to improve the query creation process and make it more interactive. You can now move seamlessly between using the builder and manually editing the query; when possible, the interface automatically populates the builder with the information that you’ve entered manually.

Here’s an example of how this might work. First, I build a query that selects just the usage_idle field key. Next, I manually add the usage_user field key to the SELECT clause. Notice that the builder automatically updates the Field column with my change. Finally, I use the builder to remove that second usage_user field key.

InfluxDB user management in Chronograf

Q: I’m using Chronograf version 1.2.0-beta10 to manage users in my InfluxDB instance and I’ve noticed that I’m only able to assign admin status to users. The InfluxDB documentation discusses assigning READ and WRITE access to non-admin users - is this something I can do in Chronograf?

I can’t see a way to do it in the Users section on the Admin page. Here’s what my setup looks like:

A: Currently, Chronograf does not support assigning database READ or WRITE access to non-admin users. This is a known issue. As a workaround, grant READ, WRITE, or ALL (READ and WRITE) permissions to non-admin users with the following curl commands, replacing anything inside < > with your own values:

Grant READ permission:

~# curl -XPOST "http://<InfluxDB-IP>:8086/query?u=<username>&p=<password>" --data-urlencode "q=GRANT READ ON <database-name> TO <non-admin-username>"

Grant WRITE permission:

~# curl -XPOST "http://<InfluxDB-IP>:8086/query?u=<username>&p=<password>" --data-urlencode "q=GRANT WRITE ON <database-name> TO <non-admin-username>"

Grant ALL permission:

~# curl -XPOST "http://<InfluxDB-IP>:8086/query?u=<username>&p=<password>" --data-urlencode "q=GRANT ALL ON <database-name> TO <non-admin-username>"

In all cases, a successful GRANT query returns a blank result:

{"results":[{"statement_id":0}]}   <--- Success!

Remove READ, WRITE, or ALL permissions from non-admin users by replacing GRANT with REVOKE in the curl commands above.

What's next:

  • Downloads for the TICK-stack are live on our "downloads" page.
  • Deploy on the Cloud: Get started with a FREE trial of InfluxDB Cloud featuring fully-managed clusters, Kapacitor and Grafana.
  • Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of InfluxDB Enterprise featuring an intuitive UI for deploying, monitoring, and rebalancing clusters, plus managing backups and restores. 
  • Tell Your Story: Over 300 companies have shared their story on how InfluxDB is helping them succeed. Submit your testimonial and get a limited edition hoodie as a thank you.