1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51: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

@ -10,7 +10,7 @@
# Copyright (C) 2010 António P. P. Almeida <appa@perusio.net>
# Copyright (C) 2010 Minato Miray <minatomiray@gmail.com>
# Author: António P. P. Almeida <appa@perusio.net>,
# Author: António P. P. Almeida <appa@perusio.net>,
# Author: Minato Miray <minatomiray@gmail.com>
#######################################
@ -50,7 +50,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" )
print "no ($ret)\n";
exit 1;
}
my $ua = LWP::UserAgent->new(timeout => 30);
my $response = $ua->request(HTTP::Request->new('GET',$URL));
@ -75,15 +75,15 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" )
print "reqpsec.label Request/sec.\n";
print "reqpsec.info Request/sec.\n";
print "reqpsec.draw LINE2\n";
print "reqpsec.draw LINE2\n";
print "conpersec.label Connection/sec.\n";
print "conpersec.info Connection/sec.\n";
print "conpersec.draw LINE2\n";
print "conpersec.draw LINE2\n";
print "reqpcon.label Request/conn.\n";
print "reqpcon.info Request/conn.\n";
print "reqpcon.draw LINE2\n";
print "reqpcon.draw LINE2\n";
print "total.label Active connections\n";
print "total.info Active connections\n";
@ -91,16 +91,16 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" )
print "reading.label Reading\n";
print "reading.info Reading\n";
print "reading.draw LINE2\n";
print "reading.draw LINE2\n";
print "writing.label Writing\n";
print "writing.info Writing\n";
print "writing.draw LINE2\n";
print "writing.draw LINE2\n";
print "waiting.label Waiting\n";
print "waiting.info Waiting\n";
print "waiting.draw LINE2\n";
print "waiting.draw LINE2\n";
exit 0;
}
@ -145,11 +145,11 @@ if (defined $tmp2_conpsec && $tmp2_conpsec =~ /^[+-]?\d+$/ && $tmp2_conpsec > 0
$conpersec=$tmp2_conpsec-$tmp1_conpsec;
}
if (defined $tmp2_reqpsec && $tmp2_reqpsec =~ /^[+-]?\d+$/ && $tmp2_reqpsec > 0){
$reqpsec=$tmp2_reqpsec-$tmp1_reqpsec;
$reqpsec=$tmp2_reqpsec-$tmp1_reqpsec;
}
if ($conpersec > 0){
$reqpcon=$reqpsec/$conpersec;
}
}
print "reqpsec.value $reqpsec\n";
print "conpersec.value $conpersec\n";

View file

