In our environment we use Barracuda Spam Firewalls to handle in and outbound mail delivery. Wanting to keep an eye on the in and outbound queues to make sure we are not seeing any delays with delivery I went looking for ways to monitor the queues and alert when they are above certain thresholds. Barracuda exposes the queue lengths in a number of ways (CGI/API, web interface and SNMP) and since we wanted this automated and we already use Nagios I chose to use SNMP. I tried some of the other SNMP plugins to try to use those, but after a bit of struggling without success I decided to write my own in PHP (mainly because that is what is easiest for me). Use the download link below to download a zip file of the plugin.
Or click on this link to see the code within this post.
Usage
Usage: check_cuda host-ip community-string queue warning-threshold critical-threshold
Queue can be either in, out or bounce
Warning and Critical values should be positive integers
Prerequisites
This plugin requires php_snmp support
Nagios Configuration
Commands
Define commands as shown below:
define command {
command_name Check Barracuda Inbound Mail Queue
command_line $USER1$/check_cuda $HOSTADDRESS$ public in 500 1000
}
define command {
command_name Check Barracuda Outbound Mail Queue
command_line $USER1$/check_cuda $HOSTADDRESS$ public out 500 1000
}
Obviously you will need to change the SNMP community string from public to match your community string. If you wish you could also add a check command to track the bounce queue. You may also want to use different warning and critical threshold than I did (500 and 1000 respectively). These numbers may not be right for your situation.
Contact Groups
Add a service group like the one below (customizing for your site of course):
# contactgroups Cuda Admins
define contactgroup {
contactgroup_name Cuda_Admins
alias Cuda_Admins
members joe,sally,fred
}
Service Templates
define service {
name Check Barracuda Mail Queue Template
use generic-service
contact_groups Cuda_Admins
register 0
}
Services
Add the service as needed to your hosts, sample shown below:
define service {
service_description Check Barracuda Inbound Mail Queue
use Check Barracuda Mail Queue Template
host_name yourcuda
check_command Check Barracuda Inbound Mail Queue
}
define service {
service_description Check Barracuda Outbound Mail Queue
use Check Barracuda Mail Queue Template
host_name yourcuda
check_command Check Barracuda Outbound Mail Queue
}
If you have any questions, comments or problems then just post a comment on this post and I’ll get back to you.
Update (January 2008)
There are now some additional plug-ins available to perform the same functions written in PERL and with hooks to graphing solutions. You can find them here.

Hi there , I found your blog on Yahoo while I was searching for barracuda firewall spam and your post regarding Nagios Plugin for Barracuda Spam Firewalls . It sounds very interesting and I learned a lot from your article , who did it write it? . I also writing articles about to fight spam on how to get rid of spam , I hope you like it also. Have a great Saturday !
I was searching for a barracuda plug-in for nagios, and ran across your article. I tried to download your plug-in, but it come up unavailable. Is the plugin missing?
Thanks
Scott Miller
Scott – thank you for letting me know! I had upgraded and apparently I forgot to put the files back. The files are back in place now. Thanks again for letting me know.
Mike
Whenever Nagios tries to run the check gets (Return code of 127 is out of bounds – plugin may be missing).
Have check_cuda in /usr/local/nagios/libexec/
Command Info
———————-
define command{
command_name Check Barracuda Inbound Mail Queue
command_line $USER1$/check_cuda $HOSTADDRESS$ public in 5 15
}
Host Config Info
———————–
define host{
contact_groups Cuda_Admins
host_name barracuda2
alias Inbound Barracuda Appliance
address barracuda2.dns.com
max_check_attempts 10
notification_interval 120
notification_period 24×7
}
Am new to Nagios in general so anything you can point me to look at would be greatly appreciated.
Bryan,
What I would suggest is to try to execute the script as the account which Nagios is running as. Usually Nagios runs under the nagios account. So while logged in as nagios (or su nagios) try to execute the script by running it. It would probably be something like /usr/local/nagios/libexec/check_cuda 1.2.3.4 public in 5 15
See if you get an error while running it this way. My guess is you will. Perhaps you will get a permission error or perhaps you don’t have php installed? Depending on what you get I can try to help from there.
Mike