freebsd-ports/net-mgmt/nagios-portaudit/files/patch-check_portaudit-add_perfdata
Philip M. Gollucci f67a2705e6 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)
2008-08-22 16:44:18 +00:00

20 lines
757 B
Text

--- 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});