Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
:
icinga
:
production
>
icinga-nagtrap
> nagtrap-1.5.0_plugin.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File nagtrap-1.5.0_plugin.patch of Package icinga-nagtrap
--- plugin/check_jobs.pl.in.orig 2013-11-02 12:34:30.935086664 +0100 +++ plugin/check_jobs.pl.in 2013-11-02 13:22:30.733689841 +0100 @@ -20,13 +20,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # -# ==================== Database connect information ==================== -my $dbHost = "localhost"; -my $dbName = "nagtrap"; -my $dbUser = "root"; -my $dbPass = ""; -my $dbTable = "snmptt_jobs"; - # ==================== Debugging ==================== my $enableDebug = "0"; my $debugLogFile = "@logdir@/check_jobs.log"; @@ -51,7 +44,14 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support); use Time::HiRes qw(time); use DBI(); - +# ==================== Database connect information ==================== +our $dbHost; +our $dbName; +our $dbUser; +our $dbPass; +our $dbTable; +our $dbTableUnknown; +require "/etc/nagtrap/plugin_db.conf"; # ==================== Functions ==================== # Print Usage sub print_usage (){ @@ -119,7 +119,17 @@ if ($opt_t) { $TIMEOUT=$opt_t; } - + +if ($opt_V) { + printf "$PROGNAME Version $version\n"; + exit $ERRORS{'OK'}; +} + +if ($opt_h) { + print_help(); + exit $ERRORS{'OK'}; +} + # Just in case of problems, let's not hang Nagios $SIG{'ALRM'} = sub { print "CRITCAL - Plugin Timed out\n"; @@ -136,12 +146,12 @@ &debug(1,"Connect to DB: TRUE"); if ($opt_T eq 'archived') { - $dbQuery = $dbConnect->prepare("SELECT jobstate, count, jobtime, message FROM $dbTable WHERE type='archive'"); + $dbQuery = $dbConnect->prepare("SELECT jobstate, count, jobtime, message FROM ${dbTable}_jobs WHERE type='archive'"); &debug(1,"Query: SELECT jobstate, count, jobtime, message FROM ".$dbTable." WHERE type='archive'"); $dbQuery->execute(); $jobResult = $dbQuery->fetchrow_hashref(); } elsif ($opt_T eq 'deleted') { - $dbQuery = $dbConnect->prepare("SELECT jobstate, count, jobtime, message FROM $dbTable WHERE type='delete'"); + $dbQuery = $dbConnect->prepare("SELECT jobstate, count, jobtime, message FROM ${dbTable}_jobs WHERE type='delete'"); &debug(1,"Query: SELECT jobstate, count, jobtime, message FROM ".$dbTable." WHERE type='delete'"); $dbQuery->execute(); $jobResult = $dbQuery->fetchrow_hashref(); --- plugin/check_snmptraps.pl.in.orig 2013-11-02 12:34:21.551088535 +0100 +++ plugin/check_snmptraps.pl.in 2013-11-02 13:06:10.584945654 +0100 @@ -20,14 +20,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # -# ==================== Database connect information ==================== -my $dbHost = "localhost"; -my $dbName = "snmptt"; -my $dbUser = "<YOUR DB USER>"; -my $dbPass = "<YOUR DB PASSWORD>"; -my $dbTable = "snmptt"; -my $dbTableUnknown = "snmptt_unknown"; - # ==================== Debugging ==================== my $enableDebug = "0"; my $debugLogFile = "@logdir@/check_snmptraps.log"; @@ -67,7 +59,14 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support); use Time::HiRes qw(time); use DBI(); - +# ==================== Database connect information ==================== +our $dbHost; +our $dbName; +our $dbUser; +our $dbPass; +our $dbTable; +our $dbTableUnknown; +require "/etc/nagtrap/plugin_db.conf"; # ==================== Functions ==================== # Print Usage sub print_usage (){ --- plugin/Makefile.in.orig 2013-11-02 12:37:12.738512929 +0100 +++ plugin/Makefile.in 2013-11-02 12:38:01.450322856 +0100 @@ -38,6 +38,7 @@ install: for file in *.pl; \ do $(INSTALL) -m 755 $(INSTALL_OPTS) $$file $(DESTDIR)$(MONITORING_LIBEXECDIR); done + $(INSTALL) -m 644 $(INSTALL_OPTS) plugin_db.conf $(DESTDIR)$(SYSCONFDIR) clean: rm -f Makefile --- plugin/plugin_db.conf.orig 2013-11-02 13:06:43.208934628 +0100 +++ plugin/plugin_db.conf 2013-11-02 13:05:54.924935016 +0100 @@ -0,0 +1,6 @@ +$dbHost = "localhost"; +$dbName = "snmptt"; +$dbUser = "<YOUR DB USER>"; +$dbPass = "<YOUR DB PASSWORD>"; +$dbTable = "snmptt"; +$dbTableUnknown = "snmptt_unknown";