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.

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”

Linux kills a process when when starving memory

I recently observed a rather strange problem with randomly dying Java processes under heavy load. The vital clue to this problem was hidden in /var/log/messages as shown below:

It turns out that Linux may decide to kill a process when the system runs out of memory. It may make sense to cap the memory limit (-Xmx) of any Java processes running on the system to a value that sums up below the server’s available memory.

Jaan Angerpikk explained this problem in great detail, follow the link below to read more on this matter.

Out of memory: Kill process or sacrifice child

Memory stats on Linux

Did you ever wonder what the VIRT, RES and SHR memory figures in top on Linux are supposed to tell you?

Here we go:

  • VIRT – How much memory the process is able to access at the moment.
  • RES – How much memory the process is actually using at the moment. This is the value you should probably be looking at and corresponds with the %MEM column.
  • SHR – How much of the VIRT memory is shareable.

Continue here if you want more details:
http://mugurel.sumanariu.ro/linux/the-difference-among-virt-res-and-shr-in-top-output

A peek at the man page top might also help:

Debug network traffic on a Linux server

Use the following shell command to print all traffic from and to the given IP:

This will print something like this:

This can be quite handy if you need to debug network issues.