9 commits - monitoring/PerlModules
by Miroslav Suchý
monitoring/PerlModules/NP/Probe/monitoring-data-cleanup | 161 +++++++++++++++
monitoring/PerlModules/NP/Probe/perl-NOCpulse-Probe.spec | 5
2 files changed, 165 insertions(+), 1 deletion(-)
New commits:
commit 669c2b6fc07eb452f5cd26506d711993bf51dbf4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 14:12:09 2009 +0200
520101 - add description section to man page
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
index 28b40f7..41a72b6 100755
--- a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -116,6 +116,13 @@ monitoring-data-cleanup [OPTIONS]
=head1 DESCRIPTION
+This script delete data from monitoring probes older than given time frame.
+It can be useful to run from cron to periodicaly delete data which is not
+interested for you.
+
+Additionaly - in Spacewalk 0.5 and older we did not deletes data when probe
+has been deleted. And if you did not push scout configs you will be getting
+data for deleted probes too. This script will delete them too.
=head1 OPTIONS
commit 98230aa9238bb3c40633d69a022735604f4675d9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 14:00:06 2009 +0200
520101 - rename --delete-before to --keep-monitoring-data
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
index a924ca7..28b40f7 100755
--- a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -33,7 +33,7 @@ my ($sql, $err, $sth);
GetOptions(
"delete-unmatched!" => \$delete_unmatched,
"dry-run" => \$dry_run,
- "delete-before:s" => \$delta,
+ "keep-monitoring-data:s" => \$delta,
"help" => \$help,
);
@@ -42,6 +42,7 @@ if ($help) {
Usage:
monitoring-data-cleanup --no-delete-unmatched
+ monitoring-data-cleanup --keep-monitoring-data "1Y 6M"
HELP
exit;
}
@@ -125,7 +126,7 @@ monitoring-data-cleanup [OPTIONS]
--no-delete-unmatched
Delete data from probes, which have been already deleted. Default is to delete them.
---delete-before DELTA
+--keep-monitoring-data DELTA
Delete data older than DELTA. Recognized deltas are of the form:
+Yy +Mm +Ww +Dd +Hh +MNmn +Ss
Examples:
commit d7c805b064562fbf376880d43c08668b0a3aaee3
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 13:53:41 2009 +0200
520101 - add monitoring-data-cleanup to package perl-NOCpulse-Probe
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
old mode 100644
new mode 100755
diff --git a/monitoring/PerlModules/NP/Probe/perl-NOCpulse-Probe.spec b/monitoring/PerlModules/NP/Probe/perl-NOCpulse-Probe.spec
index e3aff97..784a8d8 100644
--- a/monitoring/PerlModules/NP/Probe/perl-NOCpulse-Probe.spec
+++ b/monitoring/PerlModules/NP/Probe/perl-NOCpulse-Probe.spec
@@ -33,7 +33,8 @@ mkdir -p $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Utils/test
mkdir -p $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/SNMP/test
mkdir -p $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/test
-install -m 755 -D rhn-runprobe $RPM_BUILD_ROOT/%{_bindir}/rhn-runprobe
+install -m 755 -D rhn-runprobe $RPM_BUILD_ROOT%{_bindir}/rhn-runprobe
+install -m 755 monitoring-data-cleanup $RPM_BUILD_ROOT%{_bindir}/monitoring-data-cleanup
install -m 644 Config/*.pm $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Config/
install -m 644 Config/test/*.pm $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Config/test/
install -m 644 DataSource/*.pm $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/DataSource/
@@ -57,6 +58,7 @@ mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3
/usr/bin/pod2man $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Shell/SQLPlus.pm |gzip > $RPM_BUILD_ROOT%{_mandir}/man3/NOCpulse::Probe::Shell::SQLPlus.3pm.gz
/usr/bin/pod2man $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Shell/Local.pm |gzip > $RPM_BUILD_ROOT%{_mandir}/man3/NOCpulse::Probe::Shell::Local.3pm.gz
/usr/bin/pod2man $RPM_BUILD_ROOT%{perl_vendorlib}/NOCpulse/Probe/Shell/Unix.pm |gzip > $RPM_BUILD_ROOT%{_mandir}/man3/NOCpulse::Probe::Shell::Unix.3pm.gz
+/usr/bin/pod2man $RPM_BUILD_ROOT/%{_bindir}/monitoring-data-cleanup | gzip > $RPM_BUILD_ROOT%{_mandir}/man3/monitoring-data-cleanup.3pm.gz
%clean
rm -rf $RPM_BUILD_ROOT
@@ -64,6 +66,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/rhn-runprobe
+%{_bindir}/monitoring-data-cleanup
%dir %{perl_vendorlib}/NOCpulse
%{perl_vendorlib}/NOCpulse/*
%{_mandir}/man3/*
commit aa0065d9e98653c8abb36c1c2598251517b991b0
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 13:01:49 2009 +0200
520101 - optimize sql query per mmraka recommendation
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
index 95dc243..a924ca7 100644
--- a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -70,12 +70,13 @@ if ($delete_unmatched) {
$ini->dbh->begin_work;
print "Deleting data from already deleted probes...\n";
$sql = qq|
- delete from time_series
- where time_series.rowid in (
- select time_series.rowid from time_series
- left join rhn_probe
- on SUBSTR(O_ID,INSTR(O_ID,'-')+1,(INSTR(O_ID,'-',INSTR(O_ID,'-')+1)-INSTR(O_ID,'-'))-1) = rhn_probe.recid
- where rhn_probe.recid is null
+ delete from time_series
+ where not exists (
+ select 1 from rhn_probe
+ where substr(time_series.o_id,
+ instr(time_series.o_id,'-')+1,
+ (instr(time_series.o_id,'-',instr(time_series.o_id,'-')+1)-instr(time_series.o_id,'-'))-1
+ ) = rhn_probe.recid
)
|;
$sth = $ini->dbh->prepare($sql);
commit 0c36040ecaeab46753602c3cafe367d35b8aef59
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 12:07:27 2009 +0200
520101 - fill in documention for --dry-run and --delete-before DELTA
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
index 02c11b2..95dc243 100644
--- a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -117,14 +117,27 @@ monitoring-data-cleanup [OPTIONS]
=head1 OPTIONS
+--dry-run
+ No changes will be commited. All data will remain intact.
+
--delete-unmatched
--no-delete-unmatched
Delete data from probes, which have been already deleted. Default is to delete them.
+--delete-before DELTA
+ Delete data older than DELTA. Recognized deltas are of the form:
+ +Yy +Mm +Ww +Dd +Hh +MNmn +Ss
+ Examples:
+ "1year 2 months 3hours"
+ "2 business days"
+ For more information about format see ParseDateDelta section of Date::Manip(3)
+
--help
Display this help.
-=head1 EXAMPLES
+=head1 SEE ALSO
+
+Date::Manip(3)
=head1 AUTHOR
commit 19436226f323337e6e6a31a814101184b763105a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 11:55:15 2009 +0200
520101 - rename delete-old-probes to monitoring-data-cleanup
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
index cac88f6..02c11b2 100644
--- a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -40,7 +40,7 @@ GetOptions(
if ($help) {
print <<HELP;
Usage:
- delete-old-probes --no-delete-unmatched
+ monitoring-data-cleanup --no-delete-unmatched
HELP
exit;
@@ -106,11 +106,11 @@ if ($delta) {
=head1 NAME
-delete-old-probes - Delete unused and old data from monitoring probes.
+monitoring-data-cleanup - Delete unused and old data from monitoring probes.
=head1 SYNOPSIS
-delete-old-probes [OPTIONS]
+monitoring-data-cleanup [OPTIONS]
=head1 DESCRIPTION
commit fbf34a16223f614a3d0b8ba1b250b8ffffa37772
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 11:53:43 2009 +0200
520101 - rename delete-old-probes to monitoring-data-cleanup
diff --git a/monitoring/PerlModules/NP/Probe/delete-old-probes b/monitoring/PerlModules/NP/Probe/delete-old-probes
deleted file mode 100644
index cac88f6..0000000
--- a/monitoring/PerlModules/NP/Probe/delete-old-probes
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/perl
-use strict;
-#
-# Copyright (c) 2009 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-use lib '/etc/rc.d/np.d';
-use NOCpulse::NOCpulseini;
-use PhysCluster;
-
-use Date::Manip;
-use Getopt::Long;
-
-#set the defaults
-my $delete_unmatched = 1;
-my $delta = "";
-my $dry_run = 0;
-my $help = 0;
-
-my ($sql, $err, $sth);
-
-GetOptions(
- "delete-unmatched!" => \$delete_unmatched,
- "dry-run" => \$dry_run,
- "delete-before:s" => \$delta,
- "help" => \$help,
- );
-
-if ($help) {
- print <<HELP;
-Usage:
- delete-old-probes --no-delete-unmatched
-
-HELP
- exit;
-}
-if ($dry_run) {
- print "Warning: Dry run active - no changes will be made.\n";
-}
-
-my $cluster = PhysCluster->newInitialized('/etc/rhn/cluster.ini');
-my $localConfig = $cluster->get_LocalConfig;
-my $ini = NOCpulse::NOCpulseini->new;
-
-if (%$localConfig) {
- my $config = (values(%$localConfig))[0];
- my $dbd = $config->get_dbd;
- my $dbname = $config->get_dbname;
- my $username = $config->get_username;
- my $password = $config->get_password;
- $ini->connect($dbd, $dbname, $username, $password);
- $ini->fetch_nocpulseini('INTERNAL');
-} else {
- print "Error: This script can be run only on monitoring backend.\n";
- exit 1;
-}
-
-if ($delete_unmatched) {
- $ini->dbh->begin_work;
- print "Deleting data from already deleted probes...\n";
- $sql = qq|
- delete from time_series
- where time_series.rowid in (
- select time_series.rowid from time_series
- left join rhn_probe
- on SUBSTR(O_ID,INSTR(O_ID,'-')+1,(INSTR(O_ID,'-',INSTR(O_ID,'-')+1)-INSTR(O_ID,'-'))-1) = rhn_probe.recid
- where rhn_probe.recid is null
- )
- |;
- $sth = $ini->dbh->prepare($sql);
- $sth->execute();
- print "\t", $sth->rows, " record deleted.\n";
- $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
-}
-
-if ($delta) {
- # delete probes older then $delta
- my $date=DateCalc("today", "- $delta", \$err);
- if ($err > 0) {
- print STDERR "Error: $delta is not valid delta of date.\n";
- exit 1;
- }
- print UnixDate($date,"Deleting probes data older than %T %b %e, %Y...\n");
- $sql = qq|delete from time_series where entry_time < ?|;
- $ini->dbh->begin_work;
- $sth = $ini->dbh->prepare($sql);
- $sth->execute(UnixDate($date,"%s"));
- print "\t", $sth->rows, " record deleted.\n";
- $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
-} else {
- print "No date delta specified. I do not know what to delete.\n";
-}
-
-=pod
-
-=head1 NAME
-
-delete-old-probes - Delete unused and old data from monitoring probes.
-
-=head1 SYNOPSIS
-
-delete-old-probes [OPTIONS]
-
-=head1 DESCRIPTION
-
-
-=head1 OPTIONS
-
---delete-unmatched
---no-delete-unmatched
- Delete data from probes, which have been already deleted. Default is to delete them.
-
---help
- Display this help.
-
-=head1 EXAMPLES
-
-=head1 AUTHOR
-
-Miroslav Suchý <msuchy(a)redhat.com>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2009 Red Hat, Inc.
-Released under GNU General Public License, version 2 (GPLv2).
-
-=cut
-
diff --git a/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
new file mode 100644
index 0000000..cac88f6
--- /dev/null
+++ b/monitoring/PerlModules/NP/Probe/monitoring-data-cleanup
@@ -0,0 +1,139 @@
+#!/usr/bin/perl
+use strict;
+#
+# Copyright (c) 2009 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+use lib '/etc/rc.d/np.d';
+use NOCpulse::NOCpulseini;
+use PhysCluster;
+
+use Date::Manip;
+use Getopt::Long;
+
+#set the defaults
+my $delete_unmatched = 1;
+my $delta = "";
+my $dry_run = 0;
+my $help = 0;
+
+my ($sql, $err, $sth);
+
+GetOptions(
+ "delete-unmatched!" => \$delete_unmatched,
+ "dry-run" => \$dry_run,
+ "delete-before:s" => \$delta,
+ "help" => \$help,
+ );
+
+if ($help) {
+ print <<HELP;
+Usage:
+ delete-old-probes --no-delete-unmatched
+
+HELP
+ exit;
+}
+if ($dry_run) {
+ print "Warning: Dry run active - no changes will be made.\n";
+}
+
+my $cluster = PhysCluster->newInitialized('/etc/rhn/cluster.ini');
+my $localConfig = $cluster->get_LocalConfig;
+my $ini = NOCpulse::NOCpulseini->new;
+
+if (%$localConfig) {
+ my $config = (values(%$localConfig))[0];
+ my $dbd = $config->get_dbd;
+ my $dbname = $config->get_dbname;
+ my $username = $config->get_username;
+ my $password = $config->get_password;
+ $ini->connect($dbd, $dbname, $username, $password);
+ $ini->fetch_nocpulseini('INTERNAL');
+} else {
+ print "Error: This script can be run only on monitoring backend.\n";
+ exit 1;
+}
+
+if ($delete_unmatched) {
+ $ini->dbh->begin_work;
+ print "Deleting data from already deleted probes...\n";
+ $sql = qq|
+ delete from time_series
+ where time_series.rowid in (
+ select time_series.rowid from time_series
+ left join rhn_probe
+ on SUBSTR(O_ID,INSTR(O_ID,'-')+1,(INSTR(O_ID,'-',INSTR(O_ID,'-')+1)-INSTR(O_ID,'-'))-1) = rhn_probe.recid
+ where rhn_probe.recid is null
+ )
+ |;
+ $sth = $ini->dbh->prepare($sql);
+ $sth->execute();
+ print "\t", $sth->rows, " record deleted.\n";
+ $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
+}
+
+if ($delta) {
+ # delete probes older then $delta
+ my $date=DateCalc("today", "- $delta", \$err);
+ if ($err > 0) {
+ print STDERR "Error: $delta is not valid delta of date.\n";
+ exit 1;
+ }
+ print UnixDate($date,"Deleting probes data older than %T %b %e, %Y...\n");
+ $sql = qq|delete from time_series where entry_time < ?|;
+ $ini->dbh->begin_work;
+ $sth = $ini->dbh->prepare($sql);
+ $sth->execute(UnixDate($date,"%s"));
+ print "\t", $sth->rows, " record deleted.\n";
+ $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
+} else {
+ print "No date delta specified. I do not know what to delete.\n";
+}
+
+=pod
+
+=head1 NAME
+
+delete-old-probes - Delete unused and old data from monitoring probes.
+
+=head1 SYNOPSIS
+
+delete-old-probes [OPTIONS]
+
+=head1 DESCRIPTION
+
+
+=head1 OPTIONS
+
+--delete-unmatched
+--no-delete-unmatched
+ Delete data from probes, which have been already deleted. Default is to delete them.
+
+--help
+ Display this help.
+
+=head1 EXAMPLES
+
+=head1 AUTHOR
+
+Miroslav Suchý <msuchy(a)redhat.com>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2009 Red Hat, Inc.
+Released under GNU General Public License, version 2 (GPLv2).
+
+=cut
+
commit 62c95b0226b50491d52663a3e38b12e40432368f
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 11:53:02 2009 +0200
520101 - implement --delete-before and --dry-run
diff --git a/monitoring/PerlModules/NP/Probe/delete-old-probes b/monitoring/PerlModules/NP/Probe/delete-old-probes
index d2a715a..cac88f6 100644
--- a/monitoring/PerlModules/NP/Probe/delete-old-probes
+++ b/monitoring/PerlModules/NP/Probe/delete-old-probes
@@ -18,14 +18,22 @@ use strict;
use lib '/etc/rc.d/np.d';
use NOCpulse::NOCpulseini;
use PhysCluster;
+
+use Date::Manip;
use Getopt::Long;
#set the defaults
my $delete_unmatched = 1;
+my $delta = "";
+my $dry_run = 0;
my $help = 0;
+my ($sql, $err, $sth);
+
GetOptions(
"delete-unmatched!" => \$delete_unmatched,
+ "dry-run" => \$dry_run,
+ "delete-before:s" => \$delta,
"help" => \$help,
);
@@ -37,6 +45,9 @@ Usage:
HELP
exit;
}
+if ($dry_run) {
+ print "Warning: Dry run active - no changes will be made.\n";
+}
my $cluster = PhysCluster->newInitialized('/etc/rhn/cluster.ini');
my $localConfig = $cluster->get_LocalConfig;
@@ -56,9 +67,9 @@ if (%$localConfig) {
}
if ($delete_unmatched) {
+ $ini->dbh->begin_work;
print "Deleting data from already deleted probes...\n";
-$ini->dbh->begin_work;
- my $sql = qq|
+ $sql = qq|
delete from time_series
where time_series.rowid in (
select time_series.rowid from time_series
@@ -67,10 +78,28 @@ $ini->dbh->begin_work;
where rhn_probe.recid is null
)
|;
- my $sth = $ini->dbh->prepare($sql);
+ $sth = $ini->dbh->prepare($sql);
$sth->execute();
- print $sth->rows, " record deleted. and rollbacked\n";
- $ini->dbh->rollback;
+ print "\t", $sth->rows, " record deleted.\n";
+ $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
+}
+
+if ($delta) {
+ # delete probes older then $delta
+ my $date=DateCalc("today", "- $delta", \$err);
+ if ($err > 0) {
+ print STDERR "Error: $delta is not valid delta of date.\n";
+ exit 1;
+ }
+ print UnixDate($date,"Deleting probes data older than %T %b %e, %Y...\n");
+ $sql = qq|delete from time_series where entry_time < ?|;
+ $ini->dbh->begin_work;
+ $sth = $ini->dbh->prepare($sql);
+ $sth->execute(UnixDate($date,"%s"));
+ print "\t", $sth->rows, " record deleted.\n";
+ $dry_run ? $ini->dbh->rollback : $ini->dbh->commit;
+} else {
+ print "No date delta specified. I do not know what to delete.\n";
}
=pod
commit 57158883d972af8e5a1cf112f89316798564bad7
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Aug 28 10:46:21 2009 +0200
520101 - first version of delete-old-probes
This one only delete data from already deleted probes.
diff --git a/monitoring/PerlModules/NP/Probe/delete-old-probes b/monitoring/PerlModules/NP/Probe/delete-old-probes
new file mode 100644
index 0000000..d2a715a
--- /dev/null
+++ b/monitoring/PerlModules/NP/Probe/delete-old-probes
@@ -0,0 +1,110 @@
+#!/usr/bin/perl
+use strict;
+#
+# Copyright (c) 2009 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+use lib '/etc/rc.d/np.d';
+use NOCpulse::NOCpulseini;
+use PhysCluster;
+use Getopt::Long;
+
+#set the defaults
+my $delete_unmatched = 1;
+my $help = 0;
+
+GetOptions(
+ "delete-unmatched!" => \$delete_unmatched,
+ "help" => \$help,
+ );
+
+if ($help) {
+ print <<HELP;
+Usage:
+ delete-old-probes --no-delete-unmatched
+
+HELP
+ exit;
+}
+
+my $cluster = PhysCluster->newInitialized('/etc/rhn/cluster.ini');
+my $localConfig = $cluster->get_LocalConfig;
+my $ini = NOCpulse::NOCpulseini->new;
+
+if (%$localConfig) {
+ my $config = (values(%$localConfig))[0];
+ my $dbd = $config->get_dbd;
+ my $dbname = $config->get_dbname;
+ my $username = $config->get_username;
+ my $password = $config->get_password;
+ $ini->connect($dbd, $dbname, $username, $password);
+ $ini->fetch_nocpulseini('INTERNAL');
+} else {
+ print "Error: This script can be run only on monitoring backend.\n";
+ exit 1;
+}
+
+if ($delete_unmatched) {
+ print "Deleting data from already deleted probes...\n";
+$ini->dbh->begin_work;
+ my $sql = qq|
+ delete from time_series
+ where time_series.rowid in (
+ select time_series.rowid from time_series
+ left join rhn_probe
+ on SUBSTR(O_ID,INSTR(O_ID,'-')+1,(INSTR(O_ID,'-',INSTR(O_ID,'-')+1)-INSTR(O_ID,'-'))-1) = rhn_probe.recid
+ where rhn_probe.recid is null
+ )
+ |;
+ my $sth = $ini->dbh->prepare($sql);
+ $sth->execute();
+ print $sth->rows, " record deleted. and rollbacked\n";
+ $ini->dbh->rollback;
+}
+
+=pod
+
+=head1 NAME
+
+delete-old-probes - Delete unused and old data from monitoring probes.
+
+=head1 SYNOPSIS
+
+delete-old-probes [OPTIONS]
+
+=head1 DESCRIPTION
+
+
+=head1 OPTIONS
+
+--delete-unmatched
+--no-delete-unmatched
+ Delete data from probes, which have been already deleted. Default is to delete them.
+
+--help
+ Display this help.
+
+=head1 EXAMPLES
+
+=head1 AUTHOR
+
+Miroslav Suchý <msuchy(a)redhat.com>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2009 Red Hat, Inc.
+Released under GNU General Public License, version 2 (GPLv2).
+
+=cut
+
14 years, 8 months
backend/satellite_tools
by Justin Sherrill
backend/satellite_tools/repo_plugins/yum_src.py | 9 +++++++--
backend/satellite_tools/reposync.py | 6 +++++-
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit c9c2d15afdf2537fff94aa47c0931aca198cc9d7
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 17:53:43 2009 -0400
adding mirror list support to spacewalk-repo-sync
diff --git a/backend/satellite_tools/repo_plugins/yum_src.py b/backend/satellite_tools/repo_plugins/yum_src.py
index a9c0ad6..4e911e2 100644
--- a/backend/satellite_tools/repo_plugins/yum_src.py
+++ b/backend/satellite_tools/repo_plugins/yum_src.py
@@ -22,11 +22,13 @@ class ContentSource:
url = None
name = None
repo = None
+ mirrorlist = False
cache_dir = '/var/cache/rhn/reposync/'
- def __init__(self, url, name):
+ def __init__(self, url, name, mirrorlist):
self.url = url
self.name = name
self._clean_cache(self.cache_dir + name)
+ self.mirrorlist = mirrorlist
def list_packages(self):
""" list packages"""
@@ -34,7 +36,10 @@ class ContentSource:
self.repo = repo
repo.cache = 0
repo.metadata_expire = 0
- repo.baseurl = [self.url]
+ if self.mirrorlist:
+ repo.mirrorlist = self.url
+ else:
+ repo.baseurl = [self.url]
repo.basecachedir = self.cache_dir
repo.baseurlSetup()
repo.setup(False)
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 99b7f07..173371d 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -27,6 +27,7 @@ from server.importlib.packageImport import ChannelPackageSubscription
default_log_location = '/var/log/rhn/reposync/'
class RepoSync:
+
parser = None
type = None
url = None
@@ -36,6 +37,7 @@ class RepoSync:
fail = False
repo_label = None
quiet = False
+ mirrorlist = False
def main(self):
initCFG('server')
@@ -80,6 +82,7 @@ class RepoSync:
self.channel_label = options.channel_label
self.fail = options.fail
self.repo_label = options.label
+ self.mirrorlist = options.mirror
self.quiet = options.quiet
self.channel = self.load_channel()
@@ -87,7 +90,7 @@ class RepoSync:
print "Channel does not exist or is not custom"
sys.exit(1)
- self.plugin = self.load_plugin()(self.url, self.channel_label + "-" + self.repo_label)
+ self.plugin = self.load_plugin()(self.url, self.channel_label + "-" + self.repo_label, self.mirrorlist)
self.import_packages(self.plugin.list_packages())
self.print_msg("Sync complete")
@@ -99,6 +102,7 @@ class RepoSync:
self.parser.add_option('-l', '--label', action='store', dest='label', help='A friendly label to refer to the repo')
self.parser.add_option('-f', '--fail', action='store_true', dest='fail', default=False , help="If a package import fails, fail the entire operation")
self.parser.add_option('-q', '--quiet', action='store_true', dest='quiet', default=False, help="Print no output, still logs output")
+ self.parser.add_option('-m', '--mirrorlist', action='store_true', dest='mirror', default=False, help="Treat --url as a mirror list (may not be supported by all content sources)")
return self.parser.parse_args()
def load_plugin(self):
14 years, 8 months
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java | 2 +-
java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 9deaa31f8199a1ca6c56522fb756961a7072d0f9
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 15:45:47 2009 -0400
518227 - fixing issue where missing repo label would result in invalid summary error
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
index cc33667..77e96e3 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
@@ -386,7 +386,7 @@ public class EditChannelAction extends RhnAction implements Listable {
}
catch (IllegalArgumentException iae) {
errors.add(ActionMessages.GLOBAL_MESSAGE,
- new ActionMessage("edit.channel.invalidchannelsummary"));
+ new ActionMessage(iae.getMessage()));
}
return updated;
diff --git a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
index 172d7e7..e6f9d0c 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
@@ -348,7 +348,7 @@ public class CreateChannelCommand {
protected void verifyRequiredParameters() {
if (user == null || StringUtils.isEmpty(summary)) {
throw new IllegalArgumentException(
- "Required parameters not set: user, or summary");
+ "edit.channel.invalidchannelsummary");
}
if (!StringUtils.isEmpty(yumUrl) && StringUtils.isEmpty(repoLabel)) {
14 years, 8 months
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartProfileVariableAction.java | 14 ++++++++++
java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartVariableAction.java | 3 --
2 files changed, 15 insertions(+), 2 deletions(-)
New commits:
commit 8c398e9254180e361351ef729dec016155cf4a13
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 14:40:35 2009 -0400
498009 - fixing issue where kickstart label would not show up on kickstart variables page
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartProfileVariableAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartProfileVariableAction.java
index b048814..6b587ab 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartProfileVariableAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartProfileVariableAction.java
@@ -20,6 +20,7 @@ import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.manager.kickstart.cobbler.CobblerXMLRPCHelper;
+import org.apache.struts.action.DynaActionForm;
import org.cobbler.CobblerObject;
import org.cobbler.Profile;
@@ -51,5 +52,18 @@ public class KickstartProfileVariableAction extends KickstartVariableAction {
protected String getObjectString() {
return RequestContext.KICKSTART_ID;
}
+
+ @Override
+ /**
+ * {@inheritDoc}
+ */
+ protected void setupFormValues(RequestContext ctx,
+ DynaActionForm form, String cId) {
+ super.setupFormValues(ctx, form, cId);
+ Long ksid = ctx.getRequiredParam(RequestContext.KICKSTART_ID);
+ KickstartData data = KickstartFactory.lookupKickstartDataByIdAndOrg(
+ ctx.getLoggedInUser().getOrg(), ksid);
+ ctx.getRequest().setAttribute("ksdata", data);
+ }
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartVariableAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartVariableAction.java
index ba55a6e..8a8c8a0 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartVariableAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartVariableAction.java
@@ -70,7 +70,6 @@ public abstract class KickstartVariableAction extends RhnAction {
setupFormValues(context, (DynaActionForm) formIn, cobblerId);
request.setAttribute(getObjectString(), request.getParameter(getObjectString()));
-
return getStrutsDelegate().forwardParams(mapping.findForward("default"),
request.getParameterMap());
@@ -142,7 +141,7 @@ public abstract class KickstartVariableAction extends RhnAction {
protected abstract String getCobblerId(RequestContext context);
protected abstract String getObjectString();
-
+
/**
* Get the CobblerObject that we'll use to set the ksmeta data
14 years, 8 months
backend/satellite_tools
by Justin Sherrill
backend/satellite_tools/reposync.py | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
New commits:
commit 00265ecc8795780e511234ac28819c0c7e708ce0
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 13:41:42 2009 -0400
changing behavior of reposync to immediately associate packages that already exist instead of waiting till the end
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index ecdf097..99b7f07 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -141,7 +141,7 @@ class RepoSync:
self.upload_package(pack, path, md5)
self.associate_package(pack, md5)
else:
- to_link.append(pack)
+ self.associate_package(pack, md5) #package is already on the satellite, lets just associate
if self.url.find("file://") < 0:
os.remove(path)
@@ -152,16 +152,6 @@ class RepoSync:
if self.fail:
raise
continue
- for pack in to_link:
- try:
- self.associate_package(pack, md5)
- except KeyboardInterrupt:
- raise
- except:
- self.error_msg(fetchTraceback())
- if self.fail:
- raise
- continue
def upload_package(self, package, path, md5):
temp_file = open(path, 'rb')
14 years, 8 months
scripts/channel-to-update-level
by Justin Sherrill
scripts/channel-to-update-level/README | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 81041d3cc73d8e8f32f76c5f9fb854dbc4921b7a
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 13:11:19 2009 -0400
updating readme for channel-to-update
diff --git a/scripts/channel-to-update-level/README b/scripts/channel-to-update-level/README
index 40d3b60..8087720 100644
--- a/scripts/channel-to-update-level/README
+++ b/scripts/channel-to-update-level/README
@@ -43,6 +43,9 @@ README - This file
Changelog:
-----------
+8/26/2009 - 2.1.2
+- Small fix to ensure RHEL 4 compatibility
+
6/18/09 - 2.1.1
- couple of fixes regarding bundlesize and data file options
14 years, 8 months
scripts/channel-to-update-level
by Justin Sherrill
scripts/channel-to-update-level/create-channel-update | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 6559e15c0fce165968f09a98bebb740989821a0a
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 13:08:30 2009 -0400
fixing small issue where create-channel-update wouldnt work on RHEL 4
diff --git a/scripts/channel-to-update-level/create-channel-update b/scripts/channel-to-update-level/create-channel-update
index a0a76ea..2b7683e 100755
--- a/scripts/channel-to-update-level/create-channel-update
+++ b/scripts/channel-to-update-level/create-channel-update
@@ -120,7 +120,8 @@ def main():
password = options.password
if password == None:
password = getpass.getpass()
- bundleSize = options.bundle
+ #even though this is supposed to be an int already, in RHEL4's python it isn't
+ bundleSize = int(options.bundle)
#did you provide a data file? If not we need all the information
if options.data == None:
14 years, 8 months
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 54c2b2117645ff5d1a35559a31ee38894dd478df
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 11:48:51 2009 -0400
setting the default checksum type for channels to be sha1 instead of sha256
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
index 1cbe356..cc33667 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
@@ -625,6 +625,7 @@ public class EditChannelAction extends RhnAction implements Listable {
request.setAttribute("channel_name", channelName);
form.set("org_sharing", "private");
form.set("per_user_subscriptions", "all");
+ form.set("checksum", "sha1");
}
}
14 years, 8 months
selinux/oracle-instantclient-selinux
by Jan Pazdziora
selinux/oracle-instantclient-selinux/oracle-instantclient-selinux.spec | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 96adcee5504c9117eedb1a567f46287b38ca969c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Aug 26 13:58:02 2009 +0200
The /usr/bin/execstack -s does not seem to be necessary as the files are already gone.
Addressing
/usr/bin/execstack: cannot open "/usr/lib/oracle/10.2.*/client*/lib/libocci.so.10.1": No such file or directory
upon package uninstallation.
diff --git a/selinux/oracle-instantclient-selinux/oracle-instantclient-selinux.spec b/selinux/oracle-instantclient-selinux/oracle-instantclient-selinux.spec
index bc07a72..11983de 100644
--- a/selinux/oracle-instantclient-selinux/oracle-instantclient-selinux.spec
+++ b/selinux/oracle-instantclient-selinux/oracle-instantclient-selinux.spec
@@ -83,7 +83,7 @@ fi
if [ $1 -eq 0 ]; then
for i in %used_libs ; do
/usr/sbin/semanage fcontext -d -t textrel_shlib_t '/usr/lib/oracle/10\.2\..*/client.*/lib/'${i//./\\.}
- /usr/bin/execstack -s /usr/lib/oracle/10.2.*/client*/lib/$i
+ # /usr/bin/execstack -s /usr/lib/oracle/10.2.*/client*/lib/$i
done
/sbin/restorecon -Rvv /usr/lib/oracle/10.2.*/client* || :
fi
@@ -103,7 +103,7 @@ fi
if [ $1 -eq 0 ]; then
/usr/sbin/semanage fcontext -d -t oracle_sqlplus_exec_t '/usr/lib/oracle/10\.2\..*/client.*/bin/sqlplus'
/usr/sbin/semanage fcontext -d -t textrel_shlib_t '/usr/lib/oracle/10\.2\..*/client.*/lib/libsqlplus\.so'
- /usr/bin/execstack -s /usr/lib/oracle/10.2.*/client*/lib/libsqlplus.so
+ # /usr/bin/execstack -s /usr/lib/oracle/10.2.*/client*/lib/libsqlplus.so
/sbin/restorecon -Rvv /usr/lib/oracle/10.2.*/client* || :
fi
14 years, 8 months
Changes to 'refs/tags/rhn-client-tools-0.6.4-1'
by Pradeep Kilambi
Tag 'rhn-client-tools-0.6.4-1' created by Pradeep Kilambi <pkilambi(a)redhat.com> at 2009-08-25 21:17 +0000
Tagging package [rhn-client-tools] version [0.6.4-1] in directory [client/rhel/rhn-client-tools/].
Changes since spacewalk-java-0.6.46-1:
Justin Sherrill (2):
making RepoSyncTask use the --quiet flag for repo syncing
adding --quiet flag to spacewalk-repo-sync
Pradeep Kilambi (2):
518336 - fixing the None unmarshel issue if smbios is missing and set to None instead of empty dict.
Automatic commit of package [rhn-client-tools] release [0.6.4-1].
---
backend/satellite_tools/reposync.py | 9 +++++++--
client/rhel/rhn-client-tools/rhn-client-tools.spec | 6 +++++-
client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 4 ++--
java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java | 7 ++-----
rel-eng/packages/rhn-client-tools | 2 +-
5 files changed, 17 insertions(+), 11 deletions(-)
---
14 years, 8 months