User Tools

Site Tools


due_to_source_code_changing_3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

due_to_source_code_changing_3 [2013/07/25 15:52] (current)
noskov created
Line 1: Line 1:
 +**in the file conf.php (in "/​etc/​ganglia/"​) was inserted:**
 +for the additional time ranges:
 +<code php>
 +$time_ranges = array(
 +   '​minute'​=>​60,​
 +   '​5_minutes'​=>​300,​
 +   '​15_minutes'​=>​900,​
 +   '​30_minutes'​=>​1800,​
 +   '​45_minutes'​=>​2700,​
 +   '​hour'​=>​3600,​
 +   '​2_hours'​=>​7200,​
 +   '​4_hours'​=>​14400,​
 +   '​8_hours'​=>​28800,​
 +   '​12_hours'​=>​43200,​
 +   '​day'​=>​86400,​
 +   '​2_days'​=>​172800,​
 +   '​4_days'​=>​345600,​
 +   '​week'​=>​604800,​
 +   '​2_weeks'​=>​1209600,​
 +   '​month'​=>​2419200,​
 +   '​2_month'​=>​4838400,​
 +   '​4_month'​=>​9676800,​
 +   '​8_month'​=>​19353600,​
 +   '​year'​=>​31449600,​
 +   '​2_year'​=>​62899200
 +);
 +</​code>​
 +for the additional graph sizes:
 +<code php>
 +$graph_sizes = array(
 +   '​small'​=>​array(
 +     '​height'​=>​40,​
 +     '​width'​=>​130,​
 +     '​fudge_0'​=>​0,​
 +     '​fudge_1'​=>​0,​
 +     '​fudge_2'​=>​0
 +   ),
 +   '​medium'​=>​array(
 +     '​height'​=>​75,​
 +     '​width'​=>​300,​
 +     '​fudge_0'​=>​0,​
 +     '​fudge_1'​=>​14,​
 +     '​fudge_2'​=>​28
 +   ),
 +   '​large'​=>​array(
 +     '​height'​=>​600,​
 +     '​width'​=>​800,​
 +     '​fudge_0'​=>​0,​
 +     '​fudge_1'​=>​0,​
 +     '​fudge_2'​=>​0
 +   ),
 +     '​XL'​=>​array(
 +        '​height'​=>​600,​
 +        '​width'​=>​1600,​
 +        '​fudge_0'​=>​0,​
 +        '​fudge_1'​=>​0,​
 +        '​fudge_2'​=>​0
 +      ),
 +     '​XXL'​=>​array(
 +         '​height'​=>​600,​
 +         '​width'​=>​3200,​
 +         '​fudge_0'​=>​0,​
 +         '​fudge_1'​=>​0,​
 +         '​fudge_2'​=>​0
 +      ),
 +    # this was the default value when no other size was provided.
 +    '​default'​=>​array(
 +     '​height'​=>​100,​
 +     '​width'​=>​400,​
 +     '​fudge_0'​=>​0,​
 +     '​fudge_1'​=>​0,​
 +     '​fudge_2'​=>​0
 +   )
 +);
 +</​code>​
 +
 +**in the file graph.php (in the <GANGLIA HOME>/​)**
 +inserted line pick the "​from"​ url parameter:
 +
 +<code php>
 +$customstart = isset($_GET["​from"​]) ?  clean_number ( sanitize( $_GET["​from"​] ) ) : NULL;
 +</​code>​
 +customizing of the start and end points of the graph
 +<code php>
 +# Calculate time range with custom start point.
 +if ($customstart)
 +{
 +      $start = date_timestamp_get(date_create($customstart));​
 +      $end = $start + $time_ranges[ $range ];
 +}
 +</​code>​
 +to prevent of the overwriting of our parameters:
 +<code php>
 +foreach (array_keys ($rrdtool_graph) as $key) {
 +    if (preg_match('/​extras|series/',​ $key))
 +        continue;
 +    $value = $rrdtool_graph[$key];​
 +    if (preg_match('/​\W/',​ $value)) {
 +        //more than alphanumerics in value, so quote it
 +        $value = "'​$value'";​
 +    }   
 +    ​
 +     
 +    //begin of the changing
 +    if ($customstart){
 +         ​switch ($key) {
 +            case '​start':​
 +                $value = "'​$start'";​
 +                break;
 +                ​
 +            case '​end':​
 +                $value = "'​$end'";​
 +                break;
 +         }
 +    }
 +    //end of the changing
 +    ​
 +    ​
 +    $command .= " --$key $value";​
 +}
 +</​code>​
  
due_to_source_code_changing_3.txt · Last modified: 2013/07/25 15:52 by noskov