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

Debian – Upgrade MySQL to MariaDB

After reading some good opinions about MariaDB I wanted to give it a try. Upgrade looks quite straight forward but I found some issues a little tricky.

Installation

Add repo and key:

cat > /etc/apt/sources.list <<SRC
deb http://mirrors.supportex.net/mariadb/repo/5.5/debian wheezy main
deb-src http://mirrors.supportex.net/mariadb/repo/5.5/debian wheezy main
SRC

(find more repositories here)

Now install MariaDB:

sudo apt-get update
sudo apt-get install mariadb-server

It could be better to install mariadb-server-5.5 and mariadb-client-5.5 package instead, because of this error.

MariaDB repo pinning

Some time after installation I have problem with newer packages from Debian repositories that upgraded my MariaDB installation back to MySQL – it’s described here, so I used pinning to resolve that.

cat > /etc/apt/preferences.d/ <<PIN
Package: *
Pin: origin mirrors.supportex.net
Pin-Priority: 1000
PIN

Results

Before migration to MariaDB, front page of my blog needs about 650 ms to generate. After switch, it was only about 550ms. So it’s about 15% – absolutely for free 🙂