packages: nagios-plugin-check_amavis/check_amavis.cfg (NEW), nagios-plugin-...

glen glen at pld-linux.org
Thu Dec 22 12:28:01 CET 2011


Author: glen                         Date: Thu Dec 22 11:28:01 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- new

---- Files affected:
packages/nagios-plugin-check_amavis:
   check_amavis.cfg (NONE -> 1.1)  (NEW), check_amavis.pl (NONE -> 1.1)  (NEW), nagios-plugin-check_amavis.spec (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_amavis/check_amavis.cfg
diff -u /dev/null packages/nagios-plugin-check_amavis/check_amavis.cfg:1.1
--- /dev/null	Thu Dec 22 12:28:01 2011
+++ packages/nagios-plugin-check_amavis/check_amavis.cfg	Thu Dec 22 12:27:56 2011
@@ -0,0 +1,20 @@
+# Usage:
+# check_amavis
+define command {
+	command_name    check_amavis
+	command_line    /usr/lib/nagios/plugins/check_amavis --server $HOSTADDRESS$ $ARG1$
+}
+
+define service {
+	use                     generic-service
+	name                    amavis
+	service_description     amavis
+	register                0
+
+	normal_check_interval   5
+	retry_check_interval    1
+
+	notification_interval   10
+
+	check_command           check_amavis
+}

================================================================
Index: packages/nagios-plugin-check_amavis/check_amavis.pl
diff -u /dev/null packages/nagios-plugin-check_amavis/check_amavis.pl:1.1
--- /dev/null	Thu Dec 22 12:28:01 2011
+++ packages/nagios-plugin-check_amavis/check_amavis.pl	Thu Dec 22 12:27:56 2011
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+use Getopt::Long;
+use MIME::Entity;
+use Net::SMTP;
+
+my $server = '';
+my $port = 10024;
+my $from = '';
+my $to = '';
+my $debug = 0;
+
+$result = GetOptions (
+        "server|s=s"    =>      \$server,
+        "port|p=s"      =>      \$port,
+        "from|f=s"      =>      \$from,
+        "debug|d"      =>      \$debug,
+        "to|t=s"        =>      \$to,
+);
+
+if (!$server || !$from) {
+        die ("Please specify server, from\n");
+}
+
+if (!$to) { $to = $from; }
+
+my $EICAR = <<'EOF';
+X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
+EOF
+
+my $top = MIME::Entity->build(
+        Type    =>"multipart/mixed",
+        From    => $from,
+        To      => $to,
+        Subject => "EICAR test",
+        Data    => "This is a test",
+);
+
+$top->attach(
+        Data    => $EICAR,
+        Type    => "application/x-msdos-program",
+        Encoding        => "base64");
+
+my $smtp = new Net::SMTP(
+        $server,
+        Port => $port,
+        Debug => $debug,
+);
+
+if (!$smtp) {
+        print "CRITICAL - amavisd-new server unreachable\n";
+        exit;
+}
+
+$smtp->mail($from);
+$smtp->to($to);
+$smtp->data();
+$smtp->datasend($top->stringify);
+$smtp->dataend();
+my $result = $smtp->message();
+$smtp->close();
+
+if ($result =~/2.7.1 Ok, discarded/) {
+        print "OK - All fine\n"
+} else {
+        print "CRITICAL - amavisd-new returned $result";
+}

================================================================
Index: packages/nagios-plugin-check_amavis/nagios-plugin-check_amavis.spec
diff -u /dev/null packages/nagios-plugin-check_amavis/nagios-plugin-check_amavis.spec:1.1
--- /dev/null	Thu Dec 22 12:28:01 2011
+++ packages/nagios-plugin-check_amavis/nagios-plugin-check_amavis.spec	Thu Dec 22 12:27:56 2011
@@ -0,0 +1,57 @@
+# $Revision$, $Date$
+%define		plugin	check_amavis
+%include	/usr/lib/rpm/macros.perl
+Summary:	Nagios plugin to check amavisd-new daemon
+Name:		nagios-plugin-%{plugin}
+Version:	0.1
+Release:	0.1
+License:	?
+Group:		Networking
+# Source0Download:	http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1257&cf_id=24#/%{plugin}.pl
+Source0:	%{plugin}.pl
+# Source0-md5:	d6505313047810f0c907b784d70f31d7
+Source1:	%{plugin}.cfg
+URL:		http://exchange.nagios.org/directory/Plugins/Anti-2DVirus/Amavis/check_amavis/details
+BuildRequires:	rpm-perlprov >= 4.1-13
+Requires:	nagios-common
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define		_sysconfdir	/etc/nagios/plugins
+%define		plugindir	%{_prefix}/lib/nagios/plugins
+
+%description
+check_amavis checks if amavisd-new daemon is working and if its
+antivirus engine is working. This check talks with amavisd-new daemon.
+It tests if the daemon is up and if it's able to scan an email with a
+virus (EICAR test virus is sent).
+
+Please note that if amavisd-new is run on a different machine, you
+should enable the connection from nagios ip address (take a look at
+amavisd.conf).
+
+%prep
+%setup -qcT
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
+install -p %{SOURCE0} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
+%attr(755,root,root) %{plugindir}/%{plugin}
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2011/12/22 11:27:56  glen
+- new
================================================================


More information about the pld-cvs-commit mailing list