summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Travelynx/Command/munin.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/munin.pm b/lib/Travelynx/Command/munin.pm
index a7ee9b1..110e058 100644
--- a/lib/Travelynx/Command/munin.pm
+++ b/lib/Travelynx/Command/munin.pm
@@ -21,6 +21,7 @@ sub run {
my $db = $self->app->pg->db;
my $now = DateTime->now( time_zone => 'Europe/Berlin' );
+ my $active = $now->clone->subtract( months => 1 );
my $checkin_window_query
= qq{select count(*) as count from journeys where checkin_time > to_timestamp(?);};
@@ -29,6 +30,17 @@ sub run {
$db->select( 'users', 'count(*) as count', { status => 1 } )
->hash->{count} );
query_to_munin(
+ 'active_user_count',
+ $db->select(
+ 'users',
+ 'count(*) as count',
+ {
+ status => 1,
+ last_seen => { '>', $active }
+ }
+ )->hash->{count}
+ );
+ query_to_munin(
'checkins_24h',
$db->query( $checkin_window_query,
$now->subtract( hours => 24 )->epoch )->hash->{count}