mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Category Tree: Reduce number of categories
This commit is contained in:
parent
3cbaa078e7
commit
b19b3a813b
16 changed files with 17 additions and 16 deletions
|
@ -56,7 +56,7 @@ if(defined($ARGV[0])) {
|
|||
print "graph_title $server access byprojects\n";
|
||||
print "graph_total Total\n";
|
||||
print "graph_vlabel Access by \${graph_period}\n";
|
||||
print "graph_category $server\n";
|
||||
print "graph_category webserver\n";
|
||||
print "graph_info This graph show $server access by various projects.\n";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
print $project.".label $project\n";
|
||||
|
|
|
@ -62,7 +62,7 @@ if(defined($ARGV[0])) {
|
|||
print "graph_title $server total bandwidth byprojects\n";
|
||||
print "graph_total Total\n";
|
||||
print "graph_vlabel Bits\n";
|
||||
print "graph_category $server\n";
|
||||
print "graph_category webserver\n";
|
||||
print "graph_info This graph show $server total bandwidth used by various " .
|
||||
"projects.\n";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
|
|
|
@ -59,7 +59,7 @@ if(defined($ARGV[0])) {
|
|||
print "graph_title $server in/out bandwidth byprojects\n";
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel bits per \${graph_period} in (-) / out (+)\n";
|
||||
print "graph_category $server\n";
|
||||
print "graph_category webserver\n";
|
||||
print "graph_info This graph show $server in/out bandwidth used by various" .
|
||||
" projects.\n";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
|
||||
# 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
|
||||
# script name. ie. http_response_full or http_response_index
|
||||
#
|
||||
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
#
|
||||
# Configuration variables:
|
||||
#
|
||||
# domain - domain of the server to measure (default takelessons.com)
|
||||
# url[1..n] - url to measure against
|
||||
|
||||
my $domain = $ENV{'domain'} || 'http://takelessons.com';
|
||||
|
||||
# determine the intended "action" of the script
|
||||
# this is determined by the end of the script name
|
||||
# http_response_full or http_response_index
|
||||
my ($action) = ($0 =~ m/http_response_(\S+)$/);
|
||||
$ENV{'action'} = $action;
|
||||
if (! $ENV{'action'} =~ m/(full|index)/) {
|
||||
die "invalid action (determined by script suffix)";
|
||||
}
|
||||
|
||||
my @urls;
|
||||
|
||||
#debug mode
|
||||
#build urls manually
|
||||
if ($ARGV[0] eq "debug") {
|
||||
push(@urls, ( "/",
|
||||
"/san-diego-ca-92106/piano-lessons",
|
||||
"/category/browse",
|
||||
"/cities-music-lessons",
|
||||
"/new-york-music-lessons",
|
||||
"/category/singing-lessons"));
|
||||
}
|
||||
|
||||
#get the urls - build from configuration variables
|
||||
my $i = 1;
|
||||
while (defined ($ENV{"url$i"})) {
|
||||
push(@urls, $ENV{"url$i"});
|
||||
$i++;
|
||||
}
|
||||
if (! @urls) {
|
||||
die "No urls defined\n";
|
||||
}
|
||||
|
||||
#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_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;
|
||||
#fix up our label name to be a valid variable name
|
||||
$label =~ s@[^A-Za-z0-9_]@_@g;
|
||||
print "$label.label $url\n";
|
||||
print "$label.type GAUGE\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#function to make the request and get the response time
|
||||
sub req_time {
|
||||
my $url = shift;
|
||||
my $time;
|
||||
my $outdir = '/tmp/munin/' . int(rand(32000));
|
||||
system("mkdir -p $outdir");
|
||||
if ($ENV{'action'} eq "full") {
|
||||
$time = `/usr/bin/time -f "%e" wget -pq -P $outdir --header "Accept-Encoding: gzip,deflate" "$url" 2>&1`;
|
||||
} elsif ($ENV{'action'} eq "index") {
|
||||
$time = `/usr/bin/time -f "%e" wget -q -P $outdir --header "Accept-Encoding: gzip,deflate" "$url" 2>&1`;
|
||||
}
|
||||
system("rm -rf $outdir");
|
||||
return $time;
|
||||
}
|
||||
|
||||
#loop over every url and output the responses
|
||||
foreach my $url (@urls) {
|
||||
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);
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue