35
loading...
This website collects cookies to deliver better user experience
shell
knowledgevi
/vim
/nano
or any terminal-based text editorstelegraf-questdb-tutorial
http://<IP ADDRESS>:9000/
where <IP ADDRESS>
is the IP address you just copied. The interactive console should load and we can start querying the database and inserting data!QuestDB exposes a reader for InfluxDB line protocol which allows using QuestDB as a drop-in replacement for InfluxDB and other systems which implement this protocol. – questdb.io
Ubuntu
(20.04 LTS x64
at the time of writing)telegraf-agent-1
and telegraf-agent-2
telegraf-questdb-tutorial
Droplet by executing ssh root@<IP ADDRESS>
where <IP ADDRESS>
is the Droplet's IP address. Then, on the server, run the following to make the Telegraf client available for installation.# Download the signing keys from influxdata.com
curl -s https://repos.influxdata.com/influxdb.key | apt-key add -
# Source release information
source /etc/lsb-release
# Add influxdata.com APT repository to the APT repository list
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list
# Fetch available repositories and read package lists
apt-get update
apt-get install -y telegraf
./etc/telegraf/telegraf.d/questdb.conf
with the following content:# Configuration for Telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "5s"
# Write results to QuestDB
[[outputs.socket_writer]]
# Write metrics to a local QuestDB instance over TCP
address = "tcp://127.0.0.1:9009"
# Read metrics about CPU usage
[[inputs.cpu]]
# Read metrics about memory usage
[[inputs.mem]]
# Read system statistics, like load on the server
[[inputs.system]]
systemctl restart telegraf
. In 5 seconds, the agent will start reporting to QuestDB.telegraf-agent-1
and telegraf-agent-2
.# Download the signing keys from influxdata.com
curl -s https://repos.influxdata.com/influxdb.key | apt-key add -
# Source release information
source /etc/lsb-release
# Add influxdata.com APT repository to the APT repository list
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list
# Fetch available repositories and read package lists
apt-get update
apt-get install -y telegraf
and edit the configuration file /etc/telegraf/telegraf.d/reporter.conf
as the following:socket_writer
address in the configuration to <QUESTDB IP ADDRESS>
, which is the IP address of the QuestDB Droplet.# Configuration for Telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "5s"
# Write results to QuestDB
[[outputs.socket_writer]]
# Write metrics to a local QuestDB instance over TCP
address = "tcp://<QUESTDB IP ADDRESS>:9009"
# Read metrics about CPU usage
[[inputs.cpu]]
# Read metrics about memory usage
[[inputs.mem]]
# Read system statistics, like load on the server
[[inputs.system]]
systemctl restart telegraf
just like the QuestDB Droplet; in a few seconds, the agents will start reporting to our database.http://<QUESTDB IP ADDRESS>:9000
where the <QUESTDB IP ADDRESS>
is the IP address of your QuestDB droplet, and write the following SQL statement in the SQL editor:SELECT * FROM cpu
SELECT
host,
avg(usage_system) cpu_average,
timestamp
FROM cpu
SELECT
cpu.host,
avg(mem.used_percent) mem_usage_average,
avg(cpu.usage_system) cpu_average,
avg(system.load1) load1_average,
cpu.timestamp as timestamp
FROM cpu
INNER JOIN mem ON mem.host = cpu.host
INNER JOIN system ON system.host = cpu.host
SAMPLE BY 5m
ORDER BY timestamp DESC
SELECT
host,
avg(mem.used_percent) usage_average,
timestamp
FROM mem
WHERE host = 'telegraf-agent-1'
SAMPLE BY 30s
ORDER BY timestamp DESC
line
timestamp
usage_average
as a Series and click Draw