Project

General

Profile

« Previous | Next » 

Revision 08f54d40

Added by Hamish Coleman over 14 years ago

  • ID 08f54d40a43534b2b6a84e38ca7572513284b65a

Add a basic sort order to the (unsorted) munin datasource

View differences:

mrtg.cgi
next;
}
if ( m/^(.*).graph_title (.*)/) {
# store until we have a category
$d->{$1}=$2;
}
my $title;
if ( m/^(.*).graph_category (.*)/) {
$title = $d->{$1};
# suck them all in prior to sorting
if ( m/^(.*).graph_(title|category) (.*)/) {
$d->{$1}->{$2}=$3;
}
}
if ( m/^([^;]+);([^:]+):(([^.]+)\.?([^.]+)?).graph_category (.*)/) {
#print "group=$1\n";
#print "host=$2\n";
#print "test=$6\n";
#print "instance=$3\n";
#print "title=$title\n";
my $category=lc $6;
my $target;
$target = "$1,$2,$category,$3";
config_save_val($filename,$target,'_grapher','munin');
config_save_val($filename,$target,'xsize',497-100);
config_save_val($filename,$target,'ysize',undef);
config_save_val($filename,$target,'title',$title);
my $path_local='/var/cache/munin/www/';
my $path_www='/munin/';
my $path_this="$1/$2/$4";
if (defined $5) {
$path_this.="/$5";
}
config_save_val($filename,$target,'_imagefile',$path_local.$path_this);
config_save_val($filename,$target,'_url',$path_www.$path_this);
for my $i (sort keys %{$d}) {
my $title = $d->{$i}{title};
my $category = lc $d->{$i}{category};
$i =~ m/^([^;]+);([^:]+):(([^.]+)\.?([^.]+)?)/;
#print "group=$1\n";
#print "host=$2\n";
#print "test=$6\n";
#print "instance=$3\n";
#print "title=$title\n";
my $target;
$target = "$1,$2,$category,$3";
config_save_val($filename,$target,'_grapher','munin');
config_save_val($filename,$target,'xsize',497-100);
config_save_val($filename,$target,'ysize',undef);
config_save_val($filename,$target,'title',$title);
my $path_local='/var/cache/munin/www/';
my $path_www='/munin/';
my $path_this="$1/$2/$4";
if (defined $5) {
$path_this.="/$5";
}
config_save_val($filename,$target,'_imagefile',$path_local.$path_this);
config_save_val($filename,$target,'_url',$path_www.$path_this);
}
}
}

Also available in: Unified diff