--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.in Wed Jun 11 08:56:38 2008 +0000
@@ -0,0 +1,26 @@
+SCRIPTS = check_avwebgate
+CLEANFILES = ${SCRIPTS}
+DESTDIR =
+prefix = !prefix!
+
+plugindir = ${prefix}/lib/nagios/plugins/ius
+
+.PHONY: all clean install
+
+all: ${SCRIPTS}
+
+clean:
+ -rm -f ${CLEANFILES}
+
+install: all
+ install -d -m 0755 ${DESTDIR}/${plugindir}
+ install -m 0755 $(SCRIPTS) ${DESTDIR}/${plugindir}/
+
+%: %.pl
+ @perl -c $<
+ @cp -f $< $@
+ @chmod +x $@
+
+%: %.sh
+ @cp -f $< $@
+ @chmod +x $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/check_avwebgate.pl Wed Jun 11 08:56:38 2008 +0000
@@ -0,0 +1,109 @@
+#! /usr/bin/perl -w
+# $Id$
+# $URL$
+
+use strict;
+use File::Basename;
+use Getopt::Long;
+use LWP::Simple;
+
+use lib "/usr/lib/nagios/plugins";
+use utils qw (%ERRORS &print_revision &support);
+
+sub print_help();
+sub print_usage();
+
+my $ME = basename $0;
+my ( $opt_u, $opt_s, $opt_V, $opt_h, $opt_b );
+my ( $result, $found, $message, $version, $current_version );
+my ( @webside );
+
+$opt_u = "http://www.avira.com/de/downloads/avira_antivir_unix_webgate.html";
+$opt_s = ">Avira AntiVir UNIX WebGate<";
+$opt_b = "/usr/lib/AntiVir/avwebgate.bin";
+
+Getopt::Long::Configure('bundling');
+GetOptions(
+ "V" => \$opt_V,
+ "version" => \$opt_V,
+ "h" => \$opt_h,
+ "help" => \$opt_h,
+ "b=s" => \$opt_b,
+ "binary" => \$opt_b,
+ "u=s" => \$opt_u,
+ "url=s" => \$opt_u,
+ "s=s" => \$opt_s,
+ "search=s" => \$opt_s
+);
+
+if ($opt_V) {
+ print_revision( $ME, "0.1" );
+ exit $ERRORS{"OK"};
+}
+
+if ($opt_h) {
+ print_help();
+ exit $ERRORS{"OK"};
+}
+
+# check avwebgate binary
+unless ( -x $opt_b ) {
+ print "AVWEBGATE CRITICAL: AntiVir WebGate not found or not executable - $opt_b\n";
+ exit $ERRORS{"CRITICAL"};
+}
+
+# download the webside
+push @webside, split("\n", get($opt_u));
+
+foreach (@webside) {
+ unless ($found) {
+ /$opt_s/ or next;
+ $found = 1;
+ next;
+ }
+ /Version:\s([\d\.-]+).*/ or next;
+ $version = $1 and last;
+}
+
+unless ($version) {
+ print "AVWEBGATE CRITICAL: cannot get version info from avira server\n";
+ exit $ERRORS{"CRITICAL"};
+}
+
+$_ = `$opt_b --version`;
+if ($_ =~ /product version:\s+(\S+)/) { $current_version = $1; }
+
+$result = ($current_version eq $version) ? "OK" : "WARNING";
+
+if ($result eq "WARNING") {
+ $message = "new version available: $version";
+ print "AVWEBGATE $result: $message\n";
+ exit $ERRORS{$result};
+} else {
+ $message = "current version: $current_version";
+ print "AVWEBGATE $result: $message\n";
+ exit $ERRORS{$result};
+}
+
+sub print_usage() {
+ print "Usage:\n";
+ print " $ME [-b <binary>] [-u <url>] [-s <search>\n";
+ print " $ME [-h | --help]\n";
+ print " $ME [-V | --version]\n";
+}
+
+sub print_help() {
+ print_revision( $ME, "0.1" );
+ print "Copyright (c) 2008 Christian Arnold\n\n";
+ print "This plugin checks for new versions of Avira AntiVir WebGate.\n\n";
+ print_usage();
+ print "\n";
+ print " -b, --binary <binary>\n";
+ print " Path of AntiVir WebGate binary (default: /usr/lib/AntiVir/avwebgate.bin)\n";
+ print " -u, --url <url>\n";
+ print " URL where will be look for the search string (default: http://www.avira.com/de/downloads/avira_antivir_unix_webgate.html)\n";
+ print " -s, --search <search>\n";
+ print " Search string on the url (default: >Avira AntiVir UNIX WebGate<)\n";
+ print "\n";
+ support();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/configure Wed Jun 11 08:56:38 2008 +0000
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+prefix=/usr/local
+
+tmp=`getopt -n $0 -o p: -l prefix: -- "$@"`
+eval set -- $tmp
+
+while true; do
+ o="$1"; shift
+ case "$o" in
+ -p|--prefix) prefix="$1"; shift;;
+ --) break;;
+ esac
+done
+
+perl -pe "s{!prefix!}{$prefix}g" < Makefile.in > Makefile