1
0
Fork 0
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:
Lars Kruse 2018-08-02 02:03:42 +02:00
parent ef851f0c34
commit 17f784270a
604 changed files with 2927 additions and 2945 deletions

View file

@ -1,14 +1,14 @@
#!/usr/bin/perl
use strict;
# HTTP response times for either entire page views
# HTTP response times for either entire page views
# or just the index, depending on configuration.
# Full or index resource pulling is determined by the suffix of the
# Full or index resource pulling is determined by the suffix of the
# script name. ie. http_response_full or http_response_index
#
# Parameters:
#
#
# config
#
# Configuration variables:
@ -52,13 +52,13 @@ if (! @urls) {
#output configuration and exit - required by Munin
if (exists $ARGV[0] and $ARGV[0] eq "config") {
print "graph_title $domain Site Response Times - $ENV{'action'}\n";
print "graph_title $domain Site Response Times - $ENV{'action'}\n";
print "graph_category webserver\n";
print "graph_vlabel request time (seconds)\n";
print "graph_info Response times for public areas of $domain.\n";
foreach my $url (@urls) {
my $label = $url;
my $label = $url;
#fix up our label name to be a valid variable name
$label =~ s@[^A-Za-z0-9_]@_@g;
print "$label.label $url\n";
@ -73,7 +73,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "config") {
#function to make the request and get the response time
sub req_time {
my $url = shift;
my $url = shift;
my $time;
my $outdir = '/tmp/munin/' . int(rand(32000));
system("mkdir -p $outdir");
@ -88,7 +88,7 @@ sub req_time {
#loop over every url and output the responses
foreach my $url (@urls) {
my $label = $url;
my $label = $url;
#fix up our label name to be a valid name
$label =~ s@[^A-Za-z0-9_]@_@g;
print "$label.value " . req_time($domain.$url);

View file

@ -21,9 +21,9 @@ This version supports monitoring:
=head1 REQUIREMENTS
- The server running this plugin must be allowed to connect to the web
- The server running this plugin must be allowed to connect to the web
server(s) you are going to monitor.
- Some perl modules:
- Some perl modules:
Time::HiRes, LWP::UserAgent, HTML::LinkExtor, LWP::ConnCache
=head1 CONFIGURATION
@ -131,7 +131,7 @@ sub read_urls{
my %urls=();
if(-r $file){
open(FILE,'<'.$file);
while (<FILE>) {
while (<FILE>) {
my $url=$_;
chomp($url);
my $id=get_id($url);
@ -150,7 +150,7 @@ sub read_cache{
my %cache=();
if(-r $file){
open(FILE,'<'.$file);
while (<FILE>) {
while (<FILE>) {
m/^(\S*)\s+(.*)$/;
$cache{ $1 } = $2;
}
@ -297,7 +297,7 @@ sub loadtime_config{
print "graph_total Total\n";
print "graph_info This graph is generated by a set of serial GETs to calculate the total time to load $urls{$id}. ";
print "Note that browsers usually fork() the GET requests, resulting in a shorter total loading time.\n";
if(keys(%cache)>0){
for my $key ( sort reverse keys %cache ){
my $value=$cache{$key};
@ -496,7 +496,7 @@ sub cache_values{
my $value=$cache{$key};
if($key =~ m/^([A-Za-z]+)\_(\S+)$/){
my $name=$2;
if ($1 eq $type){
$name=get_fieldname($name);
print $name . ".value " . $value . "\n";
@ -609,7 +609,7 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
exit(0);
} elsif($ARGV[0] and $ARGV[0] eq "cron") {
# This thing is run by cron and should write a cache file for munin-node to
# This thing is run by cron and should write a cache file for munin-node to
# read from
my $verbose=0;
@ -629,7 +629,7 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
while ( my ($id, $url) = each(%urls) ) {
$verbose && print "Fetching $url (id: $id)... \n";
$t0=0;
$status=0;
%output=();
@ -682,7 +682,7 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
$tag=$$link[0] . " " . $$link[1];
}
$output{"tags_" . $$link[0] . "-" . $$link[1]}+=1;
if(filter($tag)){
$verbose && print " Processing: " . $$link[0] . " " . $$link[1] . " " . $$link[2] . "\n";
@ -693,7 +693,7 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
}
my $suburl=$$link[2];
$t0 = [gettimeofday];
$response = $browser->get($suburl);
$output{"loadtime_" . $host} += sprintf("%.6f",tv_interval ( $t0, [gettimeofday]));
@ -720,13 +720,13 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
while ( my ($id, $value) = each(%input) ) {
$input{$id}="U";
}
# Adding new values
while ( my ($id, $value) = each(%output) ) {
$input{$id}=$value;
$verbose && print " Result: " . $id . " -> " . $value . "\n";
}
# Writing the cache
$verbose && print "Writing cache file: " . $cachefile . "... ";
open(FILE,">".$cachefile);
@ -739,7 +739,7 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
exit(0);
}elsif($ARGV[0] and $ARGV[0] eq "config") {
my %urls=&read_urls($url_file);
$debug && print "Reading cache file\n";
my $cachefile=$cachedir . "/" . &get_cache_file_name($scriptname,$id);
my %cache=read_cache($cachefile);
@ -773,6 +773,6 @@ if($ARGV[0] and $ARGV[0] eq "autoconf") {
} else {
cache_values(\%cache, $type);
}
}
}
# vim:syntax=perl

View file

@ -4,7 +4,7 @@
This plugin does http requests to specified URLs and takes the response time.
Use it to monitor remote sites.
LWP::UserAgent and Time::HiRes are required
=head1 CONFIGURATION
@ -70,7 +70,7 @@ for (my $i = 1; $ENV{"url$i"}; $i++)
my $proxy = $ENV{"url${i}_proxy"};
my $name = $ENV{"url${i}_name"} || clean($url);
my $label = $ENV{"url${i}_label"} || $url;
$URLS{$name}={
url=>$url,
proxy=>$proxy,
@ -161,7 +161,7 @@ foreach my $name (keys %URLS) {
if ($response->is_success) {
$$url{'time'}=sprintf("%d",tv_interval($t1,$t2)*1000);
};
};
};
print("multigraph http_request_time\n");

View file

@ -4,26 +4,26 @@
# Copyright (C) 2009 Matthias Marschall - mm@agileweboperations.com
#
# Based on:
# mongrel_process_memory - A munin plugin to monitor memory size of
# mongrel_process_memory - A munin plugin to monitor memory size of
# each individual mongrel process
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Author: Ben VandenBos
# Contributors: Adam Jacob (<adam@hjksolutions.com>)
# Ryan Woodrum
# Ryan Woodrum
# Matthias Marschall (mm@agileweboperations.com)
#
#%# family=auto
@ -31,7 +31,7 @@
module Munin
class MongrelProcessMemory
def run
pid_port_map = get_pids()
port_list = Hash.new
@ -40,7 +40,7 @@ module Munin
puts "mongrel_#{port}.value #{rss}"
end
end
def get_pids
h = Hash.new
pids = []
@ -57,10 +57,10 @@ module Munin
def autoconf
get_pids().length > 0
end
end
end
mpm = Munin::MongrelProcessMemory.new
case ARGV[0]

View file

@ -1,32 +1,32 @@
#!/usr/bin/env ruby
#
# mongrel_process_memory - A munin plugin to monitor memory size of
# mongrel_process_memory - A munin plugin to monitor memory size of
# each individual mongrel process
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Author: Ben VandenBos
# Contributors: Adam Jacob (<adam@hjksolutions.com>)
# Ryan Woodrum
# Ryan Woodrum
#
#%# family=auto
#%# capabilities=autoconf
module Munin
class MongrelProcessMemory
def run
h = get_pids()
ps_output = ""
@ -49,10 +49,10 @@ module Munin
port_list.sort.each do |port|
puts "mongrel_#{port[0]}.value #{port[1]}"
end
end
end
end
def get_pids
h = Hash.new
pids = []
@ -68,10 +68,10 @@ module Munin
def autoconf
pids.length > 0
end
end
end
mpm = Munin::MongrelProcessMemory.new
case ARGV[0]

View file

@ -1,7 +1,7 @@
#! /usr/bin/perl
# This plugin based on http_responestime designed by Anders Nordby
#
# It is written to control the quality of an internet conneting by
# It is written to control the quality of an internet conneting by
# downloading a favicon.ico file from a lot - unlimited - count of
# domains.
#
@ -100,11 +100,11 @@ if ($ARGV[0] && $ARGV[0] eq "autoconf") {
$vhost =~ s@^\w+://(.+?)/.*@\1@;
$proto =~ s@^(\w+)://.*@\1@;
# If url_array[] is a domain, vhost will be contain the the strinf "http://"
# If url_array[] is a domain, vhost will be contain the the strinf "http://"
if($vhost =~ /http/) {
print "timespent$i.label $vhost\n";
} else {
print "timespent$i.label $proto://$vhost\n";
print "timespent$i.label $proto://$vhost\n";
}
print "timespent$i.info Ladezeit von $url_array[$i]/favicon.ico\n";