Hi, Here are a few monitoring-related patches, developed while I was chasing the real monitoring problem. These won't fix monitoring in 1.5 by themselves, see spacewalk-list postings for why. Anyway:
0001-Add-additional-member-name-mappings-in-ProbeRecord-t.patch This fixes the errors seen when using rhn-runprobe to run a probe manually (Can't locate object method "hostname" via package "NOCpulse::Probe::Config::ProbeRecord") It also ensures than rhn-catalog outputs the hostname and host address when listing probes. 0003-Properly-dereference-the-array-references-for-old-an.patch This fixes junk output ("Rescanned directory: ARRAY(0x10be1600) current, ARRAY(0x10bbe090) old") in /var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log 0002-Since-autocommit-is-off-in-RHN-DB-add-explicit-commi.patch The NOCPulse-ini script shipped with spacewalk 1.5 does not actually change the config due to a lack of a dbh->commit call. This patch adds such calls. Regards, -- David Nutter Tel: +44 (0)131 650 4888 BioSS, JCMB, King's Buildings, Mayfield Rd, EH9 3JZ. Scotland, UK Biomathematics and Statistics Scotland (BioSS) is formally part of The James Hutton Institute (JHI), a registered Scottish charity No. SC041796 and a company limited by guarantee No. SC374831
>From 7a12dcd25e5e807788f92a3863ff6b5c86db38c3 Mon Sep 17 00:00:00 2001 From: David Nutter <dav...@elrond.bioss.sari.ac.uk> Date: Thu, 4 Aug 2011 17:06:41 +0100 Subject: [PATCH 1/3] Add additional member name mappings in ProbeRecord to ensure that the probe will run when rhn-runprobe is called. Changed ProbeCatalog to use correct hash key names when listing probes --- monitoring/NOCpulsePlugins/ProbeCatalog.pm | 6 +++--- .../PerlModules/NP/Probe/Config/ProbeRecord.pm | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/monitoring/NOCpulsePlugins/ProbeCatalog.pm b/monitoring/NOCpulsePlugins/ProbeCatalog.pm index 8b0c422..9dd00c6 100644 --- a/monitoring/NOCpulsePlugins/ProbeCatalog.pm +++ b/monitoring/NOCpulsePlugins/ProbeCatalog.pm @@ -35,10 +35,10 @@ sub describe { my $result; if ($probe_id) { $result = $probeHashRef->{RECID}.' '.$probeHashRef->{PROBE_TYPE};; - if ($probeHashRef->{hostName}) { - $result .= ' on '.$probeHashRef->{hostName}.' ('.$probeHashRef->{hostAddress}.')'; + if ($probeHashRef->{HOSTNAME}) { + $result .= ' on '.$probeHashRef->{HOSTNAME}.' ('.$probeHashRef->{HOSTADDRESS}.')'; } else { - $result .= ' on '.$probeHashRef->{hostAddress}; + $result .= ' on '.$probeHashRef->{HOSTADDRESS}; } $result .= ': '.$probeHashRef->{DESCRIPTION}; diff --git a/monitoring/PerlModules/NP/Probe/Config/ProbeRecord.pm b/monitoring/PerlModules/NP/Probe/Config/ProbeRecord.pm index 35a322e..ee764f4 100644 --- a/monitoring/PerlModules/NP/Probe/Config/ProbeRecord.pm +++ b/monitoring/PerlModules/NP/Probe/Config/ProbeRecord.pm @@ -54,6 +54,8 @@ my %FIELD_MAP = contactGroupCustomers => 'contact_group_customers', contactGroupNames => 'contact_group_names', hostAddress => 'host_ip', + HOSTADDRESS => 'host_ip', + HOSTNAME => 'host_name', hostName => 'host_name', hostRecid => 'host_id', parsedCommandLine => 'parameters', -- 1.7.4.1
>From e6830853187e5107001f310655e3c9e6df880a7c Mon Sep 17 00:00:00 2001 From: David Nutter <david.nut...@bioss.ac.uk> Date: Thu, 4 Aug 2011 17:09:10 +0100 Subject: [PATCH 2/3] Since autocommit is off in RHN::DB, add explicit commit to ensure our config changes are written to the database --- monitoring/SatConfig/general/NOCpulse-ini | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/monitoring/SatConfig/general/NOCpulse-ini b/monitoring/SatConfig/general/NOCpulse-ini index 3eb304d..12c8dda 100644 --- a/monitoring/SatConfig/general/NOCpulse-ini +++ b/monitoring/SatConfig/general/NOCpulse-ini @@ -103,6 +103,7 @@ if ($set_macro) { my $sth = $ini->dbh->prepare($sql); $sth->execute($new_value, $set_macro); print $sth->rows, " record updated.\n"; + $ini->dbh->commit(); $save = 1; } elsif ($set_param) { if (!@groups or scalar(@groups) != 1) { @@ -118,6 +119,7 @@ if ($set_macro) { my $sth = $ini->dbh->prepare($sql); $sth->execute($new_value, $groups[0], $set_param); print $sth->rows, " record updated.\n"; + $ini->dbh->commit(); $save = 1; } -- 1.7.4.1
>From f12607fa1b68c13c4585b25ba9cd7fd0c4cb6ac9 Mon Sep 17 00:00:00 2001 From: David Nutter <david.nut...@bioss.ac.uk> Date: Thu, 4 Aug 2011 17:09:59 +0100 Subject: [PATCH 3/3] Properly dereference the array references for old and new files so logfiles contain the number of files in the queue and not strings like "ARRAY(0x12323)" --- monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl b/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl index cd3be83..513716f 100755 --- a/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl +++ b/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl @@ -85,9 +85,9 @@ while (1) { } $last_scan_time = $now; - $Log->log(1, "Rescanned directory: ", - scalar($queue_manager->current_file_keys), " current, ", - scalar($queue_manager->old_file_keys), " old\n"); + $Log->log(1, "Rescanned directory: ", + scalar(@{$queue_manager->current_file_keys}), " current, ", + scalar(@{$queue_manager->old_file_keys}), " old\n"); } otherwise { my $err = shift; $ErrorOut->print("Problem scanning directory: $err\n"); @@ -181,8 +181,8 @@ while (1) { } # If there are no files, nod off for a while. - if (scalar($queue_manager->current_file_keys) == 0 - && scalar($queue_manager->old_file_keys) == 0) { + if (scalar(@{$queue_manager->current_file_keys}) == 0 + && scalar(@{$queue_manager->old_file_keys}) == 0) { $Log->log(1, "No current or old files, sleep ", NO_FILES_SLEEP, "\n"); $Log->flush(); -- 1.7.4.1
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel