Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
server:monitoring
nagtrap
nagtrap-check_jobs-use_config.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File nagtrap-check_jobs-use_config.patch of Package nagtrap
Index: nagtrap-1.5.0/plugin/check_jobs.pl.in =================================================================== --- nagtrap-1.5.0.orig/plugin/check_jobs.pl.in +++ nagtrap-1.5.0/plugin/check_jobs.pl.in @@ -32,7 +32,7 @@ my $enableDebug = "0"; my $debugLogFile = "@logdir@/check_jobs.log"; # ==================== Variables ==================== -my ($opt_V, $opt_h, $opt_t, $opt_T); +my ($opt_V, $opt_h, $opt_t, $opt_T, $opt_f); my $PROGNAME = "check_jobs.pl"; my $version = "1.3"; my $dbQuery; @@ -62,6 +62,8 @@ sub print_usage (){ printf " seconds before the plugin times out (default=$TIMEOUT)\n"; printf " -V (--version)\n"; printf " Plugin version\n"; + printf " -f (--configfile)\n"; + printf " Use Database connection parameters stored in this file\n"; printf " -h (--help)\n"; printf " Print this help \n"; } @@ -113,6 +115,7 @@ GetOptions( "t=i" => \$opt_t, "timeout" => \$opt_t, "T=s" => \$opt_T, "type" => \$opt_T, "V" => \$opt_V, "version" => \$opt_V, + "f=s" => \$opt_f, "configfile=s" => \$opt_f, "h" => \$opt_h, "help" => \$opt_h); # ==================== Main ==================== @@ -130,6 +133,17 @@ alarm($TIMEOUT); &debug(0); +if (defined($opt_f) && -f $opt_f){ + use Config::Simple; + my $cfg = new Config::Simple("$opt_f"); + $dbHost = $cfg->{'_DATA'}{'default'}{'MYSQL_HOST'}[0] if (defined($cfg->{'_DATA'}{'default'}{'MYSQL_HOST'}[0])); + $dbName = $cfg->{'_DATA'}{'default'}{'MYSQL_DB'}[0] if (defined($cfg->{'_DATA'}{'default'}{'MYSQL_DB'}[0])); + $dbUser = $cfg->{'_DATA'}{'default'}{'MYSQL_USER'}[0] if (defined($cfg->{'_DATA'}{'default'}{'MYSQL_USER'}[0])); + $dbPass = $cfg->{'_DATA'}{'default'}{'MYSQL_PASS'}[0] if (defined($cfg->{'_DATA'}{'default'}{'MYSQL_PASS'}[0])); + $dbTable = $cfg->{'_DATA'}{'default'}{'MYSQL_TABLE'}[0] if (defined($cfg->{'_DATA'}{'default'}{'MYSQL_TABLE'}[0])); +} + + # Connect to the database. my $dbConnect = DBI->connect("DBI:mysql:database=$dbName;host=$dbHost","$dbUser","$dbPass") || die "ERROR - Can't connect to MySQL-Database: ".$DBI::errstr."\n";
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor