Changes between Version 1 and Version 2 of UserDocs


Ignore:
Timestamp:
Jan 23, 2008, 9:19:16 PM (14 years ago)
Author:
human
Comment:

Added generation of shading RRD graphs

Legend:

Unmodified
Added
Removed
Modified
  • UserDocs

    v1 v2  
    11The images in the Gallery would be a lot more useful if they were complemented by the source code.  Man pages are nice, but a couple of simple to complex examples (in cut & paste style) are even nicer.
     2
     3Here is one example:
     4{{{
     5RRDs::graph($pic_name,
     6    # Title of the graph, it is displayed on top of the image
     7    "--title", "$server CPU Load",
     8    # Defining colors for the basic graph objects
     9    "--color", "BACK#000000",
     10    "--color", "SHADEA#000000",
     11    "--color", "SHADEB#000000",
     12    "--color", "FONT#DDDDDD",
     13    "--color", "CANVAS#202020",
     14    "--color", "GRID#666666",
     15    "--color", "MGRID#AAAAAA",
     16    "--color", "FRAME#202020",
     17    "--color", "ARROW#FFFFFF",
     18    # limiting the graph to only 17 load
     19    "-u 17", "-r",
     20    # defining data segments for today's and yesterday's load
     21    "DEF:today=$rrd_name:cpuLoad:AVERAGE:start=end-86400:end=now",
     22    "DEF:yesterday=$rrd_name:cpuLoad:AVERAGE:start=end-86400:end=now-86400",
     23    # combining both data segments on one GRAPH
     24    # if we don't shift yesterday, it will not appear on the graph
     25    # since it's time frame is not the one that is currently viewed
     26    "SHIFT:yesterday:86400",
     27    # Generate averages for both days
     28    "CDEF:avg=PREV,UN,today,UN,UNKN,today,IF,PREV,IF,today,UN,1,today,IF,-,0.97,*,today,UN,1,today,IF,+",
     29    "CDEF:avg1=PREV,UN,yesterday,UN,UNKN,yesterday,IF,PREV,IF,yesterday,UN,1,yesterday,IF,-,0.97,*,yesterday,UN,1,yesterday,IF,+",
     30    # Write the average of today as a line
     31    "LINE1:avg#0000FF:Today avg\\t\\t",
     32
     33    "CDEF:shading2=today,0.98,*", "AREA:shading2#F90000:Today\\t",
     34    "CDEF:shading10=today,0.90,*", "AREA:shading10#E10000",
     35    "CDEF:shading15=today,0.85,*", "AREA:shading15#D20000",
     36    "CDEF:shading20=today,0.80,*", "AREA:shading20#C30000",
     37    "CDEF:shading25=today,0.75,*", "AREA:shading25#B40000",
     38    "CDEF:shading30=today,0.70,*", "AREA:shading30#A50000",
     39    "CDEF:shading35=today,0.65,*", "AREA:shading35#960000",
     40    "CDEF:shading40=today,0.60,*", "AREA:shading40#870000",
     41    "CDEF:shading45=today,0.55,*", "AREA:shading45#780000",
     42    "CDEF:shading50=today,0.50,*", "AREA:shading50#690000",
     43    "CDEF:shading55=today,0.45,*", "AREA:shading55#5A0000",
     44    "CDEF:shading60=today,0.40,*", "AREA:shading60#4B0000",
     45    "CDEF:shading65=today,0.35,*", "AREA:shading65#3C0000",
     46    "CDEF:shading70=today,0.30,*", "AREA:shading70#2D0000",
     47    "CDEF:shading75=today,0.25,*", "AREA:shading75#180000",
     48    "CDEF:shading80=today,0.20,*", "AREA:shading80#0F0000",
     49    "CDEF:shading85=today,0.15,*", "AREA:shading85#000000",
     50    #
     51    "GPRINT:today:MAX:Max load\\\: %.2lf",
     52    "GPRINT:today:AVERAGE:LoadAvg\\\: %.2lf\\n",
     53    "LINE1:avg1#00FFFF:Yesterday avg\\t",
     54    "CDEF:shadin2=yesterday,0.98,*", "AREA:shadin2#ffa946:Yesterday\\t",
     55    "CDEF:shadin10=yesterday,0.90,*", "AREA:shadin10#ffa946",
     56    "CDEF:shadin15=yesterday,0.85,*", "AREA:shadin15#e1953e",
     57    "CDEF:shadin20=yesterday,0.80,*", "AREA:shadin20#d28b3a",
     58    "CDEF:shadin25=yesterday,0.75,*", "AREA:shadin25#c38136",
     59    "CDEF:shadin30=yesterday,0.70,*", "AREA:shadin30#b47731",
     60    "CDEF:shadin35=yesterday,0.65,*", "AREA:shadin35#a56d2d",
     61    "CDEF:shadin40=yesterday,0.60,*", "AREA:shadin40#966329",
     62    "CDEF:shadin45=yesterday,0.55,*", "AREA:shadin45#875925",
     63    "CDEF:shadin50=yesterday,0.50,*", "AREA:shadin50#785021",
     64    "CDEF:shadin55=yesterday,0.45,*", "AREA:shadin55#69461d",
     65    "CDEF:shadin60=yesterday,0.40,*", "AREA:shadin60#5a3c19",
     66    "CDEF:shadin65=yesterday,0.35,*", "AREA:shadin65#4b3215",
     67    "CDEF:shadin70=yesterday,0.30,*", "AREA:shadin70#3c2810",
     68    "CDEF:shadin75=yesterday,0.25,*", "AREA:shadin75#2d1e0c",
     69    "CDEF:shadin80=yesterday,0.20,*", "AREA:shadin80#1e1408",
     70    "CDEF:shadin85=yesterday,0.15,*", "AREA:shadin85#0f0a04",
     71    "GPRINT:yesterday:MAX:Max load\\\: %.2lf",
     72    "GPRINT:yesterday:AVERAGE:LoadAvg\\\: %.2lf\\n"
     73);
     74}}}
     75
     76Marian Marinov <mm |AT| yuhu.biz>

NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.