summaryrefslogtreecommitdiff
path: root/doc/lib/rrdFilter_js.html
blob: 5738675251cc872bc4b59b72aef4f8e94400fee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE>rrdFilter module</TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.0  (Linux)">
	<META NAME="CREATED" CONTENT="20090209;18445600">
	<META NAME="CHANGED" CONTENT="20090209;19214700">
	<META NAME="Info 1" CONTENT="">
	<META NAME="Info 2" CONTENT="">
	<META NAME="Info 3" CONTENT="">
	<META NAME="Info 4" CONTENT="">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		TD P { margin-bottom: 0.08in }
		H1 { margin-bottom: 0.08in }
		H1.western { font-family: "Liberation Sans", sans-serif; font-size: 22pt }
		P { margin-bottom: 0.08in }
		H2.heading-2-western { font-family: "Liberation Serif", serif; font-size: 16pt }
		TH P { margin-bottom: 0.08in }
		A:link { so-language: zxx }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H1 CLASS="western">rrdFilter module</H1>
<TABLE WIDTH=50% CELLPADDING=2 CELLSPACING=2>
	<TR>
		<TD>
			<HR>
			<P>The <A HREF="../../src/lib/rrdFile.js">rrdFile Javascript
			module</A> implements a set of classes that can be used to extract
			information from <A HREF="http://oss.oetiker.ch/rrdtool/">RRD
			archives</A> loaded as binary file objects.</P>
			<HR>
		</TD>
	</TR>
</TABLE>
<H2 CLASS="heading-2-western">Overview</H2>
<P>The rrdFilter module is allows filters to be applied to DSs (datasources) and RRA objects.</P>
<P>(These classes should have almost idential instantiations to their rrdFile module equivilents.)</P>
<P>For DSs, filters can either be a list of DSs to filter out (*FilterDS), or a user-created and customized filter object (*FilterOp - for example, mathematical functions like summing and averaging DSs).
<P> THese classes are:
<UL><LI>RRDFilterDS
<LI>RRDFilterOp</UL>    

<P>For RRAs, two things can be done - An RRA can be shifted by any number of seconds (for timezone selection, for instance) [RRDFilterShift], or any number of new RRAs can be created (based on other RRAs) with their data averaged [RRDRRAFilterAvg]. See individual classes for details. 
<P>These classes are:
<UL><LI>RRDFilterShift
<LI>RRDRRAFilterAvg</UL>


<H4 CLASS="heading-2-western">Internal classes for Developers, Listed at the End:</H4>
<UL>
<LI>RRDRRAFilterDS
<LI>RRDRRAFilterOp
<LI>RRDDSFilterOp
<LI>RRAFilterAvg
<LI>RRAInfoFilterAvg.</UL>
<HR>
<H2> Main Classes: <H2>
<HR>
<H3> RRD Filter Classes: <H3>
<H2 CLASS="heading-2-western"><A NAME="RRDFilterDS"></A>Class RRDFilterDS</H2>
<P> Note: This class is deprecated. Use <A HREF="#RRDFilterOp">RRDFilterOp</A> instead.</P>
<P> This class filters out a subset of DSs from an RRD identified by index or name. </P>
<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMinSteps()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the base <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#I__step__s_step__default__300_seconds_">interval
                                        in seconds</A> that was used to feed the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getLastUpdate()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the timestamp of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdlastupdate.en.html">last
                                        update</A>.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrDSs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDSNames()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the names of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
<TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDS(id)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>If id is a number, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the id-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A>.</P>
                                        <P>If id is a string, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A> with the requested name.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrRRAs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archives</A> present in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRAInfo(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRAInfo">RRDRRAInfo</A>
                                        holding the information about the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRA(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRA">RRDRRA</A> that
                                        can be used to access the values stored in the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        </TR>
                </TBODY>
	</TABLE>
</DIV>
<P>
<H2 CLASS="heading-2-western"><A NAME="RRDFilterOp"></A>Class RRDFilterOp</H2>
<P>This class filters all of the DSs in an RRD by a list of filter objects.</P>
<PRE>
 The filter object must implement the following interface
   getName()               - Symbolic name give to this function
   getDSName()             - list of DSs used in computing the result (names or indexes)
   computeResult(val_list) - val_list contains the values of the requested DSs (in the same order) 

 Example classes that implement the interface:
   function Itentity(ds_name) { //Leaves the DS alone.
     this.getName = function() {return ds_name;}
     this.getDSNames = function() {return [ds_name];}
     this.computeResult = function(val_list) {return val_list[0];}
   }
   function sumDS(ds1_name,ds2_name) { //Sums the two DSs.
     this.getName = function() {return ds1_name+"+"+ds2_name;}
     this.getDSNames = function() {return [ds1_name,ds2_name];}
     this.computeResult = function(val_list) {return val_list[0]+val_list[1];}
   }

 Lets say you have 2 DSs. To add a summed DS of DS1 and DS2: 
 var ds0_name = rrd_data.getDS(0).getName();
 var ds1_name = rrd_data.getDS(1).getName();
 rrd_data = new RRDFilterOp(rrd_data, [new Identity(ds0_name), 
                     new Itentity(ds1_name), new sumDS(ds0_name, ds1_name]);
</PRE>
<P>If a string is passed, it is assumed to be the name of a DS, and the Identity transformation is applied.<BR>
   If an integer is passed, it is assumed to be the index or a DS, and the Identity equivalent is applied.<BR>
   So this gives an equivalent result:</P>
<PRE>
 rrd_data = new RRDFilterOp(rrd_data, [ds0_name,1, new sumDS(ds0_name, ds1_name]);
</PRE>
<P>Its arguments are: rrd_file and op_obj_list (list of ds filters).
<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMinSteps()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the base <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#I__step__s_step__default__300_seconds_">interval
                                        in seconds</A> that was used to feed the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getLastUpdate()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the timestamp of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdlastupdate.en.html">last
                                        update</A>.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrDSs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDSNames()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the names of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
<TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDS(id)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>If id is a number, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the id-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A>.</P>
                                        <P>If id is a string, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A> with the requested name.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrRRAs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archives</A> present in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRAInfo(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRAInfo">RRDRRAInfo</A>
                                        holding the information about the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRA(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRA">RRDRRA</A> that
                                        can be used to access the values stored in the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        </TR>
                </TBODY>
	</TABLE>
</DIV> 

<HR>
<H3 CLASS="heading-2-western">RRA Filters:</H3>
<H2 CLASS="heading-2-western"><A NAME="RRAFilterShift"></A>Class RRAFilterShift</H2>
<P>This class creates new, time-shifted RRAs. Originally developed for timezone shifting. Currently to be considered deprecated. 
<P>Arguments:
<UL><LI>1. The RRD File
<LI>2. Shift Int - the number of seconds to shift by (1 hour = 3600s).
<LI>3. RRA index List - A list of the RRAs (by their indicies) to be shifted; usually all RRAs in the File are included. </UL>

<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMinSteps()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the base <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#I__step__s_step__default__300_seconds_">interval
                                        in seconds</A> that was used to feed the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getLastUpdate()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the timestamp of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdlastupdate.en.html">last
                                        update</A>.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrDSs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDSNames()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the names of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
<TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDS(id)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>If id is a number, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the id-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A>.</P>
                                        <P>If id is a string, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A> with the requested name.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrRRAs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archives</A> present in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRAInfo(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRAInfo">RRDRRAInfo</A>
                                        holding the information about the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRA(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRA">RRDRRA</A> that
                                        can be used to access the values stored in the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        </TR>
                </TBODY>
	</TABLE>
</DIV> 
<HR>
<H2 CLASS="heading-2-western"><A NAME="RRDRRAFilterAvg"></A>Class RRDRRAFilterAvg</H2>
<P>This class creates new RRAs (based on original RRAs in the RRD File) that have different time steps. This is useful for creating new RRA graphs with different time steps without actually creating and filling new RRAs.
<P>Arguments:
<UL><LI>1. The RRD File
<LI>2. List of Filter Objects. Each object must instantiate getIdx, which returns the index of the RRA to use in the RRD File, and getStep, which returns the step size of the RRA. (If getStep returns null, the filter will use the original step size given by the RRA specified by getIdx). </UL>
<P>Examples of RRA Filter Objects: </P>
<PRE>
      //This RRA Filter object leaves the original RRA unchanged.
      function RRAIdentity(rra_idx) {
         this.getIdx = function() {return rra_idx;}
         this.getStep = function() {return null;} 
      }
      
      /* This Filter creates a new RRA with a different step size 
      / based on another RRA, whose data the new RRA averages. 
      / rra_idx should be index of RRA with largest step size 
      / that doesn't exceed new step size. */ 

      function RRA_Avg(rra_idx,new_step_in_seconds) {
         this.getIdx = function() {return rra_idx;}
         this.getStep = function() {return new_step_in_seconds;}
      }
</PRE>
<P>For instance, if you have 3 RRAs with 5 second, 60 second and 3600 second intervals, and would like an RRA with 1800 second steps along with them, create: 
<PRE>
      object_list = [new RRAIdentity(0), new RRAIdentity(1), new RRAItentity(2), new RRA_Avg(1,1800)].  
      new RRDRRAFilterAvg(rrd_file, object_list);
</PRE>
<P>It's best to use the RRA with the next smallest step size as a basis. It's also best to make steps integer multiples of the original RRA step sizes. For instance, using a 45 minute step, a 6 hour (= 45mins x 8) step would be better than 4 hour step (=45 mins x 5.33...).
<P>Given that the above classes are likely the most useful ones, the user can use an integer instead of a RRAIdentity object,
   and an Array(2) instead of the RRA_Avg object:</P>
<PRE> 
      object_list = [0,1,2,[1,1800]]
      new RRDRRAFilterAvg(rrd_file, object_list);
</PRE>

<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMinSteps()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the base <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#I__step__s_step__default__300_seconds_">interval
                                        in seconds</A> that was used to feed the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getLastUpdate()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the timestamp of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdlastupdate.en.html">last
                                        update</A>.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrDSs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDSNames()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the names of the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Sources</A> present in the RRD file.
                                        </P>
                                </TD>
<TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getDS(id)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>If id is a number, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the id-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A>.</P>
                                        <P>If id is a string, return an object of type <A HREF="#RRDDS">RRDDS</A> holding
                                        the information about the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">Data
                                        Source</A> with the requested name.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrRRAs()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archives</A> present in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRAInfo(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRAInfo">RRDRRAInfo</A>
                                        holding the information about the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRRA(n)</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return an object of type <A HREF="#RRDRRA">RRDRRA</A> that
                                        can be used to access the values stored in the n-th <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Round
                                        Robin Archive</A>.</P>
                                </TD>
                        </TR>
                </TBODY>
	</TABLE>
</DIV> 


<HR>
<H3 CLASS="heading-2-western">Internal Methods for Developers</H3>
<H4> For RRDFilterDS: </H4>
<H2 CLASS="heading-2-western"><A NAME="RRDRRAFilterDS"></A>Class RRDRRAFilterDS</H2>
<P> This class filters out a subset of DSs from an RRA identified by index or name. </P>
<P>The constructor has two arguments: rrd_rra (the RRA) and ds_list (the list of DSs to filter).</P>

<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
		<TBODY>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getIdx()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return which RRA it is in the RRD file.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getNrRows()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of rows in the RRA.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getNrDSs()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of DSs in the RRD file.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getStep()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of seconds between rows.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getCFName()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Consolidation
					Function</A> used by the RRA.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getEl(r,d)</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the value for the d-th DS in the r-th row.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getElFast(r,d)</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the low-precision value for the d-th DS in the r-th row.</P>
				</TD>
			</TR>
		</TBODY>
	</TABLE>
</DIV>

<H2 CLASS="heading-2-western"><A NAME="RRDDSFilterOP"></A>Class RRDDSFilterOp</H2>
<P>This class filters DSs from an RRD by using a user-provided filter object. </P>
<P>This class has three arguments: rrd_file, op_object (the filter object) and my_idx (index of new DS in case old one was modified by a filter).
<P>This class implements the following methods:</P>
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getIdx()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return which DS it is in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getName()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the name of the data source.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getType()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IDS_ds_name_DST_dst_arguments">type</A>
                                        of the data source.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMin()</P>
                                </TD>
                                <TD ROWSPAN=2 WIDTH=80%>
                                        <P>Return the minimum and maximum value the data source can
                                        contain.
                                        </P>
                                        <P>If either is not defined, <I>undefined</I> is returned.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getMax()</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getRealDSList()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Returns which DSs is being used in the Filter.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>ComputeResult()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the computed result of the filter object on the DSs.</P>
                                </TD>
                        </TR>
                </TBODY>
	</TABLE>
</DIV>
<HR>
<H3> For RRDRRAFilterAvg: </H3>
<H2 CLASS="heading-2-western"><A NAME="RRAFilterAvg"</A>Class RRAFilterAvg</H2>
<P>The constructor has two arguments: the RRA and the Filter object for that RRA.</P>
<P>The filter changes the NrRows (number of rows) and the way the elements are fetched (getEl and getElFast).
<P>All other attributes are copied from the base RRA (the rra given in the arguments).
<DIV ALIGN=RIGHT>
	<TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
		<COL WIDTH=51*>
		<COL WIDTH=205*>
		<THEAD>
			<TR VALIGN=TOP>
				<TH WIDTH=20%>
					<P ALIGN=LEFT>Method</P>
				</TH>
				<TH WIDTH=80%>
					<P ALIGN=LEFT>Description</P>
				</TH>
			</TR>
		</THEAD>
		<TBODY>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getIdx()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return which RRA it is in the RRD file (real index, not base RRA index).</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getNrRows()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of rows in the RRA.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getNrDSs()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of DSs in the RRD file.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getStep()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the number of seconds between rows.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getCFName()</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Consolidation
					Function</A> used by the RRA.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getEl(r,d)</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the value for the d-th DS in the r-th row, modified by the filter.</P>
				</TD>
			</TR>
			<TR VALIGN=TOP>
				<TD WIDTH=20%>
					<P>getElFast(r,d)</P>
				</TD>
				<TD WIDTH=80%>
					<P>Return the low-precision value for the d-th DS in the r-th row, modified by the filter.</P>
				</TD>
			</TR>
                </TBODY>
	</TABLE>
</DIV>
	<H2 CLASS="heading-2-western"><A NAME="RRAInfoFilterAvg"></A>Class RRAInfoFilterAvg</H2>
<P>This class implements the methods needed to access the new RRA. The filter only changes the PdpPerRow.</P>
<DIV ALIGN=RIGHT>
        <TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
                <COL WIDTH=52*>
                <COL WIDTH=204*>
                <THEAD>
                        <TR VALIGN=TOP>
                                <TH WIDTH=20%>
                                        <P ALIGN=LEFT>Method</P>
                                </TH>
                                <TH WIDTH=80%>
                                        <P ALIGN=LEFT>Description</P>
                                </TH>
                        </TR>
                </THEAD>
                <TBODY>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getIdx()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return which RRA it is in the RRD file.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getNrRows()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of rows in the RRA.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getStep()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the number of seconds between rows.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getCFName()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return the <A HREF="http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html#IRRA_CF_cf_arguments">Consolidation
                                        Function</A> used by the RRA.</P>
                                </TD>
                        </TR>
                        <TR VALIGN=TOP>
                                <TD WIDTH=20%>
                                        <P>getPdpPerRow()</P>
                                </TD>
                                <TD WIDTH=80%>
                                        <P>Return number of slots used for consolidation.</P>
                                </TD>
                        </TR>
                </TBODY>
        </TABLE>
</DIV>

</TABLE>
</DIV>

<TABLE WIDTH=50% CELLPADDING=2 CELLSPACING=2>
        <TR>
                <TD>
                        <HR>
                        <P>This module is part of the <A HREF="index.html">javascriptRRD
                        package</A> hosted at <A HREF="http://javascriptrrd.sourceforge.net/">http://javascriptrrd.sourceforge.net</A>.
                        <BR>It is licensed under the <A HREF="http://www.opensource.org/licenses/mit-license.php">MIT
                        license</A>.
                        </P>
                        <HR>
                </TD>
        </TR>
</TABLE>

</BODY>
</HTML>