aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-01-26 14:46:04 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-01-26 14:46:04 +0000
commit359e65ff3ea2dfa5500da27bc67eef841dfff9cc (patch)
treeea2e136e23db8674e51bf753936a0e77c8db6510 /SiteSummary.pm
parente63982416dd7d7f0a9d412033d574b72622434eb (diff)
downloadsitesummary-359e65ff3ea2dfa5500da27bc67eef841dfff9cc.tar.gz
sitesummary-359e65ff3ea2dfa5500da27bc67eef841dfff9cc.tar.bz2
sitesummary-359e65ff3ea2dfa5500da27bc67eef841dfff9cc.tar.xz
Rewritten new munin module to use SiteSummary.pm.
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index beddd4c..93f2eee 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -9,6 +9,8 @@ our $VERSION = 0.01;
our @ISA = qw(Exporter);
our @EXPORT = qw(
for_all_hosts
+ get_age_group
+ get_age_groups
get_debian_edu_profile
get_debian_edu_ver
get_debian_ver
@@ -340,6 +342,32 @@ sub for_all_hosts {
return $count;
}
+sub get_age_groups {
+ return (
+ 0 => '>0 days',
+ 3 => '>3 days',
+ 7 => '>one week',
+ 14 => '>14 days',
+ 30 => '>30 days',
+ 90 => '>90 days',
+ 180 => '>180 days',
+ );
+}
+sub get_age_group {
+ my $hostid = shift;
+ my %agegroups = get_age_groups();
+ my $topdir = get_filepath_current($hostid, "/");
+ my $age = (time() - (stat($topdir))[9]) / (60 * 60 * 24);
+
+ my $thisgroup;
+ for my $group (sort { $a <=> $b; } keys %agegroups) {
+ if ($age > $group) {
+ $thisgroup = $group;
+ }
+ }
+ return $thisgroup;
+}
+
1;
########################################################################