CollectD – installation and configuration with InfluxDB on Debian/Ubuntu

I wanted/needed some statistics on few my machines. I saw earlier grafana and was impressed so this was starting point. Then I started reading about graphite, carbon and whisper, and then… I found InfluxDB. Project is young but looks promising.

Installation of collectd is easy on Debian because packages are in default repo. One problem is that packages may be old, ex. on wheezy it version 5.1. But in backports/backports-sloppy you may find current 5.5, so enable backports first:

echo "deb http://http.debian.net/debian wheezy-backports main contrib non-free" > /etc/apt/sources.list.d/backports.list
echo "deb http://http.debian.net/debian wheezy-backports-sloppy main contrib non-free" >> /etc/apt/sources.list.d/backports.list

Install package:

apt-get update
apt-get install -y -t backports-sloppy collectd collectd-utils
# or on recent system just
apt-get install -y collectd collectd-utils

Now edit configuration /etc/collectd/collectd.conf and add network section:

LoadPlugin network

<Plugin "network">
Server "localhost" "8096"
</Plugin>

Use your InfluxDB hostname:port.

Now select and add enable some plugins – list here and restart service:

service collectd restart

That’s all – now install InfluxDB.

Source:
https://anomaly.io/collectd-metrics-to-influxdb/
http://backports.debian.org/Instructions/

Extract password saved in remmina

I had some passwords saved in remmina but like it always happen, I wasn't been able to remember them when needed. Trying to restore them I found that they're encrypted in .remmina directory.

Then I used this script to the decrypt them:

import base64
from Crypto.Cipher import DES3

secret = base64.decodestring('<STRING FROM remmina.prefs>')
password = base64.decodestring('<STRING FROM XXXXXXX.remmina>')

print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)

Source:
http://askubuntu.com/questions/290824/how-to-extract-saved-password-from-remmina

Copy GTP partiotion table between disks

When configuring RAID it’s quite important to have the same partition tables on every disk. I’v done this many times on msdos partition tables like this:

sfdisk -d /dev/sda | sfdisk /dev/sdb

but it’s not working any more on GPT partition tables.

But it still can be done but with different toolstack 🙂

Install gdisk:

apt-get install -y gdisk

Then use sgdisk like this:

sgdisk -R /dev/sd_dest /dev/sd_src
sgdisk -G /dev/sd_dest

First command will copy partition from /dev/sd_src to /dev/sd_dest. Second will randomize partition UUID’s – needed only if you want to use disks in same machine (this is my case).

Install Steam on Debian/Ubuntu

These are few steps to get Steam running on Ubuntu:

wget -c media.steampowered.com/client/installer/steam.deb
dpkg -i steam.deb
apt-get install -f
apt-get update

Solutions for some issues

Some time ago I needed 32 bit flash even on 64 bit system – I don’t need it currently but I’m living this as a tip.

apt-get install adobe-flashplugin:i386

After Ubuntu upgrade I was unable to run Steam anymore – It shouted on me with strange “networking problem”. I have to clean Steam configuration with:

steam --reset

Source:
http://linuxg.net/how-to-install-the-latest-steam-client-available-on-ubuntu-13-10-13-04-12-10-12-04-and-linux-mint-15-14-13/
http://askubuntu.com/questions/353522/why-is-steam-not-able-to-connect-steam-network

Regenerate thumbnails in Shotwell 0.15 (for last month)

I love Shotwell for it’s simplicity and easy export to Piwigo. After Christmas I added new photos to my library but after that I made some modifications to them (red eye reduction, etc…). Because Shotwell generate thumbnails only on import, all my modifications were not visible on preview.

I’ve started searching how to regenerate thumbs and found this info. There were two issues with this method:

  • this howto was for old version (with old paths) and only for 128px thumbs
  • I definitely don’t want to regenerate thumbnails for 40k photos!

After some tweaking this will do work for thumbnails from last month (enough for me):

sqlite3 ~/.local/share/shotwell/data/photo.db \
  "select id||' '||filename from PhotoTable where date(timestamp,'unixepoch','localtime') > date('now','start of month','-1 month') order by timestamp desc" | 
while read id filename; do
  tf1=$(printf ~/.local/share/shotwell/thumbs/thumbs128/thumb%016x.jpg $id);
  tf2=$(printf ~/.local/share/shotwell/thumbs/thumbs360/thumb%016x.jpg $id);
  test -e "$tf" ||  {
    echo -n "Generating thumb for $filename";
    convert "$filename" -auto-orient -thumbnail 128x128 $tf1
    convert "$filename" -auto-orient -thumbnail 360x360 $tf2
    echo
  }
done

Remember to install imagemagick:

apt-get install imagemagick