function execute_graph_command($graph_engine, $command) { global $debug; // Make sure the image is not cached header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 if ($debug > 2) { header("Content-type: text/html"); print "<html><body>"; switch ($graph_engine) { case "flot": case "rrdtool": print htmlentities($command); break; case "graphite": print $command; break; } print "</body></html>"; } else { header("Content-type: image/png"); switch ($graph_engine) { case "flot": case "rrdtool": if (strlen($command) < 100000) { my_passthru($command); } else { $tf = tempnam("/tmp", "ganglia-graph"); file_put_contents($tf, $command); my_passthru("/bin/bash {$tf}"); unlink($tf); } break; case "graphite": echo file_get_contents($command); break; } } }
$command .= $total_cmd . $mean_cmd; $command .= " COMMENT:'\\j'"; $command .= " GPRINT:'total':AVERAGE:'Avg Total\\: %5.2lf'"; $command .= " GPRINT:'total':LAST:'Current Total\\: %5.2lf\\c'"; $command .= " GPRINT:'mean':AVERAGE:'Avg Average\\: %5.2lf'"; $command .= " GPRINT:'mean':LAST:'Current Average\\: %5.2lf\\c'"; header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); if (isset($_GET['debug'])) { header("Content-type: text/plain"); echo $command; } else { header("Content-type: image/png"); my_passthru($command); } function HSV_TO_RGB($H, $S, $V) { if ($S == 0) { $R = $G = $B = $V * 255; } else { $var_H = $H * 6; $var_i = floor($var_H); $var_1 = $V * (1 - $S); $var_2 = $V * (1 - $S * ($var_H - $var_i)); $var_3 = $V * (1 - $S * (1 - ($var_H - $var_i))); if ($var_i == 0) { $var_R = $V; $var_G = $var_3; $var_B = $var_1;