aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/collectd.inc.php
diff options
context:
space:
mode:
authorPim van den Berg2011-06-15 22:11:29 +0200
committerPim van den Berg2011-06-15 22:11:29 +0200
commit320a9c59517bf299abb4f33442c9900e59242902 (patch)
tree93c97edab42357f5c7d040317dd2c175975e729a /inc/collectd.inc.php
parentresolve php notices (diff)
downloadapt-panopticon_cgp-320a9c59517bf299abb4f33442c9900e59242902.zip
apt-panopticon_cgp-320a9c59517bf299abb4f33442c9900e59242902.tar.gz
apt-panopticon_cgp-320a9c59517bf299abb4f33442c9900e59242902.tar.bz2
apt-panopticon_cgp-320a9c59517bf299abb4f33442c9900e59242902.tar.xz
log unixsock errors instead of printing them
These errors got concatenated in front of the image, which resulted in an invalid image.
Diffstat (limited to 'inc/collectd.inc.php')
-rw-r--r--inc/collectd.inc.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 18f56c8..e5a7df4 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -204,15 +204,15 @@ function collectd_flush($identifier) {
204 204
205 $r = fwrite($socket, $cmd, strlen($cmd)); 205 $r = fwrite($socket, $cmd, strlen($cmd));
206 if ($r === false || $r != strlen($cmd)) { 206 if ($r === false || $r != strlen($cmd)) {
207 printf('ERROR: Failed to write full command to unix-socket: %d out of %d written', 207 error_log(sprintf('ERROR: Failed to write full command to unix-socket: %d out of %d written',
208 $r === false ? -1 : $r, strlen($cmd)); 208 $r === false ? -1 : $r, strlen($cmd)));
209 return FALSE; 209 return FALSE;
210 } 210 }
211 211
212 $resp = fgets($socket); 212 $resp = fgets($socket);
213 if ($resp === false) { 213 if ($resp === false) {
214 printf('ERROR: Failed to read response from collectd for command: %s', 214 error_log(sprintf('ERROR: Failed to read response from collectd for command: %s',
215 trim($cmd)); 215 trim($cmd)));
216 return FALSE; 216 return FALSE;
217 } 217 }
218 218
@@ -224,8 +224,8 @@ function collectd_flush($identifier) {
224 224
225 return TRUE; 225 return TRUE;
226 } else { 226 } else {
227 printf('ERROR: Failed to open unix-socket to collectd: %d: %s', 227 error_log(sprintf('ERROR: Failed to open unix-socket to collectd: %d: %s',
228 $u_errno, $u_errmsg); 228 $u_errno, $u_errmsg));
229 return FALSE; 229 return FALSE;
230 } 230 }
231} 231}