Monitoring Asterisk with Munin and Smokeping

For the Village Telco concept we need a way to monitor VOIP systems remotely. I mentioned this to Michael from OEG during a recent visit. OEG have a very sophisticated system for monitoring their network, and one of the tools they use is Munin.

With some help from Michael, I have managed to get Munin running with the IP04. Here are some Munin graphs showing Ethernet traffic and IAX registrations for my home office IP04:

Munin consists of a server (called the master) that polls the machines being monitored (called the nodes) every 5 minutes. On each node are a bunch of “plugins” that report information on various parts of the system, for example CPU load, memory, Asterisk channels and trunk status.

The design is very cool and very “Unix” – many small command line tools hooked together to to clever things. Each node is accessed via a telnet type interface, for example:
[host]$ telnet ip04 4949
Connected to
Escape character is '^]'.
# munin node at ip04
load memory
fetch memory
memory_used.value 26132
memory_free.value 32948
Connection closed by foreign host.

Note: thats me typing the “list” and “fetch memory” commands above.

So the server polls each node, lists all it’s plugins, then runs the “fetch” command for each one. The “config” command tells the server just how to graph the data.

Usually the Munin node is written in Perl, however for an embedded system like the IP04 is was easier to use shell script. So I ported a version of that would run on the (somewhat limited) msh shell we currently use on the IP04. Michael provided a starting point for this code (written by Darryl Ross) – thanks Guys.

A simple plugin to report the number of Asterisk channels in use looks like this:
if [ "$1" = "autoconf" ]; then
echo yes
exit 0

if [ "$1" = "config" ]; then
echo 'graph_title Asterisk channels'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Channels'
echo 'graph_category asterisk'
echo 'channels.draw AREA'
echo 'channels.label registrations'
exit 0

echo -n "channels.value "
asterisk -rx 'show channels' 2>/dev/null | \
grep 'active channel' | awk '{ print $1 }'

Munin and Smokeping Demo

Here are some (static) copies of the Munin and Smokeping pages I have running on my internal network. Smokeping lets me check if I have basic connectivity to my nodes, Munin gather the vital statistics of each node:

Munin Demo
Smokeping Demo

You can see from the Smokeping demo a gap around 7am where my laptop (the Munin and master and Smokeping server) was switched off. You can also see that I currently can’t reach a few of the Air-stream nodes.

Here is the IP04 Munin node source (including plugins) for your perusal.

IP04 Munin Installation

root:~> ipkg update
root:~> ipkg install munin

You also need to install the Munin master on your x86 server. There is more information on Munin for the IP04 (including testing) in the BAPs Munin doc file.

Future Work

There is one plugin I would really like – a way to estimate speech quality on VOIP links. My idea is to have cron job place an automated call between the node and a remote server every few minutes. The cron job would then log some RTP statistics (jitter, lost packets) to a text file that a Munin plugin could then fetch. Can anyone please tell me how to extract RTP statistics from SIP calls in Asterisk? Another idea is to send a tone over the link (like app_milliwatt), then write an application to analyse the received tone at the server to determine if the tone is breaking up.

3 thoughts on “Monitoring Asterisk with Munin and Smokeping”

  1. Great news… have a look into the channel monitoring commands sip show channel or iax2 show channel. There are some values there: latency. But we really need is a way to measure quality, let me dig into IEEE papers and look for some metrics.

  2. Thanks Alberto.

    iax2 show channels gives some useful info but unfortunately this is missing from sip show channels.

    I figure automatic evaluation of a test call (i.e. with the tone quality method above) will be a good way to to test VOIP speech quality.

Comments are closed.