Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
InfluxDB is time series database that can store huge amount of data for different metrics like CPU, RAM, Storage usage. If you have Grafana in place, one of the databases that would work with it is InfluxDB.

If you setup InfluxDB you can type influx and hit enter to see InfluxDB console (like MySQL):
infladmin@my_host:~$ influx
Connected to http://localhost:8086 version 1.2.2
InfluxDB shell version: 1.2.2

Databases in InfluxDB are called well Database :) and tables are called Measurement. To see list of all databases and make a database active do as below:
> SHOW DATABASES
name: databases
name
----
_internal
my_db
monitoring
some_other_db

> USE my_db
Using database my_db

You are now on my_db database. To display list of measurements (table) and query it:
> SHOW MEASUREMENTS
name: measurements
name
----
cpu_stat
mem_stat

> SELECT * FROM cpu_stat LIMIT 2;
name: cpu_stat
time my_tag metric value
---- ----------- ------ -----
1503999476000000000 CPU_CORE3 CORES 0
1503999476000000000 total 16

Yes, it is almost similar to MySQL. The main point of such a database is to use monitoring tool in place and push metrics into influxDB, then make graphs by using Grafana.

#influxdb #grafana #measurement #time_series_db
To run grafana in Docker:

docker run -d -p 3000:3000 grafana/grafana


Now if you want to install specific plugins you need to provide the name as an environment variable GF_INSTALL_PLUGINS:

docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" \
grafana/grafana


#grafana #docker #plugins
In Grafana if you are connected to MySQL you need to provide 3 value in your select query. One is time which must be called time_sec, the other is countable value which must be called value and the other is the label that is displayed on your graph which must be called metric:

SELECT
UNIX_TIMESTAMP(your_date_field) as time_sec,
count(*) as value,
'your_label' as metric
FROM table
WHERE status='success'
GROUP BY your_date_field
ORDER BY your_date_field ASC


To read more about Grafana head over here:

- http://docs.grafana.org/features/datasources/mysql/#using-mysql-in-grafana


#mongodb #mongo #mysql #grafana #dashboard #chart