[rrd-users] Resilient Groups Tweak for 14all
McGlinchy, Alistair
Alistair.McGlinchy at marks-and-spencer.com
Thu Dec 4 00:49:58 MET 2003
Hello Rainer, (and fellow RRD users)
I am presently using 14all/MRTG to monitor 5400 targets here at M&S.
Recently I have made a tweak to 14all which you may find interesting. As
14all does not use the Target]: line from the configuration file I have
managed to find a way to do add multiple RRDs together using a "Pseudo"
Target syntax without radically mangling your code.
Target[<name>} : Resilient( file1.rrd + file2.rrd + file3.rrd + ...
)
Now I can see the total traffic across two resilient WAN links, and
immediately see the traffic we would need to support should one of the a
links fail. It also make is easier to do on-the-fly capacity planning
(Eg if this server and that server were to move to this site then, would
all the traffic fit on the site's two resilient WAN links in the event
of disaster. I just add all the RRD names CFG file and refresh the
browser.)
To achieve this I maintain two separate types of CFG file. One type is
read by 14all and the other by MRTG. The MRTG CFGs have no syntactic
sugar in them (Colour, Scaling, Labels, Axis etc). The 14all CFGs
contain all the syntax info as well as these new pseudo target
definitions. The great bit out separating making two separate CFGs is
that I can keep very small CFG file for 14 all to read quickly, and make
the MRTG ones always have 150. (300 secs with 2 sec SNMP time out). My
directory structure looks like this.
# All the MRTG cfgs are in the root of the collection tree and each have
150 targets
# Workdir is D:\MRTG and Directory[Target] is used extensively
D:\MRTG\Mrtg.1.cfg
D:\MRTG\Mrtg.2.cfg
D:\MRTG\Mrtg.3.cfg
..
D:\MRTG\Mrtg.38.cfg
# All the 14all cfgs are in the sub directories of the collection tree
and have a variable number of targets
# Workdir is D:\MRTG\<full path> for each cfg Directory is not used and
the Target[<name>} : is fair game :-)
D:\MRTG\Head_Office\Router\Interfaces\14all.cfg
D:\MRTG\Head_Office\Server\Interfaces\14all.cfg
D:\MRTG\Store\Router\Interfaces\14all.cfg
D:\MRTG\Store\Router\Latency\14all.cfg
If you (or anyone cced) are interested I can post my make_all_cfgs.pl
code. It's still a work-in-progress though as I'm trying to build a nice
"Top 10" system and an elegant integration of an optional CSV output.
Alistair
PS. Am I supposed to say "one four all" or "fourteen all"?
PPS. Here is a diff from 14all.cgi,v 2.25 2003/01/05 18:39:51. The
second edit at 483c453 was a nasty gotcha. On Win XP and Active Perl 5.8
the call to RRDs::Graph crashes horribly with no useful error when a
"DEF:min=.." follows a CDEF of the same name.
421,454c421,424
<
< # AMcG 23/11/03
< my $target=$cfg->{targets}{target}{$log};
< if ($target=~ /Resilient\(\s*(.*)\s*\)/) {
< my $cdef_char='A';
< my (@in_rrds, at out_rrds, at min_rrds, at mout_rrds,);
< my @rrds_to_sum= split /\s*\+\s*/, $1;
< for (@rrds_to_sum) {
< die "RRD file $_ does not exist for graph $png /
target $log" unless -e;
< # Now escape the / and : chars for the DEFs
< s/([:\\])/\\$1/g;
< push @args,
"DEF:rrd_${cdef_char}0Avg=$_:ds0:AVERAGE";
< push @args,
"DEF:rrd_${cdef_char}1Avg=$_:ds1:AVERAGE";
< push @args,
"DEF:rrd_${cdef_char}0Max=$_:ds0:MAX";
< push @args,
"DEF:rrd_${cdef_char}1Max=$_:ds1:MAX";
< push @in_rrds, "rrd_${cdef_char}0Avg";
< push @out_rrds,"rrd_${cdef_char}1Avg";
< push @min_rrds, "rrd_${cdef_char}0Max";
< push @mout_rrds,"rrd_${cdef_char}1Max";
< $cdef_char++;
< }
< push @args, "CDEF:in=". join(',', @in_rrds, ('+') x
$#in_rrds);
< push @args, "CDEF:out=".join(',', @out_rrds,('+') x
$#out_rrds);
< push @args, "CDEF:min=". join(',', @min_rrds, ('+') x
$#min_rrds);
< push @args, "CDEF:mout=".join(',', @mout_rrds,('+') x
$#mout_rrds);
< } else {
< push @args, "DEF:in=$rrd:ds0:AVERAGE",
"DEF:out=$rrd:ds1:AVERAGE";
< push @args, "DEF:min=$rrd:ds0:MAX",
"DEF:mout=$rrd:ds1:MAX";
< }
<
< if (defined $cfg->{targets}{options}{unknaszero}{$log}) {
< push @args, "CDEF:uin=$ds0,UN,0,$ds0,IF",
"CDEF:uout=$ds1,UN,0,$ds1,IF";
---
> push @args, "DEF:$ds0=$rrd:ds0:AVERAGE",
"DEF:$ds1=$rrd:ds1:AVERAGE";
> if (defined $cfg->{targets}{options}{unknaszero}{$log}) {
> push @args, "CDEF:uin=$ds0,UN,0,$ds0,IF",
> "CDEF:uout=$ds1,UN,0,$ds1,IF";
483c453
< # push @args, "DEF:min=$rrd:ds0:MAX",
"DEF:mout=$rrd:ds1:MAX";
---
> push @args, "DEF:min=$rrd:ds0:MAX",
"DEF:mout=$rrd:ds1:MAX";
-----------------------------------------------------------------------
Registered Office:
Marks & Spencer p.l.c
Michael House, Baker Street,
London, W1U 8EP
Registered No. 214436 in England and Wales.
Telephone (020) 7935 4422
Facsimile (020) 7487 2670
www.marksandspencer.com
Please note that electronic mail may be monitored.
This e-mail is confidential. If you received it by mistake, please let us know and then delete it from your system; you should not copy, disclose, or distribute its contents to anyone nor act in reliance on this e-mail, as this is prohibited and may be unlawful.
The registered office of Marks and Spencer Financial Services PLC, Marks and Spencer Unit Trust Management Limited, Marks and Spencer Life Assurance Limited and Marks and Spencer Savings and Investments Limited is Kings Meadow, Chester, CH99 9FB. These firms are authorised and regulated by the Financial Services Authority.
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list