/*
+-------------------------------------------------------------------------+
| Copyright (C) 2002 Ian Berry |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any |
| questions or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/?>
$section = "Add/Edit Graphs"; include ('include/auth.php');
header("Cache-control: no-cache");
//include ('include/database.php');
//include ('include/config.php');
include_once ('include/form.php');
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
$current_script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]);
function draw_main_form_select() {
global $current_script_name, $colors;?>
|
|
}
function draw_graph_form_select() {
global $current_script_name, $colors; ?>
}
switch ($action) {
case 'graph_duplicate':
include_once ('include/utility_functions.php');
DuplicateGraph($id);
header ("Location: graphs.php");
break;
case 'graph_save':
if ($lowerlimit==""){$lowerlimit=0;} /* no nulls; zeros */
if ($upperlimit==""){$upperlimit=0;} /* no nulls; zeros */
if ($unitexponentvalue==""){$unitexponentvalue=0;} /* no nulls; zeros */
if ($id != 0) {
$grouping = db_fetch_cell("select Grouping from rrd_graph where id=$id");
if ($grouping != $grouping) { /* the value has changed */
include_once ('include/utility_functions.php');
if ($grouping == "on") {
group_graph_items($id);
}else{
ungroup_graph_items($id);
}
}
}
db_execute("replace into rrd_graph (id,imageformatid,title,height,width,
upperlimit,lowerlimit,verticallabel,autoscale,autopadding,autoscaleopts,rigid,
basevalue,grouping,export,unitvalue,unitexponentvalue,autoscalelog) values ($id,$imageformatid,
\"$title\",$height,$width,$upperlimit,$lowerlimit,\"$verticallabel\",\"$autoscale\",
\"$autopadding\",$autoscaleopts,\"$rigid\",$basevalue,\"$grouping\",\"$export\",
\"$unitvalue\",$unitexponentvalue,\"$autoscalelog\")");
if ($id == 0) {
/* get graphid if this is a new save */
$db_id = db_fetch_cell("select LAST_INSERT_ID()");
if ($db_id != 0) {
$id = $db_id;
}
}
header ("Location: graphs.php");
break;
case 'graph_remove':
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
include_once ('include/top_header.php');
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this graph?", $current_script_name, "?action=remove&id=$id");
exit;
}
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
db_execute("delete from rrd_graph where id=$id");
db_execute("delete from rrd_graph_item where graphid=$id");
db_execute("delete from graph_hierarchy_items where graphid=$id");
db_execute("delete from auth_graph where graphid=$id");
}
header ("Location: graphs.php");
break;
case 'graph_edit':
include_once ("include/top_header.php");
$title_text = "Graph Management [edit]"; $add_text = "$current_script_name?action=graph_edit";
include_once ("include/top_table_header.php");
draw_main_form_select();
?>
draw_graph_form_select();
if (isset($id)) {
$graphs = db_fetch_row("select * from rrd_graph where id=$id", $cnn_id);
}else{
unset($graphs);
}
?>

|
Title
The name that is printed on the graph.
|
Image Format
The type of graph that is generated; GIF or PNG.
|
Height
The height (in pixels) that the graph is.
|
Width
The width (in pixels) that the graph is.
|
Auto Scale
Auto scale vertical data instead of defining an upper and lower limit. Note: if this
is check both the Upper and Lower limit will be ignored.
|
DrawStrippedFormItemCheckBox("Rigid",$graphs[Rigid],"Use Rigid Boundaries Mode (--rigid)","",true);
DrawStrippedFormItemCheckBox("AutoScale",$graphs[AutoScale],"Auto Scale","on",true);
DrawStrippedFormItemRadioButton("AutoScaleOpts", $graphs[AutoScaleOpts], "1", "Use --alt-autoscale","2",true);
DrawStrippedFormItemRadioButton("AutoScaleOpts", $graphs[AutoScaleOpts], "2", "Use --alt-autoscale-max","2",true);
DrawStrippedFormItemCheckBox("AutoScaleLog",$graphs[AutoScaleLog],"Logarithmic Auto Scaling (--logarithmic)","",true);
?>
|
Auto Padding
Pad text so that legend and graph data always line up. Note: this could cause graphs
to take longer to render because of the larger overhead. Also Auto Padding may not
be accurate on all types of graphs, consistant labeling usually helps.
|
Allow Grouping
This will enable you to "group" items of your graph together for eaier manipulation.
Note when you check this box and save, cacti will automatically group the items in
your graph; you may have to re-group part of the graph manually.
|
Allow Graph Export
Choose whether this graph will be included in the static html/png export if you use
cacti's export feature.
|
Upper Limit
The maximum vertical value for the rrd graph.
|
Lower Limit
The minimum vertical value for the rrd graph.
|
Base Value
Should be set to 1024 for memory and 1000 for traffic measurements.
|
Unit Value
(--unit) Sets the exponent value on the Y-axis for numbers. Note: This option was
recently added in rrdtool 1.0.36.
|
Unit Exponent Value
What unit cacti should use on the Y-axis. Use 3 to display everything in 'k' or -6
to display everything in 'u' (micro).
|
Vertical Label
The label vertically printed to the left of the graph.
|
|
|
DrawFormItemHiddenIDField("id",$id);
DrawFormFooter();
include_once ("include/bottom_footer.php");
break;
case 'tree_edit':
include_once ("include/top_header.php");
$title_text = "Graph Management - Graph Tree Configuration [edit]"; $add_text = "$current_script_name?action=edit_tree";
include_once ("include/top_table_header.php");
if (isset($id)) {
$graph_tree = db_fetch_row("select * from rrd_graph_tree where id=$_GET[id]", $cnn_id);
}else{
unset($graph_tree);
}
draw_main_form_select();
?>

|
Tree Name
Enter a name for this tree.
|
Show as Tab
Whether to show this tree as a tab on the graph management page.
|
|
|
include_once ("include/bottom_footer.php");
include_once ("include/bottom_table_footer.php");
break;
case 'tree':
include_once ("include/top_header.php");
$title_text = "Graph Management - Graph Tree Configuration"; $add_text = "$current_script_name?action=tree_edit";
include_once ("include/top_table_header.php");
draw_main_form_select();
?>

|
DrawMatrixRowBegin();
DrawMatrixHeaderItem("Tree Name",$colors[panel],$colors[panel_text]);
DrawMatrixHeaderItem("Display as Tab",$colors[panel],$colors[panel_text]);
DrawMatrixRowEnd();
$graph_tree_list = db_fetch_assoc("select * from rrd_graph_tree", $cnn_id);
foreach ($graph_tree_list as $graph_tree) {
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
?>
|
|
|
$i++;
}
include_once ("include/bottom_footer.php");
include_once ("include/bottom_table_footer.php");
break;
default:
include_once ("include/top_header.php");
$title_text = "Graph Management"; $add_text = "$current_script_name?action=graph_edit";
include_once ("include/top_table_header.php");
draw_main_form_select();
?>
Core Routers 
|
Catalyst Fabric 
|
Server Farm (1) 
|
Web Server 
|
|
DrawMatrixRowBegin();
DrawMatrixHeaderItem("Graph Title",$colors[panel],$colors[panel_text]);
DrawMatrixHeaderItem("Size",$colors[panel],$$colors[panel_text]);
DrawMatrixRowEnd();
$graph_list = db_fetch_assoc("select ID,Height,Width,Title from rrd_graph order by Title", $cnn_id);
foreach ($graph_list as $graph) {
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
?>
|
x
|
|
$i++;
}
include_once ("include/bottom_footer.php");
include_once ("include/bottom_table_footer.php");
break;
} ?>