New Template - OpenBSD Spamd

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
tymbow
Cacti User
Posts: 54
Joined: Sat May 14, 2005 8:00 pm

New Template - OpenBSD Spamd

Post by tymbow »

I have built a new template to graph statistics for OpenBSD Spamd (Spam Deferral Daemon). The template produces output similar to the attached (the look and feel is based on RRDTool scripts written by Christopher Kruslicky).

Like many others here, the core of this template is based on the script for Net-SNMP written by Martin Adolfsson. My version of the script has been cleaned up to make it more friendly and includes debugging which can be activated by using the "-v" switch. Note that debugging should only be run when testing the script from the command line.

One other thing, the script requires "Getopt::Long". I think this is part of most Perl distributions but if not use the perl package manager to install it from CPAN.

Code: Select all

perl -MCPAN -e shell
install Getopt::Long
To install:

1. Get you Spamd and Net-SNMP working and make sure Spamd is logging. A sample Spamd configuration is on my web site at http://www.napthali.com/ramblings/openbsd.aspx#spamd however there are plenty of other examples on the net.

2. Copy the script to your server and make sure it is executable. I suggest "/usr/local/sbin".

3. Edit the script to suit the paths, MIN_RESET value and OID you wish to use. Note particularly that MIN_RESET should be set slightly less than the polling interval. The defaults assume a 5 minute polling interval:

Code: Select all

MIN_RESET is "240"
Base OID is ".1.3.6.1.4.1.2021.256"
Spamd log file is "/var/log/spamd"
Data file (used for caching) is "/var/db/spamd-data.db"
4. Add the following line to your "snmpd.conf" file:

Code: Select all

pass .1.3.6.1.4.1.2021.256 /usr/local/sbin/get-spamd-data.pl 
5. Run a basic test as follows:

Code: Select all

# /usr/local/sbin/get-spamd-data.pl -v -g .1.3.6.1.4.1.2021.256.0

DEBUG : [2008-11-26 06:41:02] : Starting.
DEBUG : [2008-11-26 06:41:02] : Testing logfile "/var/log/spamd" exists
DEBUG : [2008-11-26 06:41:02] : Getting last update time and log file position
DEBUG : [2008-11-26 06:41:02] : Last update time is: 59
DEBUG : [2008-11-26 06:41:02] : Log position is: 35408
DEBUG : [2008-11-26 06:41:02] : Outputting SNMP data
DEBUG : [2008-11-26 06:41:02] : SNMP Base OID is : .1.3.6.1.4.1.2021.256
DEBUG : [2008-11-26 06:41:02] : SNMP Request OID is : .1.3.6.1.4.1.2021.256.0
DEBUG : [2008-11-26 06:41:02] : SNMP Method is : -g
.1.3.6.1.4.1.2021.256.0
integer
0
DEBUG : [2008-11-26 06:41:02] : Finishing.
6. You may also want to run a test using SNMPGET as follows:

Code: Select all

# snmpget -v1 -c community localhost .1.3.6.1.4.1.2021.256.0
UCD-SNMP-MIB::ucdavis.256.0 = INTEGER: 1
7. Load the template into Cacti

8. Add the template to a host and create a graph.

9. After a few cycles the graph should have some data to view.

Please note that my own mail server does not receive enough mail to assist testing so I did much of my testing using "generated" data. The numbers seem to be correct so I trust the template is correct. Post here if there are any issues and I'll try to fix them. As noted, this template assumes a 5 minute polling interval. If you use a different interval you will have to modify the MIN_RESET value in the script and probably the multiplier used in the "Spamd (5 Minute Polling)" CDEF.

To get the "look" right I had to do create manual CDEFS for the "Spamd - Adjust Time (T1)", "Spamd - Adjust Time (T2)" and "Spamd - Adjust Time (T3)" CDEFs so if you muck about with the template you may have to change these CDEFs so they point to the right sources.

The graph shows the following:

- Number of open connections for the period.
- Connection time for all connections for the period.
- Number of hosts whitelisted for the period.
- Number of hosts that are in a blacklist for the period.
Attachments
Sample Spamd Graph
Sample Spamd Graph
spamd.png (82.34 KiB) Viewed 2627 times
get-spamd-data.pl
Spamd Perl Script
(10.77 KiB) Downloaded 254 times
spamd_template.xml
Spamd Cacti Template
(38.49 KiB) Downloaded 212 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest