File: cdefs.html

package info (click to toggle)
cacti 0.8.8b%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 9,796 kB
  • sloc: php: 52,273; sql: 2,463; xml: 691; sh: 434; perl: 151; makefile: 30
file content (1110 lines) | stat: -rw-r--r-- 37,681 bytes parent folder | download | duplicates (3)
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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>CDEFs</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="The Cacti Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="RRDTool Specific Features"
HREF="rrdtool_features.html"><LINK
REL="PREVIOUS"
TITLE="RRDTool Specific Features"
HREF="rrdtool_features.html"><LINK
REL="NEXT"
TITLE="Command Line Scripts"
HREF="scripts.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="manual.css"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Cacti Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="rrdtool_features.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 19. RRDTool Specific Features</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="scripts.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="CDEFS"
>CDEFs</A
></H1
><P
>				CDEFs allow you to apply mathematical functions to graph data to alter output. The concept of a
				CDEF comes straight from <SPAN
CLASS="APPLICATION"
>RRDTool</SPAN
>, and are written in reverse polish notation (RPN). For more
				information regarding the syntax of CDEFs, check out the <A
HREF="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/doc/rrdgraph_data.en.html"
TARGET="_top"
>CDEF tutorial</A
>.
			</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="ADD_NEW_CDEF"
>Creating a CDEF</A
></H2
><P
>					To create a new CDEF in Cacti, select the <SPAN
CLASS="GUILABEL"
>Graph Management</SPAN
> option under
					the <SPAN
CLASS="GUILABEL"
>Management</SPAN
> heading, and select <SPAN
CLASS="GUILABEL"
>CDEFs</SPAN
>. Once at
					this screen, click <SPAN
CLASS="GUILABEL"
>Add</SPAN
> to the right. You will be prompted for a CDEF
					name, for which you can type anything used to describe your CDEF. Click the <SPAN
CLASS="GUILABEL"
>Create</SPAN
>
					button so you are redirected back to the edit page, now with an empty <SPAN
CLASS="GUILABEL"
>CDEF Items</SPAN
>
					box. Construct your CDEF by adding an item for each element in the CDEF string, common types such as
					operators and functions are enumerated for your convenience. Below is a basic description of each
					CDEF item type.
				</P
><DIV
CLASS="TABLE"
><A
NAME="AEN2802"
></A
><P
><B
>Table 19-1. CDEF Item Types</B
></P
><TABLE
BORDER="1"
FRAME="border"
RULES="all"
CLASS="CALSTABLE"
><COL
WIDTH="1*"><COL
WIDTH="3*"><THEAD
><TR
><TH
ALIGN="CENTER"
>Type</TH
><TH
ALIGN="CENTER"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>Function</TD
><TD
>You can choose a CDEF function to use as the item. The <A
HREF="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/doc/rrdgraph.en.html"
TARGET="_top"
>RRDTool graph manual</A
> describes the purpose of each CDEF function.</TD
></TR
><TR
><TD
>Operator</TD
><TD
>Just your standard math operators, including modulo (%).</TD
></TR
><TR
><TD
>Special Data Source</TD
><TD
>A special data source is basically a flag to tell Cacti to do some special processing when it encounters this CDEF item. The "Current Graph Item Data Source" type basically inserts the name of the data source that is referenced by the graph item that references to this CDEF. Both of the "All Data Sources" types insert a summation of all data sources used on a graph.</TD
></TR
><TR
><TD
>Another CDEF</TD
><TD
>You can recursively use another CDEF within this CDEF.</TD
></TR
><TR
><TD
>Custom String</TD
><TD
>Sometimes it's just easier to type out the literal CDEF string manually. When referencing to data sources on the graph, remember that Cacti names them 'a', 'b', 'c', '...', starting with the first data source on the graph.</TD
></TR
></TBODY
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CDEF_SPECIAL_DATA_SOURCE"
>Special Data Source</A
></H2
><P
>The <SPAN
CLASS="GUILABEL"
>Special Data Souce</SPAN
> selection introduces some variables not known
				to plain vanilla rrdtool. Let's spend some few words of them to unleash their power.</P
><DIV
CLASS="TABLE"
><A
NAME="AEN2832"
></A
><P
><B
>Table 19-2. CDEF Special Data Source</B
></P
><TABLE
BORDER="1"
FRAME="border"
RULES="all"
CLASS="CALSTABLE"
><COL
WIDTH="1*"><COL
WIDTH="3*"><THEAD
><TR
><TH
ALIGN="CENTER"
>Special Data Source</TH
><TH
ALIGN="CENTER"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>Current Graph Item Data Source</TD
><TD
>Will be replaced by the DEF name of the rrdtool data source referred by the graph item this CDEF is associated to.</TD
></TR
><TR
><TD
>All Data Sources (Don't Include Duplicates)</TD
><TD
>Will add up all data sources of the whole graph to form a total. A data source that appears more than once will be counted only once. Data sources that differ by consolidation functions only are NOT counted as different data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted only once). It is NOT required to associate the graph item to any data source!</TD
></TR
><TR
><TD
>All Data Sources (Include Duplicates)</TD
><TD
>Will add up all data sources of the whole graph to form a total. A data source that appears more than once will be counted for each time of it's appearance. Data sources that differ by consolidation functions only are NOT counted as different data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted only once). It is NOT required to associate the graph item to any data source!</TD
></TR
><TR
><TD
>Similar Data Sources (Don't Include Duplicates)</TD
><TD
>It is REQUIRED to associate the graph item to the data source that shall be totalled! Let's assume the data source is named "traffic_in". Then, cacti will add up all data sources "traffic_in" of the whole graph to form a data source specific total (e.g. Total traffic In). Data sources with different consolidation functions are counted as same data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted once)</TD
></TR
><TR
><TD
>Similar Data Sources (Include Duplicates)</TD
><TD
>It is REQUIRED to associate the graph item to the data source that shall be totalled! If a data source appears multiple times, it will be added this many times.</TD
></TR
><TR
><TD
>Current Data Source Item: Minimum Value</TD
><TD
>Taken from the Data Template - Data Source Item related to this graph item: fetches the minimum value defined for the given data template. Caution: This is NOT the smallest entry of the given data source!</TD
></TR
><TR
><TD
>Current Data Source Item: Maximum Value</TD
><TD
>Taken from the Data Template - Data Source Item related to this graph item: fetches the maximum value defined for the given data template. Caution: This is NOT the highest entry of the given data source!</TD
></TR
><TR
><TD
>Graph: Lower Limit</TD
><TD
>Taken from the Graph Template: fetches the Lower Limit defined to the Graph Template. This is independant of all --alt-autoscaling options. It is NOT the dynamically determined lower boundary of the graph!</TD
></TR
><TR
><TD
>Graph: Upper Limit</TD
><TD
>Taken from the Graph Template: fetches the Upper Limit defined to the Graph Template. This is independant of all --alt-autoscaling options. It is NOT the dynamically determined upper boundary of the graph!</TD
></TR
><TR
><TD
>Count of All Data Sources (Don't Include Duplicates)</TD
><TD
>Will count the number of all data sources of the whole graph. A data source that appears more than once will be counted only once. Data sources that differ by consolidation functions only are NOT counted as different data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted only once). It is NOT required to associate the graph item to any data source!</TD
></TR
><TR
><TD
>Count of All Data Sources (Include Duplicates)</TD
><TD
>Will count the number of all data sources of the whole graph. A data source that appears more than once will be counted for each time of it's appearance. Data sources that differ by consolidation functions only are NOT counted as different data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted only once). It is NOT required to associate the graph item to any data source!</TD
></TR
><TR
><TD
>Count of Similar Data Sources (Don't Include Duplicates)</TD
><TD
>It is REQUIRED to associate the graph item to the data source that shall be counted! Let's assume the data source is named "traffic_in". Then, cacti will count all data sources "traffic_in" of the whole graph. Data sources with different consolidation functions are counted as same data sources (e.g. traffic_in:AVERAGE and traffic_in:MAX are counted once)</TD
></TR
><TR
><TD
>Count of Similar Data Sources (Include Duplicates)</TD
><TD
>It is REQUIRED to associate the graph item to the data source that shall be counted! If a data source appears multiple times, it will be counted this many times.</TD
></TR
></TBODY
></TABLE
></DIV
><P
>While the <CODE
CLASS="PARAMETER"
>All Data Sources/Similar Data Sources</CODE
> pseudo CDEF variables
				perform <B
CLASS="EMPHASIS"
>totaling</B
>, the <CODE
CLASS="PARAMETER"
>Count All Data Sources/Count Similar Data Sources</CODE
>
				pseudo CDEF Variables simply <B
CLASS="EMPHASIS"
>count</B
> the occurences of the related data sources.
				Thus, it is easy to compute e.g. an average of all similar data sources by creating the CDEF
				</P
><PRE
CLASS="SCREEN"
>CDEF=SIMILAR_DATA_SOURCES_NODUPS,COUNT_SIMILAR_DS_NODUPS,/</PRE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CDEF_SPECIAL_DATA_SOURCE_EXAMPLES"
>Using Special Data Source</A
></H2
><P
>Let's have some examples:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2890"
></A
><P
><B
>Example 19-1. Sum up all Data Sources Omitting Duplicates</B
></P
><P
>This is the list of graph items defined. Please note,
					that Item#17-20 are duplicates of Item#1-4. Even if it usually does not make sense, for this
					discussion it is very valuable. Item#21-24 are related to a
					<B
CLASS="EMPHASIS"
>cdef=ALL_DATA_SOURCES_NODUPS</B
></P
><PRE
CLASS="SCREEN"
>Graph Item  Data Source                         Graph Item Type  CF Type
Item # 1    (traffic_in): 1. Target Traffic In 	          LINE1  AVERAGE
Item # 2    (traffic_in): Current:                       GPRINT     LAST
Item # 3    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 4    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 5    (traffic_in): 2. Target Traffic In            LINE1  AVERAGE
Item # 6    (traffic_in): Current:                       GPRINT     LAST
Item # 7    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 8    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 9    (traffic_out): 1. Target Traffic Out          LINE1  AVERAGE
Item # 10   (traffic_out): Current:                      GPRINT     LAST
Item # 11   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 12   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 13   (traffic_out): 2. Target Traffic Out          LINE1  AVERAGE
Item # 14   (traffic_out): Current:                      GPRINT     LAST
Item # 15   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 16   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 17   (traffic_in): 1. Target Again Traffic In      LINE1  AVERAGE
Item # 18   (traffic_in): Current:                       GPRINT     LAST
Item # 19   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 20   (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 21   (No Task): AllDsNoDups                        LINE1  AVERAGE
Item # 22   (No Task): Current:                          GPRINT     LAST
Item # 23   (No Task): Average:                          GPRINT  AVERAGE
Item # 24   (No Task): Maximum:[HR]                      GPRINT      MAX</PRE
><P
>And this is the rrd graph statement:</P
><PRE
CLASS="SCREEN"
>/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Traffic AllDsNoDups" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:MAX \
DEF:c="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:AVERAGE \
DEF:d="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:MAX \
DEF:e="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:AVERAGE \
DEF:f="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:MAX \
DEF:g="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:AVERAGE \
DEF:h="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:MAX \
CDEF:cdefca=TIME,1202925514,GT,a,a,UN,0,a,IF,IF,TIME,1202925514,GT,c,c,UN,0,c,IF,IF,TIME,1202925514,GT,e,e,UN,0,e,IF,IF,TIME,1202925514,GT,g,g,UN,0,g,IF,IF,+,+,+ \
LINE1:a#FFFF00FF:"1. Target Traffic In"  \
GPRINT:a:LAST:"      Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:c#FFD660FF:"2. Target Traffic In"  \
GPRINT:c:LAST:"      Current\:%8.2lf%s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:e#CAF100FF:"1. Target Traffic Out"  \
GPRINT:e:LAST:"     Current\:%8.2lf%s"  \
GPRINT:e:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:f:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:g#CCBB00FF:"2. Target Traffic Out"  \
GPRINT:g:LAST:"     Current\:%8.2lf%s"  \
GPRINT:g:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:h:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:a#FF0000FF:"1. Target Again Traffic In"  \
GPRINT:a:LAST:"Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:cdefca#000000FF:"AllDsNoDups"  \
GPRINT:cdefca:LAST:"               Current\:%8.2lf%s"  \
GPRINT:cdefca:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:cdefca:MAX:"Maximum\:%8.2lf%s\n"</PRE
><P
>The data sources are denoted by the letters <SPAN
CLASS="GUILABEL"
>a</SPAN
> to <SPAN
CLASS="GUILABEL"
>h</SPAN
>.
					<SPAN
CLASS="GUILABEL"
>cdefca</SPAN
> represents the important part. You surely notice, that
					all data sources using consolidation function AVERAGE are taken into account while MAX is skipped.
					Please pay attention to the data source denoted by <SPAN
CLASS="GUILABEL"
>a</SPAN
>. Even though the data source appears twice,
					the cdef shows it only once. This is due to the duplicate suppression.</P
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2902"
></A
><P
><B
>Example 19-2. Sum up all Data Sources Including Duplicates</B
></P
><P
>This is the list of graph items defined. Please note,
					that Item#17-20 are duplicates of Item#1-4. Even if it usually does not make sense, for this
					discussion it is very valuable. Item#21-24 are related to a
					<B
CLASS="EMPHASIS"
>cdef=ALL_DATA_SOURCES_DUPS</B
></P
><PRE
CLASS="SCREEN"
>Graph Item  Data Source                         Graph Item Type  CF Type
Item # 1    (traffic_in): 1. Target Traffic In 	          LINE1  AVERAGE
Item # 2    (traffic_in): Current:                       GPRINT     LAST
Item # 3    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 4    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 5    (traffic_in): 2. Target Traffic In            LINE1  AVERAGE
Item # 6    (traffic_in): Current:                       GPRINT     LAST
Item # 7    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 8    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 9    (traffic_out): 1. Target Traffic Out          LINE1  AVERAGE
Item # 10   (traffic_out): Current:                      GPRINT     LAST
Item # 11   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 12   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 13   (traffic_out): 2. Target Traffic Out          LINE1  AVERAGE
Item # 14   (traffic_out): Current:                      GPRINT     LAST
Item # 15   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 16   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 17   (traffic_in): 1. Target Again Traffic In      LINE1  AVERAGE
Item # 18   (traffic_in): Current:                       GPRINT     LAST
Item # 19   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 20   (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 21   (No Task): AllDsDups                          LINE1  AVERAGE
Item # 22   (No Task): Current:                          GPRINT     LAST
Item # 23   (No Task): Average:                          GPRINT  AVERAGE
Item # 24   (No Task): Maximum:[HR]                      GPRINT      MAX</PRE
><P
>And this is the rrd graph statement:</P
><PRE
CLASS="SCREEN"
>/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Traffic AllDsDups" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:MAX \
DEF:c="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:AVERAGE \
DEF:d="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:MAX \
DEF:e="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:AVERAGE \
DEF:f="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:MAX \
DEF:g="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:AVERAGE \
DEF:h="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:MAX \
CDEF:cdefca=TIME,1202925583,GT,a,a,UN,0,a,IF,IF,TIME,1202925583,GT,c,c,UN,0,c,IF,IF,TIME,1202925583,GT,e,e,UN,0,e,IF,IF,TIME,1202925583,GT,g,g,UN,0,g,IF,IF,TIME,1202925583,GT,a,a,UN,0,a,IF,IF,+,+,+,+ \
LINE1:a#FFFF00FF:"1. Target Traffic In"  \
GPRINT:a:LAST:"      Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:c#FFD660FF:"2. Target Traffic In"  \
GPRINT:c:LAST:"      Current\:%8.2lf%s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:e#CAF100FF:"1. Target Traffic Out"  \
GPRINT:e:LAST:"     Current\:%8.2lf%s"  \
GPRINT:e:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:f:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:g#CCBB00FF:"2. Target Traffic Out"  \
GPRINT:g:LAST:"     Current\:%8.2lf%s"  \
GPRINT:g:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:h:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:a#FF0000FF:"1. Target Again Traffic In"  \
GPRINT:a:LAST:"Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:cdefca#000000FF:"AllDsDups"  \
GPRINT:cdefca:LAST:"                 Current\:%8.2lf%s"  \
GPRINT:cdefca:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:cdefca:MAX:"Maximum\:%8.2lf%s\n"</PRE
><P
>Again, the data sources are denoted by the letters <SPAN
CLASS="GUILABEL"
>a</SPAN
> to <SPAN
CLASS="GUILABEL"
>h</SPAN
> and
					<SPAN
CLASS="GUILABEL"
>cdefca</SPAN
> represents the important part. Please pay attention to the data source
					denoted by <SPAN
CLASS="GUILABEL"
>a</SPAN
> appearing twice in this cdef.
					This is, because it appears twice (Item#17-20) in the graph item list
					and duplicate suppression is not in effect.</P
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2914"
></A
><P
><B
>Example 19-3. Sum up Similar Data Sources Omitting Duplicates</B
></P
><P
>Everything is very much like the above; again
					Item#17-20 are duplicates of Item#1-4. Item#21-24 are related to a
					<B
CLASS="EMPHASIS"
>cdef=SIMILAR_DATA_SOURCES_NODUPS</B
> and are associated with the
					data source <B
CLASS="EMPHASIS"
>traffic_in</B
> of the 1. target (it does not matter, which target is chosen,
					as long as you only choose a traffic_in data source)</P
><PRE
CLASS="SCREEN"
>Graph Item  Data Source                         Graph Item Type  CF Type
Item # 1    (traffic_in): 1. Target Traffic In 	          LINE1  AVERAGE
Item # 2    (traffic_in): Current:                       GPRINT     LAST
Item # 3    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 4    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 5    (traffic_in): 2. Target Traffic In            LINE1  AVERAGE
Item # 6    (traffic_in): Current:                       GPRINT     LAST
Item # 7    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 8    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 9    (traffic_out): 1. Target Traffic Out          LINE1  AVERAGE
Item # 10   (traffic_out): Current:                      GPRINT     LAST
Item # 11   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 12   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 13   (traffic_out): 2. Target Traffic Out          LINE1  AVERAGE
Item # 14   (traffic_out): Current:                      GPRINT     LAST
Item # 15   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 16   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 17   (traffic_in): 1. Target Again Traffic In      LINE1  AVERAGE
Item # 18   (traffic_in): Current:                       GPRINT     LAST
Item # 19   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 20   (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 21   (traffic_in): SimilarDsNoDups                 LINE1  AVERAGE
Item # 22   (traffic_in): Current:                       GPRINT     LAST
Item # 23   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 24   (traffic_in): Maximum:[HR]                   GPRINT      MAX</PRE
><P
>And this is the rrd graph statement:</P
><PRE
CLASS="SCREEN"
>/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Traffic SimilarDsNoDups" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:MAX \
DEF:c="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:AVERAGE \
DEF:d="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:MAX \
DEF:e="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:AVERAGE \
DEF:f="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:MAX \
DEF:g="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:AVERAGE \
DEF:h="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:MAX \
CDEF:cdefca=TIME,1202924474,GT,a,a,UN,0,a,IF,IF,TIME,1202924474,GT,c,c,UN,0,c,IF,IF,+ \
CDEF:cdefcd=TIME,1202924474,GT,b,b,UN,0,b,IF,IF,TIME,1202924474,GT,d,d,UN,0,d,IF,IF,+ \
LINE1:a#FFFF00FF:"1. Target Traffic In"  \
GPRINT:a:LAST:"      Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:c#FFD660FF:"2. Target Traffic In"  \
GPRINT:c:LAST:"      Current\:%8.2lf%s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:e#CAF100FF:"1. Target Traffic Out"  \
GPRINT:e:LAST:"     Current\:%8.2lf%s"  \
GPRINT:e:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:f:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:g#CCBB00FF:"2. Target Traffic Out"  \
GPRINT:g:LAST:"     Current\:%8.2lf%s"  \
GPRINT:g:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:h:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:a#FF0000FF:"1. Target Again Traffic In"  \
GPRINT:a:LAST:"Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:cdefca#000000FF:"SimilarDsNoDups"  \
GPRINT:cdefca:LAST:"           Current\:%8.2lf%s"  \
GPRINT:cdefca:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:cdefcd:MAX:"Maximum\:%8.2lf%s\n" </PRE
><P
><SPAN
CLASS="GUILABEL"
>cdefca</SPAN
> calculates the SUM of all traffic_in data sources, but
					pays attention only to consolidation function AVERAGE. Duplicate suppression makes sure, that the second
					occurrence of the 1. target is not taken into account. So it's only summing data source
					<SPAN
CLASS="GUILABEL"
>a</SPAN
> and <SPAN
CLASS="GUILABEL"
>c</SPAN
>. <SPAN
CLASS="GUILABEL"
>cdefca</SPAN
> is used the the LINE1
					graph item with exact match for consolidation function AVERAGE as well as for the best matched
					consolidation functions LAST and MIN.</P
><P
><SPAN
CLASS="GUILABEL"
>cdefcd</SPAN
> calculates the SUM of all traffic_in data sources, but
					pays attention only to consolidation function MAX. Again, duplicate suppression is in effect.
					So it's only summing data source
					<SPAN
CLASS="GUILABEL"
>b</SPAN
> and <SPAN
CLASS="GUILABEL"
>d</SPAN
>. <SPAN
CLASS="GUILABEL"
>cdefcd</SPAN
> is used for the
					graph item with exact match for consolidation function MAX only. This is, because my rra settings
					only define AVERAGE and MAX, where LAST and MIN are omitted. This may differ for installations
					defining LAST and MIN as well.</P
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2932"
></A
><P
><B
>Example 19-4. Sum up Similar Data Sources Including Duplicates</B
></P
><P
>Again, please note,
					that Item#17-20 are duplicates of Item#1-4. Item#21-24 are related to a
					<B
CLASS="EMPHASIS"
>cdef=SIMILAR_DATA_SOURCES_DUPS</B
> and are associated with the
					data source <B
CLASS="EMPHASIS"
>traffic_in</B
> of the 1. target (it does not matter, which target is chosen,
					as long as you only choose a traffic_in data source)</P
><PRE
CLASS="SCREEN"
>Graph Item  Data Source                         Graph Item Type  CF Type
Item # 1    (traffic_in): 1. Target Traffic In 	          LINE1  AVERAGE
Item # 2    (traffic_in): Current:                       GPRINT     LAST
Item # 3    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 4    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 5    (traffic_in): 2. Target Traffic In            LINE1  AVERAGE
Item # 6    (traffic_in): Current:                       GPRINT     LAST
Item # 7    (traffic_in): Average:                       GPRINT  AVERAGE
Item # 8    (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 9    (traffic_out): 1. Target Traffic Out          LINE1  AVERAGE
Item # 10   (traffic_out): Current:                      GPRINT     LAST
Item # 11   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 12   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 13   (traffic_out): 2. Target Traffic Out          LINE1  AVERAGE
Item # 14   (traffic_out): Current:                      GPRINT     LAST
Item # 15   (traffic_out): Average:                      GPRINT  AVERAGE
Item # 16   (traffic_out): Maximum:[HR]                  GPRINT      MAX
Item # 17   (traffic_in): 1. Target Again Traffic In      LINE1  AVERAGE
Item # 18   (traffic_in): Current:                       GPRINT     LAST
Item # 19   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 20   (traffic_in): Maximum:[HR]                   GPRINT      MAX
Item # 21   (traffic_in): SimilarDsDups                   LINE1  AVERAGE
Item # 22   (traffic_in): Current:                       GPRINT     LAST
Item # 23   (traffic_in): Average:                       GPRINT  AVERAGE
Item # 24   (traffic_in): Maximum:[HR]                   GPRINT      MAX</PRE
><P
>And this is the rrd graph statement:</P
><PRE
CLASS="SCREEN"
>/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Traffic SimilarDsDups" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_in:MAX \
DEF:c="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:AVERAGE \
DEF:d="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_in:MAX \
DEF:e="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:AVERAGE \
DEF:f="/var/www/html/cacti/rra/target1_traffic_in_235.rrd":traffic_out:MAX \
DEF:g="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:AVERAGE \
DEF:h="/var/www/html/cacti/rra/target2_traffic_in_8.rrd":traffic_out:MAX \
CDEF:cdefca=TIME,1202925634,GT,a,a,UN,0,a,IF,IF,TIME,1202925634,GT,c,c,UN,0,c,IF,IF,TIME,1202925634,GT,a,a,UN,0,a,IF,IF,+,+ \
CDEF:cdefcd=TIME,1202925634,GT,b,b,UN,0,b,IF,IF,TIME,1202925634,GT,d,d,UN,0,d,IF,IF,TIME,1202925634,GT,b,b,UN,0,b,IF,IF,+,+ \
LINE1:a#FFFF00FF:"1. Target Traffic In"  \
GPRINT:a:LAST:"      Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:c#FFD660FF:"2. Target Traffic In"  \
GPRINT:c:LAST:"      Current\:%8.2lf%s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:e#CAF100FF:"1. Target Traffic Out"  \
GPRINT:e:LAST:"     Current\:%8.2lf%s"  \
GPRINT:e:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:f:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:g#CCBB00FF:"2. Target Traffic Out"  \
GPRINT:g:LAST:"     Current\:%8.2lf%s"  \
GPRINT:g:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:h:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:a#FF0000FF:"1. Target Again Traffic In"  \
GPRINT:a:LAST:"Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE1:cdefca#000000FF:"SimilarDsDups"  \
GPRINT:cdefca:LAST:"             Current\:%8.2lf%s"  \
GPRINT:cdefca:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:cdefcd:MAX:"Maximum\:%8.2lf%s\n" </PRE
><P
><SPAN
CLASS="GUILABEL"
>cdefca</SPAN
> and <SPAN
CLASS="GUILABEL"
>cdefcd</SPAN
> represents the important part. You surely notice, that
					all data sources using consolidation function AVERAGE are taken into account for calculation <SPAN
CLASS="GUILABEL"
>cdefca</SPAN
>,
					while MAX is calculated with <SPAN
CLASS="GUILABEL"
>cdefcd</SPAN
>.
					Please pay attention to the data source denoted by <SPAN
CLASS="GUILABEL"
>a</SPAN
> and <SPAN
CLASS="GUILABEL"
>b</SPAN
>, respectively,
					appearing twice in those cdefs as expected.</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CDEF_MORE_EXAMPLES"
>More CDEF Examples</A
></H2
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2949"
></A
><P
><B
>Example 19-5. Disk Usage as a Percentage</B
></P
><P
>This example is based on the standard data template <B
CLASS="EMPHASIS"
>ucd/net - Hard Drive Space</B
>.
					Cacti ships an associated graph template named <B
CLASS="EMPHASIS"
>ucd/net - Available Disk Space</B
>.
					Often, users complain about the fact, tha tthis template prints free and used space as absolute figures only.
					But instead of knowing, that your data partition has about 10GB used space, you may be interested in the
					percentage used. So let's create a simple example to show the power of the recently introduced special data sources.</P
><P
>To make it work, we need two new CDEFs. The first one may come in useful for a bunch of
					different graph templates. It's named <B
CLASS="EMPHASIS"
>Make Current Data Source 0</B
>. On a first glance,
					you may wonder why this CDEF is needed. It is used for those data sources, that will be used
					for calculations but shall not show up themselves. Here's the definition</P
><PRE
CLASS="SCREEN"
>cdef=CURRENT_DATA_SOURCE,0,*</PRE
><P
>Now, the other one, named <B
CLASS="EMPHASIS"
>Current DS as Percentage of all DS</B
></P
><PRE
CLASS="SCREEN"
>cdef=CURRENT_DATA_SOURCE,ALL_DATA_SOURCES_NODUPS,/,100,*</PRE
><P
>Here's a short discussion. The first three elements read: Take the current data source and
					divide it by "The Sum of All Data Sources (Don't include Duplicates)". To form a percentage, you will have
					to multiply by 100. This is done by adding the elements four and five.</P
><P
>Now, let's build up the new graph</P
><PRE
CLASS="SCREEN"
>Graph Item   Data Source         Graph Item Type  CF Type  Item Color
    Item#1   (hdd_used):         LINE1            AVERAGE
    Item#2   (hdd_free):         LINE1            AVERAGE
    Item#3   (hdd_used): % Used  AREA             AVERAGE  FF0000</PRE
><P
>Item#1+2 in most cases will exceed the maximum percentage of 100 by magnitudes.
					So they are associated with the CDEF named <B
CLASS="EMPHASIS"
>Make Current Data Source 0</B
> to make them zero.
					This adds the data sources to the graph but avoids them showing up. The pseudo-color of "None" is associated to
					both of them.</P
><P
>Iten#3 is associated to the data source <B
CLASS="EMPHASIS"
>hdd_used</B
> as we want to print the
					"% Used" of the partition. The CDEF is <B
CLASS="EMPHASIS"
>Current DS as Percentage of all DS</B
>, the
					color is set to "red (FF0000)".</P
><P
>And this is the rrd graph statement:</P
><PRE
CLASS="SCREEN"
>/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="gandalf - Disk Space - / %used" \
--rigid \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percent" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/target1_hdd_free_236.rrd":hdd_used:AVERAGE \
DEF:b="/var/www/html/cacti/rra/target1_hdd_free_236.rrd":hdd_free:AVERAGE \
CDEF:cdefa=a,0,* \
CDEF:cdefb=b,0,* \
CDEF:cdefc=a,TIME,1203272123,GT,a,a,UN,0,a,IF,IF,TIME,1203272123,GT,b,b,UN,0,b,IF,IF,+,/,100,* \
LINE1:cdefa:""  \
LINE1:cdefb:""  \
AREA:cdefc#FF0000FF:"% Used"</PRE
><P
><SPAN
CLASS="GUILABEL"
>cdefa</SPAN
> and <SPAN
CLASS="GUILABEL"
>cdefb</SPAN
> are used to make the according graph
					items zero. <SPAN
CLASS="GUILABEL"
>cdefc</SPAN
> performs the percentage calculation.</P
><P
>You may of cource add GPRINT legends as usual. If you do this for the "% Used" entry only, you
					will get surprising results, if your rrd file holds either MAXIMUM, LAST and/or MINIMUM
					consolidation function(s). This is left as an exercise to you ;-)</P
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN2975"
></A
><P
><B
>Example 19-6. Background Colors for Day and Night</B
></P
><P
>This set of CDEFs is used to colorize the background of a graph with different colors for day, night and weekends.
					The CDEFs are created as usual, we will show the CDEF definition only. Examples are taken from rrdtool-users mailing list
					courtesy Erik de Mare. Here are the definitions</P
><P
><B
CLASS="EMPHASIS"
>Background for Daytime</B
></P
><PRE
CLASS="SCREEN"
>cdef=LTIME,86400,%,28800,GT,LTIME,86400,%,64800,LT,INF,UNKN,CURRENT_DATA_SOURCE,*,IF,UNKN,CURRENT_DATA_SOURCE,*,IF</PRE
><P
><B
CLASS="EMPHASIS"
>Background for Nighttime</B
></P
><PRE
CLASS="SCREEN"
>cdef=LTIME,86400,%,28800,LT,INF,LTIME,86400,%,64800,GT,INF,UNKN,CURRENT_DATA_SOURCE,*,IF,IF</PRE
><P
><B
CLASS="EMPHASIS"
>Background for Weekend</B
></P
><PRE
CLASS="SCREEN"
>cdef=LTIME,604800,%,172800,GT,LTIME,604800,%,345600,LT,INF,UNKN,CURRENT_DATA_SOURCE,*,IF,UNKN,CURRENT_DATA_SOURCE,*,IF</PRE
><P
>The value of <B
CLASS="EMPHASIS"
>86400</B
> represents the number of seconds of a day, whereas
					<B
CLASS="EMPHASIS"
>28800</B
> represents 8:00, defined as the start of the day. End of the day, <B
CLASS="EMPHASIS"
>64800</B
> is
					assumed at 18:00. Please replace those values if required. For weekends, same logic applies.</P
><P
>Now, let's apply those new CDEFs to a Graph Template. For this example, I've chosen the <B
CLASS="EMPHASIS"
>Unix - Processes</B
>
					that applies to localhost only. In turn, please create three new graph items, associate the processes data source,
					make them AREAs, select	a color and opacity. Choose the daytime , nighttime and weekend CDEF in this sequence.
					As a last step, move those three new graph items to the top. I've chosen opacity of 20% for Item#1 to 3.</P
><PRE
CLASS="SCREEN"
>Graph Item  Data Source                Graph Item Type  CF Type  Item Color
Item # 1    (proc):                    AREA             AVERAGE  FFFF00
Item # 2    (proc):                    AREA             AVERAGE  0000FF
Item # 3    (proc):                    AREA             AVERAGE  2E3127
Item # 4    (proc): Running Processes  AREA             AVERAGE  F51D30
Item # 5    (proc): Current:           GPRINT           LAST
Item # 6    (proc): Average:           GPRINT           AVERAGE
Item # 7    (proc): Maximum:           GPRINT           MAX</PRE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="rrdtool_features.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="scripts.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>RRDTool Specific Features</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="rrdtool_features.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Command Line Scripts</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>