@ -2,21 +2,21 @@
Those plugins are used to monitor different projects or vhost (i.e. either different log files or using regular expression as filters) on the same web server.
## munin_byprojects_access
Count the number of hits per projects/vhost.
Count the number of hits per projects/vhost.
![byproject_access](https://www.mantor.org/~northox/misc/munin-plugins/nginx_byprojects_access1-month.png "byproject_access")
## munin_byprojects_bandwidth
Count the total bandwidth used by each projects/vhost. [Logtail](https://www.fourmilab.ch/webtools/logtail/) is required.
Count the total bandwidth used by each projects/vhost. [Logtail](https://www.fourmilab.ch/webtools/logtail/) is required.
![byproject_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_bandwidth-month.png "byproject_bandwidth")
## munin_byprojects_inout_bandwidth
Counts the in/out bandwidth used by each projects/vhost. [Logtail](https://www.fourmilab.ch/webtools/logtail/) is required.
Counts the in/out bandwidth used by each projects/vhost. [Logtail](https://www.fourmilab.ch/webtools/logtail/) is required.
![byproject_inout_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_inout_bandwidth-month.png "byproject_inout_bandwidth")
## Installation
The setup is pretty straight forward. First you need to configure the plugin:
In your munin plugin configuration file (for example, a new dedicated /etc/munin/plugin-conf.d/nginx_byprojects), configure the plugins :
In your munin plugin configuration file (for example, a new dedicated /etc/munin/plugin-conf.d/nginx_byprojects), configure the plugins:
[byprojects_*]
env.logtail /usr/local/bin/logtail
@ -35,6 +35,6 @@ Then link the file just as any other plugins.
ln -s /usr/local/sbin/<plugin> /usr/local/etc/munin/plugins/<plugin>
And restart the munin-node service.
## License
MIT

View file

@ -4,16 +4,16 @@ use JSON qw(decode_json);
#
# byprojects_access
#
# Perl script to monitor access *byprojects* (e.g. vhost) from multiple files
# Perl script to monitor access *byprojects* (e.g. vhost) from multiple files
# and/or regex.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license.
#
# You need logtail (https://www.fourmilab.ch/webtools/logtail/)
#
# Log can be gathered from multiple sources by simply specifying multiple log
# Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -73,7 +73,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_access.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail: $!";
while (<LT>) {
my $buf = $_;

View file

@ -7,19 +7,19 @@ use JSON qw(decode_json);
# Perl script to monitor total bandwidth *byprojects* (e.g. vhost) from multiple
# files and/or regex.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license.
#
# You need logtail (https://www.fourmilab.ch/webtools/logtail/)
#
# Your nginx configuration should look like this (i.e. $request_length
# Your nginx configuration should look like this (i.e. $request_length
# body_bytes_sent at the end):
# log_format main '$remote_addr - $remote_user $time_local "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" $request_length $body_bytes_sent';
#
# Log can be gathered from multiple sources by simply specifying multiple log
# Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -80,7 +80,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_totalbandwidth.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail : $!";
while (<LT>) {
my $buf = $_;

View file

@ -4,22 +4,22 @@ use JSON qw(decode_json);
#
# byprojects_inout_bandwidth
#
# Perl script to monitor in/out bandwidth *byprojects* (e.g. vhost) from
# Perl script to monitor in/out bandwidth *byprojects* (e.g. vhost) from
# multiple files and/or regex.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license.
#
# You need logtail (https://www.fourmilab.ch/webtools/logtail/)
#
# Your nginx configuration should look like this (i.e. $request_length
# Your nginx configuration should look like this (i.e. $request_length
# body_bytes_sent at the end):
# log_format main '$remote_addr - $remote_user $time_local "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" $request_length $body_bytes_sent';
#
# Log can be gathered from multiple sources by simply specifying multiple log
# Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -83,7 +83,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_inoutbandwidth.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail : $!";
while (<LT>) {
my $buf = $_;

View file

@ -44,7 +44,7 @@ totaltimeforrequests=0
numberofrequests=0
for line in lines:
m = rg.search(line)
if m:
if m:
word1=m.group(1)
c1=m.group(2)
float1=m.group(3)

View file

@ -1,7 +1,7 @@
#!/bin/sh
#
# Script for monitoring nginx Virtual host output traffic
#
#
# Requierements: logtail awk
# one unique access log file with $bytes_sent value for more accuracy
# check http://wiki.nginx.org/NginxHttpLogModule
@ -11,23 +11,23 @@
#
# Virtual host list
# env.vhosts "example.com example.net example.org"
#
#
# Log path
# env.logdir = /var/log/nginx
# env.flogfile = access.log
# env.flogfile = access.log
#
# Position of the $bytes_sent in the access.log file
# env.bparam 11
#
# Aggregate subdomains
# ex: example.com will match www.example.com, webmail.example.com and *example.com
# ex: example.com will match www.example.com, webmail.example.com and *example.com
# BUG: will also match also www.bad-example.com
# env.aggregate true #change to false to disable aggregation
# env.aggregate true #change to false to disable aggregation
#
# To report bugs, improvements or get updates
# see http://github.com/joanpc/nginix_vhost_traffic
#
# inspired in postfix_filtered_awk
# inspired in postfix_filtered_awk
# Copyright (c) 2010, Joan Perez i Cauhe
LOGDIR=${logdir:-/var/log/nginx}
@ -48,8 +48,8 @@ case $1 in
echo 'graph_category webserver'
i=0
for vhost in $VHOSTS
do
for vhost in $VHOSTS
do
i=$(($i + 1))
echo vhost$i.label $vhost
echo vhost$i.type ABSOLUTE
@ -57,7 +57,7 @@ case $1 in
echo vhost$i.draw $DRAW
DRAW=STACK
done
echo rest.label Rest
echo rest.type ABSOLUTE
echo rest.cdef rest,8,*
@ -72,16 +72,16 @@ export AGGREGATE
# Awk Script
$LOGTAIL ${ACCESS_LOG} -o $STATEFILE | awk '
BEGIN {
BEGIN {
split(ENVIRON["VHOSTS"], hosts)
for (host in hosts) { track[hosts[host]] = host}
}
}
{
cn[$2]+=$ENVIRON["BPARAM"]
}
END {
for (host in cn) {
if (match(ENVIRON["AGGREGATE"], "true")) {
END {
for (host in cn) {
if (match(ENVIRON["AGGREGATE"], "true")) {
found = 0
for (vhost in track) {
if (index(host, vhost)) {
@ -93,7 +93,7 @@ END {
if (! found) rest+=cn[host]
} else {
if (host in track) {
res[host] += cn[host]
res[host] += cn[host]
} else rest+=cn[host]
}
}