mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -101,7 +101,7 @@ $graphs{releases} = {
|
|||
},
|
||||
data_source_attrs => {
|
||||
min => '0',
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
data_sources => [
|
||||
|
@ -254,7 +254,7 @@ sub main {
|
|||
'config' => \&config,
|
||||
'show' => \&show,
|
||||
);
|
||||
|
||||
|
||||
die "Unknown command: $command" unless exists $commands{$command};
|
||||
return $commands{$command}->($graph);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ sub show {
|
|||
unless $graphs{$graph_name};
|
||||
|
||||
my $graph = $graphs{$graph_name};
|
||||
run_queries($graph_name);
|
||||
run_queries($graph_name);
|
||||
for my $ds (@{$graph->{data_sources}}) {
|
||||
printf "%s.value %s\n", clean_fieldname($ds->{label}), ($data->{$ds->{name}} ? $data->{$ds->{name}} : '0');
|
||||
}
|
||||
|
@ -298,22 +298,22 @@ sub run_queries {
|
|||
}
|
||||
|
||||
sub update_requests {
|
||||
my ($dbh) = @_;
|
||||
my ($dbh) = @_;
|
||||
my %queries = (
|
||||
request => 'select count(*) as requests from userrequests where timestamp > now() - INTERVAL 5 MINUTE;',
|
||||
download => 'select count(*) as downloads from userdownloads where timestamp > now() - INTERVAL 5 MINUTE;',
|
||||
);
|
||||
request => 'select count(*) as requests from userrequests where timestamp > now() - INTERVAL 5 MINUTE;',
|
||||
download => 'select count(*) as downloads from userdownloads where timestamp > now() - INTERVAL 5 MINUTE;',
|
||||
);
|
||||
for my $name ( qw(request download) ) {
|
||||
my $query = $queries{$name};
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute();
|
||||
while (my $row = $sth->fetch) {
|
||||
my $query = $queries{$name};
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute();
|
||||
while (my $row = $sth->fetch) {
|
||||
$data->{$name} = $row->[0];
|
||||
}
|
||||
$sth->finish();
|
||||
}
|
||||
$sth->finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub update_category {
|
||||
my ($dbh) = @_;
|
||||
my $sth = $dbh->prepare('select count(*) as releases, category.title, category.id from releases LEFT JOIN category ON releases.categoryID = category.ID group by releases.categoryID');
|
||||
|
@ -322,7 +322,7 @@ sub update_category {
|
|||
while (my $row = $sth->fetch) {
|
||||
$data->{$row->[2]} = $row->[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
sub update_releases {
|
||||
my ($dbh) = @_;
|
||||
|
@ -331,7 +331,7 @@ sub update_releases {
|
|||
$sth->execute();
|
||||
};
|
||||
if ($@) { die $@; }
|
||||
my $row = $sth->fetchrow_hashref();
|
||||
my $row = $sth->fetchrow_hashref();
|
||||
$data->{releases} = $row->{'releases'};
|
||||
$sth->finish();
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ sub update_users {
|
|||
$sth->execute();
|
||||
};
|
||||
if ($@) { die $@; }
|
||||
my $row = $sth->fetchrow_hashref();
|
||||
my $row = $sth->fetchrow_hashref();
|
||||
$data->{users} = $row->{'users'};
|
||||
$sth->finish();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue