Influxdb 2.0 lessons learned

I played a bit with influxdb version 2.0.0, telegraf client and two of my raspberry pies.
On my oldest pi  a 1 B+ the telegraf client caused too much performance issues on that light weight single CPU and 480 MB of usable RAM. So I chose a simple bash script with curl to send the CPU temperature to influxdb.

#!/bin/bash
timestamp=$(date +%s)
temp=$(vcgencmd measure_temp)
curl -XPOST \
"https://flux.example.com/api/v2/write?org=none&bucket=pihole&precision=s" \
--header "Authorization: Token asas==" \
--data-raw "cpu-temperature,host=pihole ${temp//\'C/} ${timestamp}"

At first I was running influxdbd by hand. But I didn’t want the usual port of 9999 of the alpha version and I also wanted SSL encryption when I log into the backend. Pretty easy with the already running apache on that server.

<VirtualHost *:443>
	ServerName flux.example.com
	DocumentRoot /var/www/empty

	<Directory /var/www/empty>
		Options Indexes FollowSymLinks
		AllowOverride None
		Require all granted
	</Directory>

	ProxyPass / http://localhost:9999/
	ProxyPassReverse / http://localhost:9999/

	SSLEngine on
	SSLCertificateFile  fullchain.pem
	SSLCertificateKeyFile privkey.pem
</VirtualHost>

so far so good. Starting the influxdb by hand after a reboot or failing isn’t an option.  So I created by on systemd service file

sudo $EDITOR /lib/systemd/system/influxdb2.service

[Unit]
Description=InfluxDB 2.0 service file.
Documentation=https://v2.docs.influxdata.com/v2.0/get-started/
After=network-online.target

[Service]
User=influx
Group=influx
ExecStart=/usr/local/bin/influxd
Restart=on-failure

[Install]
WantedBy=multi-user.target

Do not forget to enable it :D sudo systemctl enable influxdb2

 

So far I made one observation. The telegraf client is doing a lot of DNS requests through the network. If I’m not wrong it does it for every request. If you look at the graphic you see that the bottom a big blue line. That is the DNS requests from telegraf. At some point around 20:00 You see a drop. Well there I change the flush interval to 120 seconds. Later at round 7:30 I wrote the IP and host name into /etc/hosts and the “noise” was gone. That is something you maybe want to do in your devices, too to save some bandwidth and energy.

Traveling through time isn’t enough

Some people think traveling through time is easy. It might look that way. But they don’t consider that you need to travel space, too. Wait, why space, too?
Let’s start easy. If you want to meet me at work you need 4 dimension. You might think it is just an address, but it isn’t. The first dimension is the street. To make is easy the street goes from east to west in a straight line. Well the street is very long. In order to find me you need the house number. That is like drawing another line from north to south (second dimension). If you think that you are able to meet me yet, you are WRONG! I work in a skyscraper. You need to also the number of the have the number of the floor. Now you can meet me!? WRONG! You might show but at the correct place, but at the wrong time. You might be there in the night or during my lunch break. So you need also the fourth dimension the time.
When it comes to GPS navigation you need those information twice, because you need to know from where and when you are coming.

Now with time travel it is even worse. You are standing on the earth. It rotates with about ~ 464 m/s. If you try time traveling while visiting me, and miss the correct time only by a split second you might fall down a long way down from the height of the skyscraper. But it doesn’t end there. The earth orbits the sun. That is 29.85 m/s additional movement to the earth’s rotation. Our solar system rotates in in our galaxy the milky way. The milky way rotates, too. The galaxy is moving through the universe / space. Plus the universe is expanding. And it the expanding speed is increasing. Good luck with time traveling!. Do the math and meet me in my skyscraper, yesterday! I think this the point most science fiction authors didn’t tell you. So next time you travel through time and space and you are very good. Don’t forget your parachute. If you are not so good in math don’t forget your space suite, just in case…

Remember:

  1. The earth rotates
  2. The earth orbits around the sun
  3. The solar system orbits around the in a rotating galaxy
  4. The galaxy is moving in the universe
  5. The universe is ever expanding. Faster and faster.

Posts Tagged time

Archives by Month: