influxdb: add stations statistics
This commit is contained in:
parent
a58a312baf
commit
944688cfff
2 changed files with 59 additions and 1 deletions
|
@ -29,6 +29,7 @@ sub run {
|
||||||
my $active = $now->clone->subtract( months => 1 );
|
my $active = $now->clone->subtract( months => 1 );
|
||||||
|
|
||||||
my @stats;
|
my @stats;
|
||||||
|
my @stations;
|
||||||
my @traewelling;
|
my @traewelling;
|
||||||
|
|
||||||
push(
|
push(
|
||||||
|
@ -83,6 +84,44 @@ sub run {
|
||||||
$db->select( 'polylines', 'count(*) as count' )->hash->{count}
|
$db->select( 'polylines', 'count(*) as count' )->hash->{count}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
push(
|
||||||
|
@stations,
|
||||||
|
query_to_influx(
|
||||||
|
'iris',
|
||||||
|
$db->select(
|
||||||
|
'stations',
|
||||||
|
'count(*) as count',
|
||||||
|
{
|
||||||
|
source => 0,
|
||||||
|
archived => 0
|
||||||
|
}
|
||||||
|
)->hash->{count}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
push(
|
||||||
|
@stations,
|
||||||
|
query_to_influx(
|
||||||
|
'hafas',
|
||||||
|
$db->select(
|
||||||
|
'stations',
|
||||||
|
'count(*) as count',
|
||||||
|
{
|
||||||
|
source => 1,
|
||||||
|
archived => 0
|
||||||
|
}
|
||||||
|
)->hash->{count}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
push(
|
||||||
|
@stations,
|
||||||
|
query_to_influx(
|
||||||
|
'archived',
|
||||||
|
$db->select( 'stations', 'count(*) as count', { archived => 1 } )
|
||||||
|
->hash->{count}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
push(
|
push(
|
||||||
@traewelling,
|
@traewelling,
|
||||||
query_to_influx(
|
query_to_influx(
|
||||||
|
@ -115,11 +154,29 @@ sub run {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $self->app->config->{influxdb}->{url} ) {
|
if ( $self->app->mode eq 'development' ) {
|
||||||
|
$self->app->log->debug( 'POST '
|
||||||
|
. $self->app->config->{influxdb}->{url}
|
||||||
|
. ' stats '
|
||||||
|
. join( ',', @stats ) );
|
||||||
|
$self->app->log->debug( 'POST '
|
||||||
|
. $self->app->config->{influxdb}->{url}
|
||||||
|
. ' stations '
|
||||||
|
. join( ',', @stations ) );
|
||||||
|
$self->app->log->debug( 'POST '
|
||||||
|
. $self->app->config->{influxdb}->{url}
|
||||||
|
. ' traewelling '
|
||||||
|
. join( ',', @traewelling ) );
|
||||||
|
}
|
||||||
|
elsif ( $self->app->config->{influxdb}->{url} ) {
|
||||||
$self->app->ua->post_p(
|
$self->app->ua->post_p(
|
||||||
$self->app->config->{influxdb}->{url},
|
$self->app->config->{influxdb}->{url},
|
||||||
'stats ' . join( ',', @stats )
|
'stats ' . join( ',', @stats )
|
||||||
)->wait;
|
)->wait;
|
||||||
|
$self->app->ua->post_p(
|
||||||
|
$self->app->config->{influxdb}->{url},
|
||||||
|
'stations ' . join( ',', @stations )
|
||||||
|
)->wait;
|
||||||
$self->app->ua->post_p(
|
$self->app->ua->post_p(
|
||||||
$self->app->config->{influxdb}->{url},
|
$self->app->config->{influxdb}->{url},
|
||||||
'traewelling ' . join( ',', @traewelling )
|
'traewelling ' . join( ',', @traewelling )
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<p>+++ Testbetrieb +++</p>
|
||||||
<table class="striped">
|
<table class="striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
% my $orientation_bar_shown = param('train');
|
% my $orientation_bar_shown = param('train');
|
||||||
|
|
Loading…
Reference in a new issue