Navigating InfluxDB CLI

I’ve demonstrated a few InfluxDB commands in my Getting to know InfluxDB and InfluxDB: Retention Policies & Shard Groups posts but though it would be a good idea to write a post completely dedicated to useful CLI commands – so here it is.

SHOW DATABASES

This command is self explanatory. It lists all of your InfluxDB databases:

USE <DATBASE_NAME>

Enters a database so that subsequent commands will be run against it:

SHOW MEASUREMENTS

Gets a list of measurements that reside in a database:

CLAUSES

Clauses are extremely useful when you’re looking for specific information. You can read more about them in InfluxDB’s Data Exploration documentation. Some will be used in the subsequent sections of this post.

SHOW FIELD KEYS

Lists the data that is being recorded in each measurement :

SHOW TAG KEYS

Lists the the tags which are being used in each  measurement :

SHOW TAG VALUES

View tags values:

SHOW SERIES

Lists all series in the database ( measurement, tag keys and tag values):

For example, in the above output  snmp is a measurement,  agent_host, host, hostname and ifName are all key tags and 192.168.0.242, ubuntu, R2 and Fa0/1 are all key values.

SELECT

Displays information that matches your query. Note that both Field Keys and Tag Keys are used in the query below:

Further Reading

The InfluxDB’s Schema Exploration documentation has numerous commands and outputs which are worth taking a look at. The Influx Query Language documentation is also well worth a read.

Knowledge Base

See my Knowledge Base for more information.

As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at will@oznetnerd.com, or drop me a message on Twitter (@OzNetNerd).

Note: This website is my personal blog. The opinions expressed in this blog are my own and not those of my employer.

Leave a Reply

Your email address will not be published. Required fields are marked *