[collectd] Graphing interface written in PHP

Bruno Prémont bonbons at linux-vserver.org
Mon Feb 16 11:00:57 CET 2009


A few more bug-fixes to the graphing scripts.

This removes some obsolete code which prevents flush from working
and adds missing wrapper error500().

Bruno
---
--- functions.php	2009-02-16 08:07:27.472935879 +0100
+++ functions.php-new	2009-02-16 10:57:06.135141135 +0100
@@ -260,17 +260,6 @@ function collectd_flush($identifier) {
 	if (is_null($identifier) || (is_array($identifier) && count($identifier) == 0) || !(is_string($identifier) || is_array($identifier)))
 		return false;
 
-	if (is_null($host) || !is_string($host) || strlen($host) == 0)
-		return false;
-	if (is_null($plugin) || !is_string($plugin) || strlen($plugin) == 0)
-		return false;
-	if (is_null($pinst) || !is_string($pinst))
-		return false;
-	if (is_null($type) || !is_string($type) || strlen($type) == 0)
-		return false;
-	if (is_null($tinst) || (is_array($tinst) && count($tinst) == 0) || !(is_string($tinst) || is_array($tinst)))
-		return false;
-
 	$u_errno  = 0;
 	$u_errmsg = '';
 	if ($socket = @fsockopen($config['collectd_sock'], 0, $u_errno, $u_errmsg)) {
--- graph.php	2009-02-16 08:07:23.442935407 +0100
+++ graph.php-new	2009-02-16 10:57:11.224361577 +0100
@@ -112,6 +112,13 @@ function error400($title, $msg) {
 	return error(400, "Bad request", $title, $msg);
 }
 
+/**
+ * Incomplete / invalid request
+ */
+function error500($title, $msg) {
+	return error(500, "Internal error", $title, $msg);
+}
+
 // Process input arguments
 $host     = read_var('host', $_GET, null);
 if (is_null($host))



More information about the collectd mailing list