1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?/*
+-------------------------------------------------------------------------+
| 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/ |
+-------------------------------------------------------------------------+
*/?>
<?
include ("include/database.php");
include_once ("include/rrd_functions.php");
include_once ("include/functions.php");
include ('include/config.php');
include ("export_header.php");
$sql_id = mysql_query("select
g.id,g.title,g.imageformatid,
t.name
from rrd_graph g
left join def_image_type t
on g.imageformatid=t.id
and g.export=\"on\"
order by g.title",$cnn_id);
while ($graph_query_res = mysql_fetch_array($sql_id)) {
$filename = "graph_" . $graph_query_res[id] . ".html";
$fp = fopen($config["path_html_export"]["value"] . "/$filename", "w");
$exp_header = shell_exec($config["path_php_binary"]["value"] . " -q $path_cacti/export_header.php");
$graph_html = "";
$sql_id_rra = mysql_query("select id,name from rrd_rra order by steps",$cnn_id);
while ($rows_rra = mysql_fetch_array($sql_id_rra)) {
$image_filename = "normal_" . $graph_query_res[id] . "_" . $rows_rra[id] . "." . $graph_query_res[name];
$graph_html .= "<div align=center><img src=\"$image_filename\" border=0></div>\n";
$graph_html .= "<div align=center><strong>$row_rra[name]</strong></div><br>";
$graph_data_array["export"] = true;
$graph_data_array["export_filename"] = $image_filename;
rrdtool_function_graph($graph_query_res[id],$rows_rra[id],$graph_data_array);
}
$main_html = $exp_header . $graph_html;
fwrite($fp, $main_html);
fclose($fp);
}
include_once ("include/bottom_footer.php");
?>
|