If you don't want to use Ruby from your repositories and you don't want (or can't because of some reason) to use RVM, here's a quick howto download and compile Ruby from sources (all the commands should be executed with sudo or as a super user):
First a small update and some neccessery libs:
sudo su
apt-get update
# Not sure if all of them are required but nothing bad will happen if you just install them
apt-get install build-essential bison openssl libreadline6 libreadline6-dev \
libyaml-dev libxml2-dev libxslt-dev zlib1g zlib1g-dev libssl-dev autoconf \
libc6-dev ncurses-dev libaprutil1-dev libffi-dev libcurl4-openssl-dev libapr1-dev
Then we should go here and download the most recent stable version:
# Still as root
cd ~
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
Of course we need to unpack it:
tar -xvf ruby-2.1.2.tar.gz
# go to where it was unpacked
cd ruby-2.1.2/
This is not a tutorial on how to install Munin itself. I assume that from this point, you have Munin and Munin-node running on your system and that you see basic Munin stats charts.
MongoDB configuration
MongoDB provides a simple http interface listing information of interest to administrators. This interface may be accessed at the port with a numeric value 1000 more than the configured mongod port. The default port for the http interface is 28017 (description copy-pasted from here). By default it is not enabled but it is required by Munin MongoDB plugins, so we need to turn it on.
Warning! Keep in mind, that if you don't block it, it will listed on your public interface and it will be accessible by default from internet. Please use iptables to make it work only from localhost.
To enable it, edit your /etc/mongod.conf file, find httpinterface line and uncomment it (or set to true if set to false):
# vim /etc/mongod.conf
# Enable the HTTP interface (Defaults to port 28017).
httpinterface = true
After that you need to restart MongoDB:
# As a root or using sudo
/etc/init.d/mongod restart
[ ok ] Restarting database: mongod.
To test it, open http://localhost:28017/ (remember to replace localhost with your server host). You should see page similar to this one:
Installing Munin MongoDB plugins
Some of those plugins won't work out of the box, but we will take care of that later. For now let's focus on the install process:
# as a root or using sudo
git clone git://github.com/erh/mongo-munin.git ~/mongo-munin
cd ~/mongo-munin
# We copy all the plugins into munin plugins
cp mongo_* /usr/share/munin/plugins/
# We need to activate them now
ln -s /usr/share/munin/plugins/mongo_btree /etc/munin/plugins/
ln -s /usr/share/munin/plugins/mongo_conn /etc/munin/plugins/
ln -s /usr/share/munin/plugins/mongo_lock /etc/munin/plugins/
ln -s /usr/share/munin/plugins/mongo_mem /etc/munin/plugins/
ln -s /usr/share/munin/plugins/mongo_ops /etc/munin/plugins/
cd ~
# We don't need this anymore
rm -rf mongo-munin
# Restarting munin-node...
/etc/init.d/munin-node restart
After restarting munin-node and waiting few minutes, we should have a new section in your munin web ui (mongodb). Part of the graphs won't display any data, but you should at least see the mongodb section.
Debugging and fixing Munin MongoDB broken plugins
Some of the plugins (like mongo_lock) won't work without a little tuneup. If you see graphs similar to this (without any data and -nan everywhere), then most likely those plugins aren't working.
To check each of the plugins, you need to run munin-run with appropriate plugin name (as root):
mongo_btree
# munin-run mongo_btree
Traceback (most recent call last):
File "/etc/munin/plugins/mongo_btree", line 61, in <module>
doData()
File "/etc/munin/plugins/mongo_btree", line 35, in doData
for k,v in get().iteritems():
File "/etc/munin/plugins/mongo_btree", line 32, in get
return getServerStatus()["indexCounters"]["btree"]
KeyError: 'btree'
mongo_conn
# munin-run mongo_conn
connections.value 0
mongo_lock
# munin-run mongo_lock
Traceback (most recent call last):
File "/etc/munin/plugins/mongo_lock", line 54, in <module>
doData()
File "/etc/munin/plugins/mongo_lock", line 34, in doData
print name + ".value " + str( 100 * getServerStatus()["globalLock"]["ratio"] )
KeyError: 'ratio'