Munin 2.0 on CentOS7 with Nginx and FastCGI

As the various bits of official Munin documentation seems to be in a limbo state where the current stable version (2.0.x) isn’t very well handled between the old and the new site, finding a good howto on setting up Munin with FastCGI and Nginx wasn’t as easy as it should have been.

There are articles (notably ) that are a bit on the overly complicated side, as it turns out, there exists a package called munin-nginx which simplifies things a lot.

So, assuming you are going to run munin without a URL prefix ( setting up Munin to use CGI for graphs and HTML turns out to be quite easy. The below steps were successfully performed using CentOS Linux release 7.2.1511, with munin-2.0.25-11 and munin-nginx-2.0.25-11.

sudo yum -y install munin munin-nginx nginx 

sudo sed -i 's/\(.*\)_strategy.*/\1_strategy cgi/;s/#cgiurl_graph/cgiurl_graph/' /etc/munin/munin.conf

for svc in munin-fcgi-graph munin-fcgi-html ; do sudo service $svc stop ; sudo chkconfig $svc on ; sudo service $svc start

htpasswd -c /etc/nginx/.htpasswd-munin-users munin

The Nginx config you need is:

server {
  listen 80; # IPv4
  listen [::]:80 ipv6only=on; # IPv6
  ## Logs
  log_not_found off;
  error_log /var/log/nginx/munin.yoursite.com_error_log error;
  access_log off;

  location / {
    fastcgi_split_path_info ^(/)(.*);
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME /var/www/cgi-bin/munin-cgi-html;
    include fastcgi_params;
    fastcgi_pass unix:/var/run/munin/fcgi-munin-html.sock;
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/.htpasswd-munin-users;

    # Serve static files
    location /static/ {
      alias /etc/munin/static/;
      expires 30d;

    # Munin CGI graph
    location ^~ /munin-cgi/munin-cgi-graph/ {
      access_log off;
      fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param SCRIPT_FILENAME /var/www/cgi-bin/munin-cgi-graph;
      include fastcgi_params;
      fastcgi_pass unix:/var/run/munin/fcgi-munin-graph.sock;

      # Bypass cache.
      fastcgi_cache_bypass 0;
      fastcgi_no_cache 0;
      expires epoch;

Then restart nginx, and you should be able to use munin with cgi-generated graphs and html pages:

sudo service nginx restart

iTerm2 productivity

If you’re like me, you spend most of your time in the terminal. On OSX that means iTerm2 for me. I won’t go into details on how many orders of magnitude better iTerm2 is than the default Terminal app, because most likely you’re already familiar with it.

What you might not know is that what is considered the stable version of iTerm, is a bit like the stable version of Debian. It’s very conservatively updated, and most features take quite a bit of time to trickle down into a major release. So after I discovered that the Nightly builds are relatively stable I switched, and have not looked back.
Yes granted the updates keep rolling in, but as I’ll get to, using tmux for window arrangement means this doesn’t really bother me. So go get the nightly build now!

You do not need the nightly version to use one of the best features of iTerm2, which is the tmux integration. What it enables is a way for iTerm2 to communicate with tmux via tmux’ “Control Mode”. Basically you start an iTerm window and enter :
tmux -CC
which will open a new iTerm window linked with tmux. So any iTerm session operations (opening a new tab, a new window or a split) will be handed off to tmux. If you then were to quit iTerm, or close the window, you could easily get your complete window arrangement back by doing tmux -CC attach. This is indeed very handy.

So now we have pretty persistent window arrangements, which will give you the opportunity to over-indulge on tabs/splits/windows etc. Now we apply some order to the mess we inevitably will create.
iTerm nightly has two cool features that will enable quick navigation of your sessions. The first one is badges. I’ve found that I like to set custom badges instead of relying on automatically set badges. So, first I set the badge options
printf "\e]1337;SetBadgeFormat=%s\a" $(echo -n "\(user.myBadge)" | base64)
and then define a bash function
setbadge() { printf "\e]1337;SetUserVar=myBadge=%s\a" $(echo $1 | base64); }

Now we can easily set badges in tabs:
Screen Shot 2015-05-07 at 10.53.03
The second feature that ties nicely into this is Session Search. Open with Cmd+Shift+O and you can quickly search and switch to the tab/window you like. There is also Tab Exposé Cmd+Alt+E but it’s slower.

There are tons of other ways iTerm2 can improve your everyday terminal life, I just found this to be a very handy addition to my toolbox.

Provisioning Vagrant with Salt

Vagrant sports out of the box integration with Saltstack, which works very well with minimum effort. However under the hood the default way this integration works is via a 4000-line bash script that bootstraps Saltstack on the VM. This would all be well and good, however, even if you were to pre-install the salt-call and salt-minion binaries onto your Vagrantbox, the salt-integration uses the same bash-script to install the configuration provided in the Vagrantfile.

So it has come to this..    I don’t really want this in my workflow. And I suspect any heavy Saltstack users might want to skip this aswell.

I found a way, that was not completely obvious, to make the Salt-integration work as quick and painless as I wanted in the Masterless mode:

  • Create a vagrantbox (in my case I use Packer with a set of templates), with the salt-binaries pre-installed.
  • Make sure the salt-minion daemon is disabled.
  • Overwrite the default minion config with the contents  “file_client: local” (and of course any other configuration you require)

This way you do not have to use the “minion_config” setting in your Vagrantfile, and the salt provisioner plugin will happily skip the bootstrapping script.

You could always check the Saltstack installation-script for the Packer-template for reference.

You can now use the following setup in your Vagrantfile:

config.vm.synced_folder "salt/roots/", "/srv/salt/"

config.vm.provision :salt do |salt|
  salt.run_highstate = true

In salt/roots/ place your top.sls which could look something like this:

    - default

Which would then execute the salt/roots/default/init.sls state.

Media services

I thought I’d write a little summary on current media services I use, and why. I have mostly stopped buying music pressed on plastic discs, and the amount of movies I buy on-disc has also gone down. However that does not mean I don’t pay for my entertainment. Well on to the services.




I used to use Spotify actively, mainly due to their very good selection of EDM (Electronic Dance Music) and iOS-app, which has enabled me to completely stop syncing music from my computer. I was a premium subscriber for over a year, and the service (which cost around the price of 1 CD per month) was awesome. I used Spotify apps everywhere; iPhone, iPad, Mac, Linux (still a shamefully shoddy version though), and on Squeezebox. In addition to EDM, Spotify also features a more than good enough selection of “kid friendly” Norwegian music. When I checked out Rdio though I moved on..




A few annoyances with the Spotify iOS app, and a constantly hopeless experience on Linux made me very ripe for a migration when I was introduced to Rdio. Rdio is a very similar service to Spotify, it generally has a comparable selection of music to stream, has about the same quality and cost the same for a mobile-enabled subscription.

Where Rdio differs is firstly in the quality of its apps. If you are on desktop, you can just use a normal web-browser to stream, or download a prepared Site-Specifc-Browser “app” that will give you a similar experience to the Spotify app. It does not have indexing of local media as an option though, so if you use that you’re out of luck. On iOS the app is a lot more snazzy design-wise, also it correctly purges content you no longer want synced offline (you can select what content to mobile sync from the app/web too).

Secondly, Rdio lets me build a “collection” of albums and artists. By doing so I get notifications of new music from these artists, and I can easily browse my subset of all available music. This mode of browsing is highly preferable to the search focused Spotify experience to me.



Soundcloud has mostly taken over the role Myspace had as a channel for artists to share their tunes, demos, live-recordings, DJ-mixes etc. I know there are some issues concerning takedowns of more mainstream DJ-mixes, and that everything is not perfect in the Soundcloud, but for me it works very well as a nice way to keep in touch with my favourite artists and their work. I pay for a premium service here too, but would probably not if it wasn’t for wanting to share my own DJ-sets. As a consumer the service works very well without a subscription. Their iOS-apps are workable, but not nearly as polished as Rdio, and have no way to utilize downloads/off-line storage as far as I know.

This used to be a lot higher on my list of services I used actively. But due to their very limited streaming capabilites and somewhat lackluster selection of hosted music I quit being a paying subscriber of, and instead use it solely as a place to aggregate my listening statistics, and keep up with what others are listening to. The Facebook/Spotify-connected service has filled some of this need lately, but my connections are still a source of interesting finds every now and then.



There are several issues with Bandcamp. One being that it has a very limited function for gifting music, or sharing CC-marked material, which is a shame really, as that would probably have made the service more interesting for both artists and fans. As it is Bandcamp provides a smooth way for me to pay the artists directly for FLAC downloads, and I highly prefer this model to Beatport (see below). Recently Bandcamp improved their music discovery options by introducing “My Bandcamp”. This allows me to track other peoples buying etc. and is better than not having any such features at all. It’s still no “Amazon for Music”, but getting better.


Despite exorbitant prices, there is still no way to get around Beatport. The wide amount of EDM available through Beatport is mostly unmatched, even if one can often find tracks elsewhere. For the widest array of artists and tracks in lossless quality, it’s hard to beat Beatport though.. The website is almost workable too, but there are so many problems with the often half-assed approach to meta-data, and classification that it’s hard not to get a bit frustrated. I mean, when I pay more for a digital download than for a CD-copy (incl. shipping) I think I deserve proper metadata and the feeling that someone at Beatport cares enough to ensure classification remains somewhat appropriate?


While Beatport pushes material from any established artist, for the fresh stuff in my niche genre(s) I rely on Ektoplazm. An awesome source of free music, often free as in CC-licensed (type of CC license varies) too. And, just because it’s free doesn’t mean it features music that is worthless. Far from it, Ektoplazm often delivers music that is way more interesting than the commercial releases. I am sure there are other sites like Ektoplazm in other genres, or at least I hope so, as everyone deserves a service like this.

Gnome 3 adjustments and addons for a Gnome 2 user

As a long time professional Linux desktop user (since 2000 or so) I have used numerous desktop environments over the years. Initially Gnome1, then KDE2, then Gnome2 for a long time.

With the advent of Unity and Gnome 3.x, the distro vendors primary focus has understandably switched to supporting the future instead of maintaining the past. I will not go into the discussion whether this has happened too fast, or just fast enough.

Upgrading from the last Ubuntu that supported Gnome 2, I chose to try Unity, found out that it wasn’t for me (dual 1600×1200 monitor setup, multi workspace setup), then tried my luck with KDE (which I parted with around KDE3), and ended up with “Gnome Classic”. Now, after several issues in the process towards Precise Pangolin, I finally jumped ship to Fedora 16, and in that process tried to make the modern Gnome 3 work for me.

I will update this post as I make additional modifications, keeping it as a reference for my own use. Let me know in the comments if you have tips or suggestions.

Here are the adjustments and addons I have found, that improve the out-of-the-box Gnome 3 experience:


In Fedora, ensure you have the following packages :

gnome-shell-extension-places-menu gnome-shell-extension-auto-move-windows gnome-shell-extension-alternative-status-menu gnome-shell-extension-pidgin gnome-shell-extension-remove-bluetooth-icon gnome-shell-extension-systemMonitor gnome-shell-extension-user-theme gnome-shell-extension-workspace-indicator gnome-shell-extension-remove-accessibility-icon gnome-shell-extension-apps-menu gnome-shell-theme-atolm gnome-tweak-tool

The very nice System Monitor shell extension is not packaged, but is easily installed from git:

I had little luck installing it into ~/.local/share/gnome-shell/extensions, but installing it globally under /usr/local/share/gnome-shell/extensions/ worked fine.

Most of the settings and extensions mentioned below are enabled through gnome-tweak-tool (listed as “Advanced Settings in the Gnome launcher).

Shell extensions

  • Workspace Indicator (re-enables a workspace indicator in the “tasktray”)
  • Pidgin IM Integration (improves the usability of Pidgin under Gnome 3, not as good as it used to be in Gnome 2 but still ..)
  • Remove Accessibility Icon (with the agressive removal of useful indicators in G3 it surprises me how much unnecessary stuff is default enabled)
  • Applications Menu (mostly improves the “familiar feeling”, I don’t really use this much)
  • System Monitor (visual, ever present system monitor, even looks pretty good)
  • Remove Bluetooth Icon (I don’t use BT on my desktop, so this is totally redundant)
  • Places Status Indicator (re-enables quick access to folders in the file browser)
  • User Themes (let’s the user configure Gnome Theme settings)


I kept most of the defaults, but found that using the “Atolm” Shell Theme made me feel more at home (it makes Gnome 3 look a lot more like Gnome 2 in earlier Ubuntu’s..). I also enabled “Menus Have Icons” and “Buttons Have Icons”. Cursor, Icon, GTK+ and Window themes were kept to their default settings.


In gconf-editor (aka “Configuration Editor” in the launcher) I modified these keys :

  • /desktop/gnome/shell/windows/workspaces_only_on_primary – False  (This makes my dual monitor setup work as I want it and disables the second screen from being a “sticky” workspace)
  • /desktop/gnome/shell/windows/button_layout – close,minimize,maximize:menu (My other OS of choice is OSX, and this makes the transition between them smoother)

Update for Gnome Shell 3.4

Settings that were previously in gconf are now migrated to dconf:

  • : workspaces-only-on-primary – False
  • : button-layout – close,minimize,maximize:menu
  • : attach-modal-dialogs – False (this detaches popupdialogs from their parent window)


Site moved

Moved to our new VPS running Ubuntu LTS, and in the process I migrated my blog from Drupal to WordPress. Drupal 7 seems great, but when it comes to simple blogging WordPress has the edge in simplicity, admin UI and maintainability. Maybe this means I’ll manage to blog a little more often, or maybe not, time will tell.

Why I almost didn’t get an iPhone

While Apple has got a lot of things right in the iPhone, here are a few annoyances I have with the platform/gadget.

AppStore is cool, but Apples rules and rights of refusal are not. There are many stories of weird rejections and strict rules against improving on the experience with apps that cover basic functionality Apple itself already have developed solutions for. This means that nobody can create a better music player (with better codec support, integrated scrobbling or other nice features), a better video player (again maybe including support for commonly used “internet-codecs”) or release a better browser or calendar..

It also means Apple, or rather Apples app-judges, can refuse to distribute an app even without giving a reason why. I know this is “the Apple way” but it's stupid and frustrating. Even Microsoft would know better 😛

I already mentioned it, but it's a major annoyance for me; the lack of codecs the i*-experience can handle (iTunes, iPhone, iPod). If you are like me and have a lot of FLACs lying around, you're pretty much left to your own devices. There are various solutions to this, mp3fs being one, but nothing would be better than if iTunes could just get it right and convert my FLACs directly for me when sending to the portable gadget.

The connector required for charging is also a minus, not the biggest one, and one that will probably resolve itself anyway, but it's still less than optimal.

I don't think Apple will ever fix the two biggest, most important issues I have with the platform. And if you are now laughing and saying that this is to be expected when you sell out to a vendor of proprietary software and platforms, you're of course right 😉 But there are simply too many things going for the iPhone right now, and the Android needs to grow up before it can be a viable alternative. (It probably will in time.)

Why I will get an iPhone

(As English is our new official company language, and my tweets are now mainly English I think I'll switch to primarily blogging in English. This might change back without warning.)

I've been weighing it back and forth for a while. Which smartphone will be my first, after the Nokia N93 fiasco some years ago? (Symbian S60 seemed so cool back then.) Well, I think I've come to the conclusion that it'll be an iPhone 3GS. Here is why.

I like Android as a mobile OS, probably more than iPhone OSX. But, and this is an important objection, there is no comparably cool hardware devices out yet to run Android. The iPhone 3GS hardware is awesome, has a fast GL capable 3D chip and a speedy ARM CPU. A colleague, who recently got himself an HTC Magic, said that after getting accustomed to the graphics/3D capabilities of the iPod Touch (1st gen) he wasn't exactly bowled over by the Magic.

Then there is the camera features, or lack of, on the Android devices so far. Neither the HTC Magic nor the HTC Hero have very sophisticated camera features. They're decent enough for sure, but one thing the N93 actually did pretty well was to eliminate the need for bringing a pocket digicam. I still have a decent amount of “in the moment” snaps and vids, shot with the phonecam. This includes the need for a proper flash/camera led. Are you listening HTC? The Samsung 7500 something rather will feature a 5 megapixel camera, but megapixels aren't everything, it could be good though.

Another factor is the amount of available addons, cases, cables, gadgets, stuff and weirdness for the iPhone family. This is of course not something one can blame Google or HTC for, it's just a matter of Apple selling so many devices that the 3rd party manufacturers are sprouting around the platform.

The AppStore and the amount of awesome apps and games is another strong reason to get the iPhone. Multitouch and the aforementioned 3D chip launched the iPhone/iPod Touch as a gaming platform in its own right. Sony is forced on the defence and just launched the “PSP Go” as a countermeasure (I don't think it's a good counter though, more on that later). The AppStore is mostly a win for everyone, it's an effective content distribution platform with a massive potential customer base.

Summing it up, when I want the iPhone it's not simply as an advanced smartphone. The iPhone will enable me to bring one gadget that does a lot of things well enough that it eliminates the need for other gadgets in my pockets. No longer will I need a separate mp3-player, I can shoot photos and short videos, I can surf the web efficiently with a browser that works (the Android also covers this bit well), I have a mobile gaming device with a good selection of cheap and cool games on the go. Throw in a GPS and I'm pretty content. This is also why the PSP Go will not succeed. It might be a decent gaming platform (but less so than the Nintendo DS), but it still lacks the other features of the iPhone.

With the iPhone platform, Apple has done a lot of things right, it mixes an attractive OS, good application support, a decent mix of features with a properly sized hardware platform (Nokia has failed on the latter point so many times). At the moment I cannot see any real competition for my kroner. Now I just need to choose a provider. Any thoughts why choose one over the other?

There are sore spots with the iPhone / Apple experience. These will be the focus of my next post..

mp3fs for Linux

This is how easy it is with Linux (Ubuntu 9.04 Jaunty Jackalope in my case) :

1. sudo aptitude install libfuse-dev libflac-dev libmp3lame-dev libid3tag0-dev
2. wget mp3fs-0.13.tar.gz (
3. tar xfz mp3fs-0.13.tar.gz
4. cd mp3fs-0.13
5. ./configure
6. make && sudo make install
7. sudo mkdir /srv/mp3fs
8. sudo mp3fs /FLAC/,256 /srv/mp3fs/ -o allow_other,ro

mp3fs in OSX

As I have not found a quick and easy guide on how to use mp3fs in OSX I'll write this in english.

mp3fs is a very nice idea and a smooth way to use a vast library of lossless archived CDs in the awesome FLAC with silly mp3players without native support.

The concept of mp3fs is a FUSE filesystem which converts FLACs to mp3s on the fly (CBR only as of now) via lame. Thus you can have the original FLACs stored, and expose a folder structure of converted mp3s to whatever you want. In my case iTunes.

This is all pretty easy under Linux, but in OSX there are a few hurdles along the way. First one is that the current OSX patch for mp3fs is only compatible with the Macports version of MacFUSE (currently 1.7_1). So any currently installed MacFUSE package (via DMG or otherwise) has to be removed.

Once this is done installing mp3fs and MacFUSE is as easy as installing the mp3fs port. Here is a step-by-step working guide (tested with OSX Leopard 10.5.7).

1. Install Macports (
2. Open your favourite terminal.
3. “sudo port install mp3fs”
4. Make yourself a nice cup of your favourite hot beverage.
5. Create a mountpoint : “mkdir mp3fs”
6. Mount the mp3fs : “sudo mp3fs /Path/To/Your/FLAC/Dir,BITRATE /Path/To/Your/Mountpoint -o allow_other,ro”
Example : “sudo mp3fs /Users/denis/Music/CDRips,256 /mnt/mp3fs -o allow_other,ro”
7. You now have an mp3fs filesystem at /mnt/mp3fs 🙂

Running “mp3fs” with no options will show usage (no manpage yet), and running “mp3fs /Dir1,256 /Mountpoint -h” will show you FUSE mountoptions, one of these is -d for debug which could come in handy.

Thanks to the coders of this nifty little FUSE fs, and to the guys patching it for OSX. Any chance we could have a cleaner patch that would also work with newer MacFUSE versions?