Exploring the Telegraf Database via InfluxCLI
1. Launch the InfluxCLI
Use the CLI on your local machine to connect to your InfluxCloud instance or cluster by
entering the following command from your terminal, filling in
<your_InfluxCloud_hostname>
with
your InfluxCloud hostname AND adding the -precision rfc3339 to the usual connection string:
influx -host <your host name> -port 8086 -username $INFLUX_USERNAME -password $INFLUX_PASSWORD -ssl -precision rfc3339
Notes:
If you set the INFLUX_USERNAME and INFLUX_PASSWORD environment variables,
you can eliminate them from your connection string.
Do not include the ‘https://’ or port as part of the host name.
Specifying -precision rfc3339
tells the CLI to format timestamps
as YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ
(more on timestamps to come).
Specifying -ssl
tells the CLI to use HTTPS
for requests.
For more CLI configurations, see the
InfluxDB CLI/Shell
documentation.
2. Explore Databases and Measurements
Execute InfluxQL’s SHOW DATABASES
command in the CLI to see your new database:
> SHOW DATABASES
name: databases
---------------
name
state_fair_db
telegraf
Check out the data in your new database with the following queries:
> USE telegraf
Using database telegraf
> SHOW MEASUREMENTS
name: measurements
------------------
name
cpu
mem
> SELECT usage_idle FROM cpu WHERE cpu='cpu-total' LIMIT 4
name: cpu
---------
time usage_idle
2016-04-07T00:56:10Z 99.89999999999782
2016-04-07T00:56:20Z 99.89999999999782
2016-04-07T00:56:30Z 99.89999999999782
2016-04-07T00:56:40Z 100
The usage_idle
field in the measurement cpu
shows the idle cpu percentage
on your local machine.
By default, Telegraf collects points every ten seconds; this is a configurable
setting.
You’ve now successfully configured Telegraf to collect data and write data to InfluxCloud. To learn more about the system metrics Telegraf is sending to your instance or cluster, as well as more information about what you can do with Telegraf see our Telegraf documentation.