summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-02-10 10:10:48 +0200
committerPaul Buetow <paul@buetow.org>2023-02-10 10:10:48 +0200
commite2b1981f930873f580d93cb57c278d6d9274055e (patch)
tree44a166f62a41e838525333d75c4db9b961c96f34
parentf01913f7fe6a37a5a2dc9ef4f03bd24acb303c36 (diff)
add ideas
-rw-r--r--src/guprecords.raku12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/guprecords.raku b/src/guprecords.raku
index 6c17bc7..629a6e0 100644
--- a/src/guprecords.raku
+++ b/src/guprecords.raku
@@ -42,7 +42,7 @@ class Aggregate {
}
class Aggregator {
- has %.aggregates = { hostname => {}, os => {}, uname => {}, major => {} }
+ has %.aggregates = { hostname => {}, os => {}, uname => {}, os-major => {} }
method aggregate(IO::Path :$file is readonly) {
my Str $hostname = $file.IO.basename.split('.').first;
@@ -51,22 +51,26 @@ class Aggregator {
for $file.IO.lines {
my Str ($uptime, $boot-time, $os) = .trim.split(':');
my Str $uname = $os.split(' ').first;
- my Str $major = "{$uname} {$os.split(' ')[1].split('.').first}...";
+ my Str $os-major = "$uname {$os.split(' ')[1].split('.').first}...";
%!aggregates<os>{$os} //= Aggregate.new;
%!aggregates<uname>{$uname} //= Aggregate.new;
- %!aggregates<major>{$major} //= Aggregate.new;
+ %!aggregates<os-major>{$os-major} //= Aggregate.new;
for %!aggregates<hostname>{$hostname},
%!aggregates<os>{$os},
%!aggregates<uname>{$uname},
- %!aggregates<major>{$major} {
+ %!aggregates<os-major>{$os-major} {
.aggregate(:$uptime, :$boot-time);
}
}
}
}
+# TODO:
+# --category switch (hostname, os, os-major, uname...)
+# --stats switch (record count, total uptime, total downtime, total time/lifespan,
+# individual uptime, individual downtime)
sub MAIN(
Str $in-dir = './stats',
Str $sort-by = 'uptime';