Module: nagvis Branch: master Commit: 8ff58c28598c1cb88bd8126194738167ae9e8309 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=8ff58c28598c1cb88bd8126194738167ae9e8309
Author: Lars Michelsen <[email protected]> Date: Sat Oct 31 19:55:58 2009 +0100 The mklivestatus backend now uses json response from livestatus neb module --- .../core/classes/GlobalBackendmklivestatus.php | 21 ++----------------- 1 files changed, 3 insertions(+), 18 deletions(-) diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php b/share/server/core/classes/GlobalBackendmklivestatus.php index 41d435a..74ad74d 100644 --- a/share/server/core/classes/GlobalBackendmklivestatus.php +++ b/share/server/core/classes/GlobalBackendmklivestatus.php @@ -119,33 +119,18 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface { return Array(); } - // 1, 2, 44 - // Dataset: - // Field: - // List: - // Host/Service: - socket_write($sock, $query . "Separators: 0 1 2 3\n"); + // Query to get a json formated array back + socket_write($sock, $query . "OutputFormat:json\n"); socket_shutdown($sock, 1); $read = ''; - while('' != ($r = socket_read($sock, 65536))) { $read .= $r; } socket_close($sock); - /* split into lines and fields */ - $lines = explode("\000", $read); - /* 'field' after trailing linefeed */ - @array_pop($lines); - - $result = Array(); - foreach($lines as $line) { - $result[] = explode("\001", $line); - } - - return $result; + return json_decode($read); } /** ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
