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”
Fixing a disk space problem on a Linux server without a graphical interface is tedious without the right command line tools handy.
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.
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”
It is as easy as this:
sudo tcpdump -s 0 -i eth0 -w network-traffic.pcap
The resulting file can be analyzed using Wireshark.
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:
Feb 1 12:26:31 mysuperserver kernel: Out of memory: Kill process 30595 (java) score 252 or sacrifice child
Feb 1 12:26:31 mysuperserver kernel: Killed process 30595 (java) total-vm:13698324kB, anon-rss:8226564kB, file-rss:0kB, shmem-rss:0kB
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
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:
A peek at the man page top might also help:
VIRT -- Virtual Memory Size (KiB)
The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have
been swapped out and pages that have been mapped but not used.
RES -- Resident Memory Size (KiB)
The non-swapped physical memory a task is using.
SHR -- Shared Memory Size (KiB)
The amount of shared memory available to a task, not all of which is typically resident. It simply reflects memory that
could be potentially shared with other processes.
Use the following shell command to print all traffic from and to the given IP:
/usr/sbin/tcpdump -n -i any host 10.254.52.59
This will print something like this:
15:46:29.272434 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 857, length 40
15:46:29.272469 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 857, length 40
15:46:34.265170 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 858, length 40
15:46:34.265204 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 858, length 40
15:46:39.265504 IP 10.254.52.59 > 10.254.252.237: ICMP echo request, id 1, seq 859, length 40
15:46:39.265539 IP 10.254.252.237 > 10.254.52.59: ICMP echo reply, id 1, seq 859, length 40
This can be quite handy if you need to debug network issues.
Quick and not even that dirty:
echo;< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10; echo;echo