User Tools

Site Tools


due_to_source_code_changing_3

in the file conf.php (in “/etc/ganglia/”) was inserted: for the additional time ranges:

$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
);

for the additional graph sizes:

$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
   )
);

in the file graph.php (in the <GANGLIA HOME>/) inserted line pick the “from” url parameter:

$customstart = isset($_GET["from"]) ?  clean_number ( sanitize( $_GET["from"] ) ) : NULL;

customizing of the start and end points of the graph

# Calculate time range with custom start point.
if ($customstart)
{
      $start = date_timestamp_get(date_create($customstart));
      $end = $start + $time_ranges[ $range ];
}

to prevent of the overwriting of our parameters:

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";
}
due_to_source_code_changing_3.txt · Last modified: 2013/07/25 15:52 by noskov