Cacti and Exim – a (mostly) complete guide – Part 2

In Part 1 I covered getting Exim statistics into SNMP. In this part I’ll walk though setting up cacti so that it can monitor your exim server.

There’s various stages in setting up cacti to be able to access and graph the statistics we made available in part 1 of my guide. First we need to setup the Data Templates. The data templates tell cacti how it can access a certain bit of information and allows you to give it a description – for example defining that the number of messages in the mail queue can be accessed via an SNMP query to a certain OID. The next step is to define a Graph Template. A graph template allows you to setup a graph, and add your data items (defined as data templates) to the graph. The final, and optional step, is to setup a Host Template. A host template defines a list of graph templates that apply to a certain type of host – making it easier to setup graphs for new hosts.

Defining the Data Templates

Assuming you hadn’t editing the script from part 1 (and actually, I really imagine you’ll have wanted to), you will have the following data items in SNMP.

OID field name
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.1 greylistdefer
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.2 rcptreject
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.3 in
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.4 out
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.5 spam
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.6 virus
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.7 queued
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.8 bounces

Under ‘console’ in cacti, select ‘Data Templates’, and click ‘New’. You should get a screen as below:

Look carefully at the screen shot, and notice that I set the following:

  • a name of ‘Exim MX – Greylist Defers’
  • a data source name of ‘|host_description| – Greylist Defers’, where host_description will be replaced with the host’s description on use
  • Data Input Method was set to ‘Get SNMP Data’
  • ‘Internal Data Source Name’ is set to ‘greylistdefer’
  • ‘Data Source Type’ is set to ‘GUAGE’. Look at the rrdtool documentation for what this means.

When you click ‘create’, you’ll be presented with the same screen, but with a whole load of extra options. The only one of interest is the ‘OID’ field, were we need to enter the OID of the relevant data item. For our greylist defer, we need to enter ‘.1.3.6.1.4.1.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.1’.

This process needs repeating for every item we want to monitor, so in my case that’s everything from the table above.

Creating the Graph Template

From the console, click on ‘Graph Template’, then on ‘add’. You should then be presented with a screen as below:

Notice again I’ve filled in a few details here, the ‘Name’ and the ‘Title’. Click ‘create’, and you’ll get the same screen again with more options. Now we need to add graph template items. We will add a line to the graph, and after that we’ll add a legend – and we’ll repeat this for every item we want to show on the graph. First we’ll add the number of mails we get coming in.

In the screen shot, you should notice I’ve selected the correct data source, chosen a colour for our line, selected the item type as ‘LINE1’ and set the ‘Text Format’ to mail in. When we click on ‘add’, the ‘Graph Template Items’ section on the graph template will automatically have the data source added. Next we need to add the legend which will show the Average, Max and Current items on the graph. Click to add a new ‘Graph Template Item’. Fill in the form as shown below:

I have changed ‘GPRINT Type’ to ‘Exact number’ such that we don’t get decimal points showing on our graph. On clicking ‘add’, we will see the graph template screen again, which should look like this:

Repeat this step for all of the data items you wish to show on the graph, and that’s it – your graph template is complete. You should now be able to add this graph template to hosts!

Creating a Host Template

Creating a host template should be pretty self explanatory for you having followed the above steps, so I’ll simply show you a screenshot.

Hopefully, that’s all you should need to know! If you have any questions, feel free to post them below. It I don’t find time to answer, hopefully another guest to my site might 🙂

5 thoughts on “Cacti and Exim – a (mostly) complete guide – Part 2”

  1. I recently had to set up monitoring for a new Exim MX server at work. I wanted to make exim statistics available over SNMP such that I can easily hook it into cacti and nagios. Having recently been though the whole process from beginning to end, I t

  2. I got fairly far with your tutorial but ran into a problem attempting to actually get the graph working.

    I imported the xml template you provided and everything seemed fine until I went into the graph and turned on debugging and got an error from rrdtool:

    ERROR: parameter ‘#0000FFFF’ does not represent a number in line LINE1:#0000FFFF:Accepted

    Do you have any idea how to resolve this particular problem? I would greatly appreciate it.

  3. I have the same problem:
    RRDTool Says:

    ERROR: parameter ‘#12B3B5FF’ does not represent a number in line LINE1:#12B3B5FF:Accounts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.