InfluxDB, Telegraf and Grafana on a Raspberry PI

The combination of InfluxDB, Telegraf and Grafana lets you collect and visualise almost any data. Here is who is doing what:

  • InfluxDB is a time-series database
  • Telegraf is an agent collecting data and sending it to InfluxDB
  • Grafana is a tool to visualize data using dashboard. Is supports, InfluxDB as a data source, amonst many others.

The result of this tutorial will be a nice dashboard of the system usage on a Raspberry PI.

Continue reading “InfluxDB, Telegraf and Grafana on a Raspberry PI”

Analyze Linux disk usage

Fixing a disk space problem on a Linux server without a graphical interface is tedious without the right command line tools handy.

Disk usage

A quick df -h  lists all disks and their current usage.

Find large files

To find large folders with files to clean up, you can use ncdu. Install it (sudo apt-get install ncdu ) and start it pointing to a certain folder.

ncdu /var/lib/jenkins/

Why I love Kotlin

At avisec we decided to use Kotlin when we started to rewrite our backend service. This has proven to be a very good decision. Here are my top 10 reasons why I do love Kotlin:

  1. Data classes eliminate a lot of boilerplate code.
  2. The nullability support of the compiler forces you to think about nulls everywhere. This reduces the number of NullpointerException related bugs to a minimum.
  3. The lambda syntax is very, very lean.
  4. No more guessing which functional Java interface to use.
  5. The standard library provides is a great help.
  6. The IntelliJ support is seamless.
  7. Java and Kotlin integrate both ways – you can start writing Kotlin code in Java projects today, no big deal.
  8. Return values are supported for most (?) structures: if, try/catch, when
  9. Assign default values to parameters and used named parameters when calling functions.
  10. Generics in Kotlin are more powerful than in Java.

Let’s hope the current adoption rate of Kotlin continues and it will become a widely used alternative for Java on the JVM.

Windows (Samba) Share on a Raspberry PI

Assuming you are working  somewhere with a small team and you need a local Windows share to collaborate on documents and oder data. A first choice would obviously be to use Dropbox or a similar cloud service. However if you do not want to send your data to another company or if your internet connection is unstable, you might want to use a server in your local network. My suggestion here is the following: Grab yourself a Rapberry PI, configure a Windows compatible Samba share and start using it.

Continue reading “Windows (Samba) Share on a Raspberry PI”

Mosquitto TLS instability

We’ve been facing recurring TLS issues with Mosquitto, our MQTT broker. The clients tried to send a message and lost the connection in a random and non-reproducible manner. In the Mosquitto error log we always found the following problem:

May 8 13:40:12 ip-172-31-37-49 mosquitto[29510]: OpenSSL Error: error:140F3042:SSL routines:SSL_UNDEFINED_CONST_FUNCTION:called a function you should not call

This issue is reported on GitHub and there seems to be no solution to it yet. However wiebeytec recommended to use an NGINX stream proxy to terminate the TLS connection and forward the decrypted traffic locally to Mosquitto. This is what we did and it solved our issue too!

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
  worker_connections  1024;
}

stream {

  server {
      listen                 8883 ssl;

      proxy_pass             mosquitto_backend;

      ssl_protocols          TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers            AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
      ssl_certificate        /opt/mqtt/broker.crt;
      ssl_certificate_key    /opt/mqtt/broker.key;
      ssl_client_certificate /opt/mqtt/ca.crt;
      ssl_verify_client      on;
      ssl_session_cache      shared:SSL:10m;
      ssl_session_timeout    10m;

  }

  upstream mosquitto_backend {
    server 127.0.0.1:1883;
  }

}

 

Launch Jenkins using Docker Compose

To launch a Jenkins server in a Docker container using Docker Compose, the following docker-compose.yml defines a Jenkins server with a persistent job configuration.

jenkins:
  image: "jenkins:alpine"
  ports:
    - 8080:8080
  volumes:
    - /var/jenkins_home

And start then start it:

docker-compose up

You should now have a Jenkins running on localhost:8080.

If you need a bash to change any configuration, start it like this:

docker exec -i -t jenkins_jenkins_1 /bin/bash