InfluxDB

From Indie IT Wiki
Jump to: navigation, search

Introduction

InfluxDB is an open-source time series database developed by InfluxData.

It is written in Go and optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics.

It is often used with Telegraf or Collectd to gather system information.

https://www.influxdata.com

Download

https://portal.influxdata.com/downloads

Installation

https://docs.influxdata.com/influxdb

https://docs.influxdata.com/influxdb/v1.3/introduction/installation/

https://hostpresto.com/community/tutorials/how-to-install-influxdb-on-ubuntu-14-04/

Documentation

https://docs.influxdata.com/influxdb/v1.3/introduction/getting_started/

Administration

http://localhost:8083/

...or...

influx

Databases

Top right > Drop down menu > Telegraf

...or...

show databases
select <database>
show fields keys

Queries

show measurements
select * from mem order by time desc limit 10

Drop Series Column

Drop Series

Plex Transcodes

echo "plex_info,host=nas transcodes=`wget -q -O - "http://localhost:32400/status/sessions?X-Plex-Token=1234567890" |grep -c 'User id'` `date +'%s%N'`"

Ubiquiti ER-X Speedtest

ER-X --> Speedtest --> Telegraf --> InfluxDB
  • Speedtest.net is a web service that provides free analysis of Internet access performance metrics.
  • Telegraf is a plugin-driven server agent for collecting & reporting metrics.
  • InfluxDB is a time series database built from the ground up to handle high write and query loads.

/root/erx_speedtest.sh

/usr/local/bin/speedtest-cli --no-pre-allocate --server 14553 --simple >/tmp/speedtest-cli_result.txt

/root/erx_speedtest_to_influx.sh

echo "speedtest,host=erx download=`grep 'Download' /tmp/speedtest-cli_result.txt | awk '{ print $2 }'`,upload=`grep 'Upload' /tmp/speedtest-cli_result.txt | awk '{ print $2 }'`" | nc 192.168.0.252 8094

Grafana

https://blog.laputa.io/try-influxdb-and-grafana-by-docker-6b4d50c6a446

Network Usage

https://www.dev-eth0.de/blog/2016/12/06/grafana_snmp.html

SELECT non_negative_derivative(mean(bytes_recv),1s)*8 as "in" FROM "net" WHERE host =~ /$server/ AND interface =~ /(vlan|eth|bond|vmbr|ens).*/ AND interface !~ /veth/ AND $timeFilter GROUP BY time($interval), * fill(none)
SELECT non_negative_derivative(mean(bytes_sent),1s)*8 as "out" FROM "net" WHERE host =~ /$server/ AND interface =~ /(vlan|eth|bond|vmbr|ens).*/ AND interface !~ /veth/ AND $timeFilter GROUP BY time($interval), * fill(none)