From a57a24c2d68daa4d4561ed9035c863e574cdc70a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 30 Apr 2019 12:56:11 +0200 Subject: add "active user count" munin command --- lib/Travelynx/Command/munin.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/Travelynx/Command') 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(?);}; @@ -28,6 +29,17 @@ sub run { query_to_munin( 'reg_user_count', $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, -- cgit v1.2.3