Table of Contents
Introduction
In this tutorial, we get started with InfluxDB. we can use commands with InfluxDB. In the latter-mentioned post, I created a “telegraf” database in InfluxDB.
Let’s know if InfluxDB getting started
Now jump into InfluxDB.
[root@devopsroles.localhost ~]# influx
Connected to http://localhost:8086 version 1.7.4
InfluxDB shell version: 1.7.4
Enter an InfluxQL query
>
View a list of all the databases using the “show databases” command.
> show databases
name: databases
name
----
_internal
netdata
monitoring
telegraf
opentsdb
>
“_internal” is an internal InfluxDB database. To use telegraf database the “use telegraf” command:
> use telegraf
Using database telegraf
Now we are inside of the telegraf database. using the “show measurements” command:
> show measurements
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system
Field Keys in the telegraf database.
> show field keys
name: cpu
fieldKey fieldType
-------- ---------
usage_guest float
usage_guest_nice float
usage_idle float
usage_iowait float
usage_irq float
usage_nice float
usage_softirq float
usage_steal float
usage_system float
usage_user float
name: disk
fieldKey fieldType
-------- ---------
free integer
inodes_free integer
inodes_total integer
inodes_used integer
total integer
used integer
used_percent float
name: diskio
fieldKey fieldType
-------- ---------
io_time integer
iops_in_progress integer
read_bytes integer
read_time integer
reads integer
weighted_io_time integer
write_bytes integer
write_time integer
writes integer
name: kernel
fieldKey fieldType
-------- ---------
boot_time integer
context_switches integer
entropy_avail integer
interrupts integer
processes_forked integer
name: mem
fieldKey fieldType
-------- ---------
active integer
available integer
available_percent float
buffered integer
cached integer
commit_limit integer
committed_as integer
dirty integer
free integer
high_free integer
high_total integer
huge_page_size integer
huge_pages_free integer
huge_pages_total integer
inactive integer
low_free integer
low_total integer
mapped integer
page_tables integer
shared integer
slab integer
swap_cached integer
swap_free integer
swap_total integer
total integer
used integer
used_percent float
vmalloc_chunk integer
vmalloc_total integer
vmalloc_used integer
wired integer
write_back integer
write_back_tmp integer
name: processes
fieldKey fieldType
-------- ---------
blocked integer
dead integer
idle integer
paging integer
running integer
sleeping integer
stopped integer
total integer
total_threads integer
unknown integer
zombies integer
name: swap
fieldKey fieldType
-------- ---------
free integer
in integer
out integer
total integer
used integer
used_percent float
name: system
fieldKey fieldType
-------- ---------
load1 float
load15 float
load5 float
n_cpus integer
n_users integer
uptime integer
uptime_format string
Tag Keys in the telegraf database.
> show tag keys
name: cpu
tagKey
------
cpu
host
name: disk
tagKey
------
device
fstype
host
mode
path
name: diskio
tagKey
------
host
name
name: kernel
tagKey
------
host
name: mem
tagKey
------
host
name: processes
tagKey
------
host
name: swap
tagKey
------
host
name: system
tagKey
------
host
InfluxDB Queries
How fields and tags work together. For example as below
> select * from cpu where time > now() - 10s
name: cpu
time cpu host usage_guest usage_guest_nice usage_idle usage_iowait usage_irq usage_nice usage_softirq usage_steal usage_system usage_user
---- --- ---- ----------- ---------------- ---------- ------------ --------- ---------- ------------- ----------- ------------ ----------
1557722520000000000 cpu-total devopsroles.localhost 0 0 92.4924924924855 6.106106106081209 0 0 0 0 0.30030030030030713 1.10110110109885
1557722520000000000 cpu0 devopsroles.localhost 0 0 92.4924924924855 6.106106106081209 0 0 0 0 0.30030030030030713 1.10110110109885
> select * from cpu where cpu='cpu-total' and host='devopsroles.localhost' and time > now() - 10s
name: cpu
time cpu host usage_guest usage_guest_nice usage_idle usage_iowait usage_irq usage_nice usage_softirq usage_steal usage_system usage_user
---- --- ---- ----------- ---------------- ---------- ------------ --------- ---------- ------------- ----------- ------------ ----------
1557727830000000000 cpu-total devopsroles.localhost 0 0 96.7967967967239 2.402402402420665 0 0 0 0 0.20020020020020476 0.6006006006006143
> select usage_user,cpu,host from cpu where cpu='cpu-total' and host='devopsroles.localhost' and time > now() - 20s
name: cpu
time usage_user cpu host
---- ---------- --- ----
1557727930000000000 1.6016016016016381 cpu-total devopsroles.localhost
Link Documentation about Influxdb getting started
Series is a “collection of data in InfluxDB’s data structure that share a measurement, tag set, and retention policy.” Thank you for reading the DevopsRoles page!
- Indexing InfluxDB documentation
- Glossary InfluxDB documentation
- Schema Design InfluxDB documentation
Influxdb getting started. Influxdb getting started. Influxdb getting started.