aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--SiteSummary.pm19
-rw-r--r--debian/changelog2
-rwxr-xr-xdebian_edu-summary28
4 files changed, 33 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 2738d29..8b2005b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
COLLECTORS = \
+ collect.d/debian-edu \
collect.d/system \
collect.d/siteinfo
diff --git a/SiteSummary.pm b/SiteSummary.pm
index 9093f53..1f33468 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -20,7 +20,7 @@ our @EXPORT = qw(
my $pwd = "/var/lib/sitesummary/entries"; # Path to the entries
# File for debian-edu configuration
-my $debian_edu_config = "/etc/debian-edu/config";
+my $debian_edu_config = "/debian-edu/config";
sub get_filepath_current {
my ($hostid, $file) = @_;
@@ -87,17 +87,17 @@ sub get_linux_kernel_ver {
}
sub get_debian_edu_profile {
-# my $hostid = shift;
- if ( ! -e $debian_edu_config ) {
-# print STDERR "error: Missing $debian_edu_config file.\n";
+ my $hostid = shift;
+ my $path = get_filepath_current($hostid, $debian_edu_config);
+ if ( ! -e $path ) {
return undef;
}
- if (open (FILE, $debian_edu_config)) {
+ if (open (FILE, $path)) {
while (<FILE>) {
chomp;
s/\#.+$//;
next if not (/PROFILE/);
- s/^"PROFILE=//;
+ s/^PROFILE=//;
return $_;
}
}
@@ -105,11 +105,12 @@ sub get_debian_edu_profile {
}
sub get_debian_edu_ver {
- if ( ! -e $debian_edu_config ) {
-# print STDERR "error: Missing $debian_edu_config file.\n";
+ my $hostid = shift;
+ my $path = get_filepath_current($hostid, $debian_edu_config);
+ if ( ! -e $path ) {
return undef;
}
- if (open (FILE, $debian_edu_config)) {
+ if (open (FILE, $path)) {
while (<FILE>) {
chomp;
s/\#.+$//;
diff --git a/debian/changelog b/debian/changelog
index 9b1ba83..fae0b9a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ sitesummary (0.0.12) unstable; urgency=low
are owned by user www-data. This give the cgi-script write access
to the storage area.
* Switch the client from cron.d to cron.daily.
+ * Add collector for debian-edu configuration. Correct server
+ summary part to use the collected file.
-- Petter Reinholdtsen <pere@debian.org> Wed, 4 Oct 2006 09:43:02 +0200
diff --git a/debian_edu-summary b/debian_edu-summary
index ad29a72..a873f76 100755
--- a/debian_edu-summary
+++ b/debian_edu-summary
@@ -3,18 +3,30 @@
use strict;
use SiteSummary;
+my %profiles;
+my %versions;
-#for_all_hosts(\&handle_host);
+for_all_hosts(\&handle_host);
+
+print_summary();
+
+exit 0;
-handle_host();
sub handle_host {
my $hostid = shift;
- printf(" %-20s %5s\n", "debian-edu-profile", "count");
- foreach ( get_debian_edu_profile ) {
- printf(" %20s\n", $_ || "", "\n");
+ my $profile = get_debian_edu_profile($hostid);
+ my $version = get_debian_edu_ver($hostid);
+ $profiles{$profile}++ if (defined $profile);
+ $profiles{$version}++ if (defined $version);
+}
+
+sub print_summary {
+ printf(" %-30s %5s\n", "debian-edu-profile", "count");
+ foreach ( keys %profiles ) {
+ printf(" %30s %5s\n", $_ || "", $profiles{$_});
}
- printf(" %-20s %5s\n", "debian-edu-version", "count");
- foreach ( get_debian_edu_ver ) {
- printf(" %20s\n", $_ || "", "\n");
+ printf(" %-30s %5s\n", "debian-edu-version", "count");
+ foreach ( keys %versions ) {
+ printf(" %30s %5s\n", $_ || "", $versions{$_});
}
}