It's some of the first php I ever wrote. I'm sure there is a better way to do this but once it suited my needs I stopped working on it.
around line 718:
Code: Select all
/* need to suppress if is an aggregate graph ($graph["host_id"] != 0) */
if ($graph["host_id"] != 0){
$sql = "SELECT DISTINCT
graph_templates_item.local_graph_id,
data_template_rrd.id as data_template_rrd_id,
data_template_rrd.local_data_id,
data_template_rrd.data_source_name,
thold_data.id as thold_id, thold_data.thold_hi, thold_data.thold_low
FROM data_template_rrd, graph_templates_item, thold_data
WHERE graph_templates_item.local_graph_id = $local_graph_id
AND data_template_rrd.id = thold_data.data_id
AND thold_data.rra_id=data_template_rrd.local_data_id
AND graph_templates_item.task_item_id = data_template_rrd.id LIMIT 1";
$aaThold = db_fetch_assoc($sql);
if (isset($aaThold[0]['local_data_id'])){
$commenthead = "Thresholds for " . $aaThold[0]['data_source_name'] . "\:\\n\"";
if (is_numeric($aaThold[0]['thold_hi'])){
$graph_tholds = RRD_NL . "COMMENT:\"\\n\"" . RRD_NL . "COMMENT:\" \\n\"" . RRD_NL . "COMMENT:\"$commenthead";
$graph_tholds .= RRD_NL . "COMMENT:\" \"";
if (is_numeric($aaThold[0]['thold_hi'])){
$graph_tholds .= RRD_NL . "HRULE:" . $aaThold[0]['thold_hi'] . "#FF0000FF:\"High\: " . $aaThold[0]['thold_hi'] . "\\n\"";
}
$graph_tholds .= RRD_NL . "COMMENT:\" \"" . RRD_NL;
if (is_numeric($aaThold[0]['thold_low'])){
$graph_tholds .= "HRULE:" . $aaThold[0]['thold_low'] . "#0000FFFF:\"Low\: " . $aaThold[0]['thold_low'] . "\"" . RRD_NL;
}
}else{
$graph_tholds .= RRD_NL . "COMMENT:\"thold fail\"" . RRD_NL;
}
}else{
//debug //$graph_tholds .= RRD_NL . "COMMENT:\"($datatemplaterrdid)\"" . RRD_NL;
}
}
//$graph_tholds .= RRD_NL . "COMMENT:\"(lgi\:$local_graph_id, dtri\:" . $aaThold[0]["data_template_rrd_id"] . ", ldi\:" . $aaThold[0]["local_data_id"] . ", thi\:" . $aaThold[0]["thold_id"] . ")\"" . RRD_NL;
Code: Select all
//thold hrules
$txt_graph_items .= $graph_tholds;