Skip to content
Snippets Groups Projects
Commit d72d7d4f authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

pridan cas prvni ulozene udalosti

parent 3117ccf9
No related branches found
No related tags found
No related merge requests found
......@@ -190,9 +190,8 @@ unless (defined $clients_sum_invalid) {
# Statistics of active registered senders
my $hash_ref;
unless ($clients_sum == 0) {
$sth = $dbh->prepare("SELECT clients.client_id, hostname, service, count(*), max(received) FROM events LEFT JOIN clients ON events.client_id = clients.client_id WHERE clients.valid='t' AND events.valid='t' GROUP BY clients.client_id;") or die "Cannot prepare statement: " . $dbh->errstr;
$sth = $dbh->prepare("SELECT clients.client_id, hostname, service, count(*), min(received), max(received) FROM events LEFT JOIN clients ON events.client_id = clients.client_id WHERE clients.valid='t' AND events.valid='t' GROUP BY clients.client_id;") or die "Cannot prepare statement: " . $dbh->errstr;
$sth->execute or die "Cannot execute statement: " . $sth->errstr;
my ($client_id, $hostname, $service, $count, $timestamp, $client_status);
$hash_ref = $sth->fetchall_hashref("client_id");
}
......@@ -232,17 +231,18 @@ print "\n";
unless ($clients_sum == 0) {
print "Statistics of ACTIVE and VALID registered senders:\n";
print "==================================================\n";
print "+------------------------------------------------------------------------------------------------------------------------+\n";
print "| Client ID | Hostname | Service | Stored events | Last insertion (UTC) |\n";
print "+------------------------------------------------------------------------------------------------------------------------+\n";
print "+---------------------------------------------------------------------------------------------------------------------------------------------+\n";
print "| Client ID | Hostname | Service | Stored events | First insert (UTC) | Last insert (UTC) |\n";
print "+---------------------------------------------------------------------------------------------------------------------------------------------+\n";
foreach my $key (sort {$a<=>$b} keys %$hash_ref) {
printf("| %-14s ", $hash_ref->{$key}->{client_id} || "unknown");
printf("| %-36s ", $hash_ref->{$key}->{hostname}|| "unknown");
printf("| %-22s ", $hash_ref->{$key}->{service} || "unknown");
printf("| %-14s ", $hash_ref->{$key}->{"count(*)"} || "unknown");
printf("| %-20s |\n", $hash_ref->{$key}->{"max(received)"} || "unknown");
printf("| %-19s ", $hash_ref->{$key}->{"min(received)"} || "unknown");
printf("| %-19s |\n", $hash_ref->{$key}->{"max(received)"} || "unknown");
}
print "+------------------------------------------------------------------------------------------------------------------------+\n";
print "+---------------------------------------------------------------------------------------------------------------------------------------------+\n";
print "\n";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment