Home / OpenStack

Monitoring instances using Munin and Collectd – OpenStack

Rating: 5.0Blog-star
Views: 3417
by Ravindra Savaram
Last modified: March 30th 2021

The health of the underlying infrastructure operating our on-premise cloud solution is important, but of equal importance is to understand the metrics given by the Compute instances themselves. For this, we can get metrics sent from them by using a monitoring tool called Collectd, and we can leverage MUNIN for an overall view of our running virtual instances.

If you would like to become an OpenStack  Certified professional, then visit Mindmajix - A Global online training platform: " OpenStack Certification Training Course ". This course will help you to achieve excellence in this domain.

Setting Instances using Munin and Collectd

To set Munin and Collectd up, carry out the following steps:


We can configure Munin to look at more than just the CPU, memory, and disk space of the host, by invoking the libvirt plugin to query values within the running instances on our Compute hosts:

  • The libvirt munin plugin is conveniently provided by the Ubuntu repositories, so we grab these in the usual way:
sudo apt-get update
sudo apt-get -y install munin-libvirt-plugins
  • Once downloaded, we then configure the munin libvirt plugins on the Compute host:
cd /etc/munin/plugins
sudo ln -s /usr/share/munin/plugins/libvirt-blkstat sudo ln -s /usr/share/munin/plugins/libvirt-ifstat sudo ln -s /usr/share/munin/plugins/libvirt-cputime sudo ln -s /usr/share/munin/plugins/libvirt-mem
  • With the plugins in place, we now need to configure them. This is done by placing a file in /etc/munin/plugin-conf.d/libvirt, with the following contents:
[libvirt*] user root
env.address qemu:///system
env.tmpfile /var/lib/munin/plugin-state/libvirt
  • Once this is done, we restart the munin-node service, and we will see an additional category show up in Munin, named Virtual Machine, where we can then see how much memory, CPU, and disk activity is being consumed as a whole on the host:

Virtual Domain CPU Time


Collectd is set up in three parts. There is a collectd server that listens over UDP for data sent from the clients. There is the client collectd service that sends the data to the collectd server. Finally, there is a web interface to Collectd, named collectd-web that allows easy viewing of the graphs sent from collectd:

[ Related Article:- OpenStack tutorial ]

Collectd server

We first install collectd and the required Perl resources in the usual way from Ubuntu’s repositories:

sudo apt-get update
sudo apt-get -y install collectd libjson-perl
  • Once installed, we configure the service to listen on a port we choose. The configuration of collectd is done in /etc/collectd/collectd.conf. In the following configuration, we listen on UDP port 12345:
Hostname "servername"
Interval      10
ReadThreads 5
LoadPlugin network 
Listen "*" "12345" 
LoadPlugin cpu LoadPlugin df LoadPlugin disk LoadPlugin load LoadPlugin memory LoadPlugin processes LoadPlugin swap LoadPlugin syslog LoadPlugin users LoadPlugin interface 
Interface "eth0"  LoadPlugin tcpconns
LoadPlugin rrdtool  CacheFlush 120
WritesPerSecond 50 
Include "/etc/collectd/filters.conf"
Include "/etc/collectd/thresholds.conf"
  • We restart the service to pick up these changes:

sudo service collectd restart

[ Related Article:- OpenStack Interview Questions ]

Collectd Client

  • The collectd client and server use the same package, so we install the client in the same way.

sudo apt-get update sudo apt-get -y install collectd libjson-perl

  • The configuration file for the guest is the same as for the server, but we specify different options. Edit /etc/collectd/collectd.conf with the following contents:
FQDNLookup true
Interval      10
ReadThreads 5 LoadPlugin network 
Server "" "12345" 
LoadPlugin cpu LoadPlugin df LoadPlugin disk LoadPlugin load LoadPlugin memory LoadPlugin processes LoadPlugin swap LoadPlugin syslog LoadPlugin users LoadPlugin interface 
Interface "eth0" 
  • Restart the collectd service to pick up this change:

sudo service collectd restart


At this point, data is being sent over to the collectd server (at address To view this data, we install another package that can interpret the RRD files and present them in an easy-to-use web interface. We first download collected-web the tarball from the following URL: https://collectdweb.appspot.com/download/

  • We then unpack the archive, as follows:
tar zxvf collectd-web_0.4.0.tar.gz
  • Then, we copy everything over to the web server DocumentRoot directory:
sudo cp -a ./collectd-web /var/www
  • Create or modify the /etc/collectd/collection.conf file with the following contents:
datadir: "/var/lib/collectd/" libdir: "/usr/lib/collectd/"
  • We then run the standalone server that will listen locally for requests from Apache:
cd /var/www/collectd-web
sudo nohup python runserver.py &
  • After this, we edit the vhost file that controls DocumentRoot of our Apache setup (on Ubuntu, this is /etc/apache2/sites-enabled/000-default) to ensure that .htaccess files are understood with the AllowOverride all configuration:
Options Indexes FollowSymLinks MultiViews AllowOverride all
Order allow,deny allow from all
  • We can now simply reload Apache to pick up the changes, as follows:
sudo service apache2 reload
  • Now, we point our web browser to our installation, for example,, to view the collectd stats from the listed servers.

OpenStack-  Instances using Munin

Munin has plugins for various monitoring activities, including libvirt. As libvirt is used to manage the running instances on our Compute nodes, they hold an array of information that we can send to Munin to allow us to get a better understanding of what is happening in and on our OpenStack Compute hosts and instances.
Collectd is regarded as one of the standard ways of collecting resource information from servers and instances. It can act as a server and a client, and as such, we use the same installation binaries on both our monitoring host and guests. The difference is in the configuration file, /etc/collectd/collectd.conf. For the server, we specify that we listen on a specific port using the following lines in the server’s configuration file:

 Listen "*" "12345"

For the client configuration, we specify where we want the data sent to using the following lines in the client’s configuration file:

Server "" "12345" 

To bring the two together in a convenient interface to collectd, we install the collectd-web interface that has a standalone service that is used in conjunction with Apache to provide us with the interface.

Explore OpenStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!  Downlaod


About Author

NameRavindra Savaram
Author Bio


Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.