This is a small Nagios plugin. This plugin relies on portaudit

and/or portupgrade packages to be installed on your FreeBSD system.
With these packages installed, the plugin will scan your system for
either vulnerable packages, or obsolete packages - and display
appropriate warnings to Nagios.

Portaudit can also be successfully run remotely from nrpe, and does
not require superuser privileges to operate.

WWW: http://www.geocities.com/ntb4real/proj/portaudit.htm

PR:             ports/126710
Submitted by:   Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Approved by:    gabor (mentor)
This commit is contained in:
Philip M. Gollucci 2008-08-22 16:44:18 +00:00
parent 1a24ed1336
commit f67a2705e6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=218999
6 changed files with 88 additions and 0 deletions

View File

@ -111,6 +111,7 @@
SUBDIR += nagios-geom
SUBDIR += nagios-pf-plugin
SUBDIR += nagios-plugins
SUBDIR += nagios-portaudit
SUBDIR += nagios-radauth-plugin
SUBDIR += nagios-silfreed-plugins
SUBDIR += nagios-snmp-plugins

View File

@ -0,0 +1,52 @@
# New ports collection makefile for: nagios-portaudit
# Date created: 19 August 2008
# Whom: rea-fbsd@codelabs.ru
#
# $FreeBSD$
#
PORTNAME= portaudit
PORTVERSION= 1.0
CATEGORIES= net-mgmt
MASTER_SITES= http://www.geocities.com/ntb4real/proj/
PKGNAMEPREFIX= nagios-
DISTNAME= check_portaudit
MAINTAINER= rea-fbsd@codelabs.ru
COMMENT= Nagios plug-in to get portaudit/portupgrade status
OPTIONS= PORTAUDIT "Enable portaudit check" ON \
PORTUPGRADE "Enable portupgrade check" ON \
PORTUPGRADE_DEVEL "Use portupgrade-devel" OFF
USE_PERL5= yes
NO_WRKSUBDIR= yes
NO_BUILD= yes
.include <bsd.port.pre.mk>
.if !defined(WITH_PORTUPGRADE) && !defined(WITH_PORTAUDIT) && !defined(WITH_PORTAUDIT_DEVEL)
IGNORE= unusable without portupgrade and portaudit
.endif
.if defined(WITH_PORTUPGRADE) && defined(WITH_PORTUPGRADE_DEVEL)
IGNORE= choose either portupgrade or portupgrade-devel, not both
.endif
.if defined(WITH_PORTAUDIT)
RUN_DEPENDS+= portaudit:${PORTSDIR}/ports-mgmt/portaudit
.endif
.if defined(WITH_PORTUPGRADE)
RUN_DEPENDS+= portupgrade:${PORTSDIR}/ports-mgmt/portupgrade
.endif
.if defined(WITH_PORTUPGRADE_DEVEL)
RUN_DEPENDS+= portupgrade:${PORTSDIR}/ports-mgmt/portupgrade-devel
.endif
do-install:
@${MKDIR} ${PREFIX}/libexec/nagios
${INSTALL_SCRIPT} ${WRKSRC}/check_portaudit ${PREFIX}/libexec/nagios
.include <bsd.port.post.mk>

View File

@ -0,0 +1,3 @@
SIZE (check_portaudit.tar.gz) = 2483
MD5 (check_portaudit.tar.gz) = 4080abff3089dbce2f1b1080705b8b6f
SHA256 (check_portaudit.tar.gz) = d23d67f0be5d535cce35e3ff7cd4bb00277ec5821982b6843fbcbc573bcffec7

View File

@ -0,0 +1,20 @@
--- check_portaudit.orig 2007-06-07 11:54:21.000000000 +0400
+++ check_portaudit 2008-08-19 21:23:03.000000000 +0400
@@ -56,6 +56,7 @@
my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
my $state="UNKNOWN";
my $msg="FAILURE";
+my $perfdata="";
#################LOCATION OF IMPORTANT FILES#######################
my $portauditloc="/usr/local/sbin/portaudit";
@@ -192,6 +193,7 @@
}
### take this message to Nagios
-$msg = sprintf "%s : %s %s %s\n", $command, $packcount, $pkgtype, $msglist;
-print $state, " ", $msg;
+$msg = sprintf "%s : %s %s %s", $command, $packcount, $pkgtype, $msglist;
+$perfdata = sprintf "%s=%d;1;;0;", $pkgtype, $packcount;
+print $state, " ", $msg, "|", $perfdata,"\n";
exit ($ERRORS{$state});

View File

@ -0,0 +1,10 @@
This is a small Nagios plugin. This plugin relies on portaudit
and/or portupgrade packages to be installed on your FreeBSD system.
With these packages installed, the plugin will scan your system for
either vulnerable packages, or obsolete packages - and display
appropriate warnings to Nagios.
Portaudit can also be successfully run remotely from nrpe, and does
not require superuser privileges to operate.
WWW: http://www.geocities.com/ntb4real/proj/portaudit.htm

View File

@ -0,0 +1,2 @@
libexec/nagios/check_portaudit
@dirrmtry libexec/nagios