CACTI Monitoring of xAP

cacti is a great monitoring tool wouldn't it be cool if ANY xAP data value could be monitored?

With a xAP caching Lua applet running as a plugboard script on the HAH and one small python script for CACTI to use this indeed is possible.

The first step is to set-up and configure Lua script xapCacheWebserverApplet.lua which will cache an xAP data value and provide a URL for later accessing.

The script is supplied as a sample in the /etc_ro_fs/plugboard/samples directory on the HAH, it's also available as a post on the forum

Here is how to we modify the VFS configuration to capture data we are interested in.

local vfs = {
      xap.Filter{["xap-header"] = {
                    source="dbzoo.livebox.Controller:1wire.*", class="xAPBSC.event" }
      xap.Filter{["xap-header"] = {
                    source="dbzoo.nanode.>", class="xAPBSC.event" }
      xap.Filter{["xap-header"] = {
                    source="dbzoo.livebox.jeenode:>", class="xAPBSC.event" }

Read more about the filter class and pattern matching.

After restarting the plugboad engine we can point our web browser at


and see the xAP frames being cached.

Once some xAP messages have been cached you should see a web page like this:

Cached xap-header source keys


The installation of CACTI is beyond the scope of this document and I'll assume you already have it setup and running, there are many guides our there to show you how to install this product. I will however show how I did it.

Installing Cacti on CentOS6

For CentOS6.x installing is a snap

If you don't already have the EPEL repository installed into /etc/yum.repos.d/ then do this first.

rpm -Uvh

Check how to install for older release and Fedora @

Then install cacti

yum install cacti

You need to include one custom script that will called by the cacti data poller to reach our to our LUA caching web applet to grab xAP data values.

On my system this script appear on a linux server at: /var/lib/cacti/scripts/ don't forget to set the permission bits

[root@wombat scripts]# ls -l
-rwxr-xr-x 1 root root 588 Jun 20 16:14
[root@wombat scripts]#

You'll need to make one modification to this code and update the HARDCODED IP address to point to you HAH system.

# QUERY the xapCache
# Usage:
# ./ dbzoo.arduino.temp input.state text
import sys
import time
import urllib2
def getValue(target,section,key):
        f = urllib2.urlopen("http://livebox.local:8080/%s/%s/%s" % (target,section,key))
        ret =
        if key == "state":
            if ret == "on": return 1
        elif ret:
            return ret
        return 0
if len(sys.argv) < 3:
        out="value:%s" % getValue(sys.argv[1], sys.argv[2], sys.argv[3])
# Useful for debugging
#f = open("/var/log/cacti/xapquery.log","a")
#f.write("%s: %s %s\n" % (time.ctime(), sys.argv, out))
print out

We can verify that the script it working correctly and that the LUA xAP caching applet it working by running a simple test. I'm assuming here that you have a 1wire temperature sensor connected. Adjust this test for a suitable endpoint if you don't.
The arguments are <TARGET> <SECTION> <KEY>

[root@wombat scripts]# ./ dbzoo.livebox.Controller:1wire.1 input.state text
[root@wombat scripts]#

Create external xAP data template

First we need to register this external script by adding a new Collection Method

Once we have select the ADD hyperlink complete the following form, this sets up the external script and configures 1 output value and 3 input values.

Now we need to create a DATA Template - you can see we will add a xAPQuery item here.

Give the data template a name - I've called my simply xAPQuery and attached the “DATA INPUT METHOD” we created earlier.

Creating a data source

Now the template is in PLACE we can create a DATA SOURCE, this is the thing that collects data about some xAP endpoint we define. You can see I've already created some early and they appear as listed items in the table below.

For each xAP data value you want to collect data on repeat this process. You will perform this action for each Filter you created in the xAP LUA data cache.

To create the data source to we use the xAPQuery template we defined earlier.

Want we are going to collect is the outside temperature reading from the 1wire device. Complete the form and press CREATE. Here we supply the xAP TARGET, SECTION and KEY.

One the create button has been pressed we can provide addition data to the xAPQuery script that collect this data.

Creating a GRAPH

Now the exciting bit we create graph to plot the information gathered. You can delete and create new graph without affecting the data that is being collected, so feel free to experience in this section on your own. The image below shows the graphs that I have registered.

Use the ADD hyperlink to create a new graph

We don't have any predefined graph template or host we need to attached this data to.

Give your graph a TITLE

Now press ADD so that we can attach the DATA SOURCES to this graph

Now we attach the DATA SOURCE we created early as a graph data item.

Putting it on the Graph Console Tab

That's all there is to it!

I like to poll every minute instead of the default 5 mins.

Then make an adjustment to your cron file to fire the poller every minute.

# cat /etc/cron.d/cacti
0-59 * * * *    cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1