#!/usr/local/bin/perl # nagios: +epn =pod =head1 NAME check_bluecoat_av.pl - Check basic status of a Bluecoat A/V device. =head1 DESCRIPTION This script will perform several basic checks on a Bluecoat A/V device; the script accepts warning and critical arguments that indicate low water marks for days left on the A/V device Antivirus license on the device. The device will return perfdata for the number of files scanned, the number of virii detected by the device, and the number of slow ICAP connections to the device from compatible Bluecoat proxy devices. =cut sub check_bluecoat_av { use strict; use FindBin; use lib "$FindBin::Bin/lib"; use Nagios::Plugin::SNMP; my $LABEL = 'BLUECOAT-AV'; my $USAGE = <new( 'shortname' => $LABEL, 'usage' => $USAGE ); $plugin->getopts; my $DEBUG = $plugin->opts->get('snmp-debug'); my $WARNING = $plugin->opts->get('warning'); $plugin->nagios_die('warning threshold is required!') if ! defined $WARNING; my $CRITICAL = $plugin->opts->get('critical'); $plugin->nagios_die('critical threshold is required!') if ! defined $CRITICAL; my %oids = qw( avFilesScanned.0 .1.3.6.1.4.1.3417.2.10.1.1.0 avVirusesDetected.0 .1.3.6.1.4.1.3417.2.10.1.2.0 avLicenseDaysRemaining.0 .1.3.6.1.4.1.3417.2.10.1.7.0 avSlowICAPConnections.0 .1.3.6.1.4.1.3417.2.10.1.10.0 ); my $results = $plugin->get(values %oids); my $files_scanned = $results->{$oids{'avFilesScanned.0'}}; my $virii_found = $results->{$oids{'avVirusesDetected.0'}}; my $days_left = $results->{$oids{'avLicenseDaysRemaining.0'}}; my $slow_icap = $results->{$oids{'avSlowICAPConnections.0'}}; # Close and destroy session $plugin->close(); my $level = OK; my $output = "$LABEL "; if ($days_left <= $CRITICAL) { $output .= "CRITICAL - license will expire soon! " . "($days_left days <= $CRITICAL days) "; $level = CRITICAL; } elsif ($days_left <= $WARNING) { $output .= "WARNING - license approaching expiration " . "($days_left days <= $CRITICAL days) "; $level = WARNING; } else { $output = "OK - $days_left days left on A/V license "; } print "$output | 'days'=$days_left;$WARNING;$CRITICAL " . "'scanned'=$files_scanned;0;0 " . "'virii'=$virii_found;0;0 " . "'slow_icap'=$slow_icap;0;0\n"; return $level; sub debug { return unless $DEBUG == 1; my $msg = shift; print STDERR scalar(localtime()) . ": $msg\n"; } } exit check_bluecoat_av();