Version 3 of the Barracuda plugin for Nagios
I have updated the Nagios plugin for Barracuda Spam & Virus firewalls to V3. This release has been tested under PHP5 and works with Barracuda firmware versions 3 and 4. Barracuda Networks changed their MIB with version 4 firmware and the plugin now supports the new OIDs or the old by way of a configuration setting within the plugin script. Read more below for details.
Installation
Place the check_cuda file in the nagios libexec folder along with all your other check plugins. Don’t forget to
set permissions and ownership as appropriate for your installation. Version 3 was tested under PHP5 and should work with either 4 or 5 by simply using check_cuda. Be sure to edit the check_cuda script and set the value of $cuda_firmware (line 10) to either 3 or 4 depending on the firmware version of the Barracdua Spam and Virus firewalls you will be using the plugin to check.
Usage
Usage: check_cuda <host-ip> <community-string> <queue> <warning-threshold> <critical-threshold>
Queue can be either in, out or bounce for firmware version 3 firewalls; for version 4 firewalls the values are
in, out, deferred or latency
Warning and Critical values should be positive integers
Prerequisites
This plugin requires php and php_snmp support (as noted this version has been tested with PHP 5)
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/deferred queue and even averagelatency on version 4 firmware. 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
}
Here is an excerpt from the Barracuda version 4 release notes that describes the new OID/Objects and their meanings:
| Object | Description |
|---|---|
| inQueueSize | Number of messages waiting to be processed by the Barracuda Spam & Virus Firewall |
| outQueueSize | Number of messages waiting to be sent to the mail server |
| deferredQueueSize | Number of messages deferred because they could not be processed, and will be requeued for processing |
| avgEmailLatency | Difference between the time a message was received by the Barracuda Spam & Virus Firewall and the time it is sent to the mail server |
A special note of thanks to Ray who pointed out that the plugin needed an update to support the new firmware and for testing the new version. Thanks Ray!


[...] the previous post for more details on usage, the only difference in this version is the SNMP error checking which [...]
I got the following warning message
PHP Warning: snmpget(): No response from 192.168.1.5 in /usr/lib/nagios/plugins/check_cuda on line 49
Wayne – I sent you an email directly, hopefully it wasn’t flagged as spam by your barracuda
For some reason after running the plugin I keep receiving the message back from nagios:
(No output returned from plugin)
Patrick,
How are you running the plugin, from the command line or within Nagios? Try it from the command line as the user account that Nagios run under. Typically no output is seen while running under nagios when the plugin cannot be found or cannot be executed by the account Nagios is running under. If you need further assistance then please send me the command you run from the command line (sanitizing IP and password as needed) and the results.
Mike
Something similar to Wayne’s error “Call to undefined function snmpget() in /usr/local/nagios/libexec/check_cuda on line 49″.
My Barracuda is model 300, runnig firmware 4.1.1.021 (2010-06-04) without SNMP serttings (at least I could not find those, and I looked everywhere), and your plugin seems to need snmp string present – could that affect communication?
Do you have PHP SNMP installed? It is required – http://php.net/manual/en/book.snmp.php
Can you try to access the Barracuda via SNMP at the command line (assuming you have SNMP utilitiles installed on Linux) …
snmpget -v2c -c public .1.3.6.1.2.1.1.1.0
Since public is the default community string this should work.
If you do want to change the community string see this – http://spamfilter.barracudanetworks.com/ns/downloads/Other/OTHER_Barracuda_Spam_&_Virus_Firewall_SNMP.4.pdf
If you can’t get SNMP at the command line to respond from the Nagios host then you may need to authorize the Nagios host to access the cuda via SNMP, fix a firewall rule or the like. If this works but the plug-in does not, make sure you have PHP SNMP installed, if that is OK too then send me the output of the command line along with details on how you are running the plugin. I’ll be happy to fix the plugin if that is the root of the problem.
Mike
Thanks for coming back to me.
I have done everything you advised (opened ports, reinstalled snmp, made sure smnpd runs) and I got stuck on the connectivity problem to my Barracuda. While running snmpget to my Nagios box returns correct results, and running same command to my Barracuda box returned connection timeout.
That lead me to double checking the snmp ports on Barracuda – and those ports are blocked, so no wonder the connection timeout. As there is nowhere to check SNMP settings on web interface I spoke to Barracuda support and they confirmed Barracuda 300 has no SNMP functionality at all.
One thing might be worth looking into to improve functionality of the plugin:
When I run command
# /usr/local/nagios/libexec/check_cuda xxx.xxx.xxx.2 public out 5 10
# PHP Warning: snmpget(): No response from xxx.xxx.xxx.2 in /usr/local/nagios/libexec/check_cuda on line 49
OUT OK – 0 messages queued |MailOUTQueue=0;5;10
It appears to me when no value is returned to plugin it takes it as “0″ and returns this info to Nagios while it doesn’t really know what is happening on the Barracuda.
Anyway, thanks a lot for your help!
I did add error checking with V3.1, hopefully you were using V3.0. If you were using V3.1 and still had this trouble please let me know so I can revisit that. Sorry your Cuda doesn’t have SNMP support, that stinks.
Best of luck,
Mike
Mike,
the error checking still has some bugs in it.
Checked on barracuda 300 (without SNMP)
Onaga:/usr/local/nagios/libexec# snmpget -v 2c -c public 192.168.40.10 .1.3.6.1.4.1.20632.2.2
Timeout: No Response from 192.168.40.10.
Onaga:/usr/local/nagios/libexec# ./check_cuda 192.168.40.10 public in 1 2
Warning: snmpget(): No response from 192.168.40.10 in /usr/local/nagios/libexec/check_cuda on line 49
Warning: printf(): Too few arguments in /usr/local/nagios/libexec/check_cuda on line 55
this is with version 3.1 of the script
when i delete %s on line 54 i get the following:
Onaga:/usr/local/nagios/libexec# ./check_cuda 192.168.40.10 public out 2 3
Warning: snmpget(): No response from 192.168.40.10 in /usr/local/nagios/libexec/check_cuda on line 49
Critical – SNMP response timeout
that looks better, supress the snmpget() warning from line 49 and it seems fine
kind regards
I have the eaxct same problem as Wayne above:
PHP Warning: snmpget(): No response from 192.168.104.10 in /usr/local/nagios/libexec/check_cuda5 on line 22
OUT OK – 0 messages queued |MailOUTQueue=0;1;5
Can you offer any help?
Thank you.
Bruce,
Seems like an SNMP issue. Here is the same email I sent Wayne:
snmpget -v2c -c 192.168.1.5 .1.3.6.1.2.1.1.1.0
Assuming you are using V4 firmware then public is the default community string and should work (once the right command is used – sorry about that).
If you do want to change the community string see this – http://spamfilter.barracudanetworks.com/ns/downloads/Other/OTHER_Barracuda_Spam_&_Virus_Firewall_SNMP.4.pdf
Are you sure your model of Barracuda has SNMP support?
Mike