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.
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 ‘.220.127.116.11.4.1.8607.64.4.1.18.104.22.168.22.214.171.124.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 🙂