Fork me on GitHub

Monitoring MongoDB in Munin on Ubuntu 13.04

Here's how to install munin-node and start monitoring a MongoDB server on a fresh Ubuntu box

sudo apt-get install git munin-node
git clone git:// /home/ubuntu/mongo-munin
sudo ln -sf /home/ubuntu/mongo-munin/mongo_btree /etc/munin/plugins/mongo_btree
sudo ln -sf /home/ubuntu/mongo-munin/mongo_conn /etc/munin/plugins/mongo_conn
sudo ln -sf /home/ubuntu/mongo-munin/mongo_lock /etc/munin/plugins/mongo_lock
sudo ln -sf /home/ubuntu/mongo-munin/mongo_mem /etc/munin/plugins/mongo_mem
sudo ln -sf /home/ubuntu/mongo-munin/mongo_ops /etc/munin/plugins/mongo_ops
sudo service munin-node restart

You can then test it by running:

sudo munin-run mongo_conn

Posted Wed 05 June 2013 by Ivan Dyedov in Linux (Linux, Ubuntu)


  • Avatar
    Const 2014-09-19T12:30:31

    Hi Ivan, thank you for this. However I have a problem, I followed your command lines but the munin server receive nothing from the node for Mongo (everything else is ok).

    I opened a question on:

    Here is the error:

    # sudo -u munin python /usr/share/munin/plugins/mongo_ops
    Traceback (most recent call last):
    File "/usr/share/munin/plugins/mongo_ops", line 56, in <module>
    File "/usr/share/munin/plugins/mongo_ops", line 33, in doData
    ss = getServerStatus()
    File "/usr/share/munin/plugins/mongo_ops", line 28, in getServerStatus
    raw = urllib2.urlopen(req).read()
    File "/usr/lib/python2.7/", line 126, in urlopen
    return, data, timeout)
    File "/usr/lib/python2.7/", line 400, in open
    response = self._open(req, data)
    File "/usr/lib/python2.7/", line 418, in _open
    '_open', req)
    File "/usr/lib/python2.7/", line 378, in _call_chain
    result = func(*args)
    File "/usr/lib/python2.7/", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
    File "/usr/lib/python2.7/", line 1177, in do_open
    raise URLError(err)
    urllib2.URLError: <urlopen error="" [errno="" 111]="" connection="" refused="">

    Do you have any idea why it happens? To test, I moved the plugin files to `/usr/share/munin/plugins` and updated the simlink, but I've got the same error.

    • Avatar
      Ivan Dyedov 2014-09-19T14:12:37

      is your mongodb running on on the same machine and the default port (28017) ? that's what the plugin uses by default, otherwise you have to set some environmental variables

      • Avatar
        Const 2014-09-19T20:42:21

        Hi, indeed the port was different, but that's not all, the plugins were very old versions. I took the latest fork from and then it worked very well (it use pymongo instead of rest api)