Xymon Mailing List Archive search

NCV RRD graphing for JSON values

list Michael Beatty
Tue, 22 Jan 2013 08:18:58 -0500
Message-Id: <user-c8da2a2fbf5b@xymon.invalid>

SebA,

You could get around around this problem by writing a simple script that calls the test and parses the result and splits it into lines to be sent to Xymon.  For example, a basic Perl example:

# Begin Script
my $result = `test_that_returns_data`;

($u, $rc, $asc, $usc) = split(',' $result);

$msg  = "U  : $u\n";
$msg .= "RC : $rc\n";
$msg .= "ASC: $asc\n";
$msg .= "USC: $usc";

`xymon 127.0.0.1 \"status host.mytest green $msg\n\"`;
#End Script

In other words use the script to call the test (instead of Xymon) split the results on the comma and then build a new string with newline characters inserted.  Your result reported to Xymon would be:

U  : 1391595
RC : 3517
ASC: 1628
USC: 2154

... and easily read by Xymon's NCV.

Alternatly, you can also look at the section in the Xymon_RRD man page that discusses "Custom RRD Data Via Scripts".  This would spell out how to do what you like.  With that said, I have never tried it this route as it seems (from the man page) that it is more taxing than the method I showed above.

Michael Beatty
Sherwin-Williams
IT Analyst/Developer
user-4aea7c115850@xymon.invalid
XXX-XXX-XXXX

On 01/22/2013 05:55 AM, SebA wrote:
I was hoping that Xymon's NCV parsing would understand JSON as the tutorial @ http://www.xymon.com/xymon/help/howtograph.html does not specify that the NCVs need to be on seperate lines (although I subsequently found that "man xymond_rrd" does). It's a shame because a lot of data is presented as JSON these days.  For example, I have this test, which returns this:
http://URLremoved/  - TestingURL  <http://192.168.4.135:8080/tracker/co.do>;  yields:
{ u:1391595, rc:3517, asc:1628, usc:2154}
I am using SPLITNCV and it just creates a testname,_u.rrd file.
I doubt it would involve a huge diff to get /xymond/rrd/do_ncv.c to understand this format.  I also doubt that it is currently within my level of C programming proficiency though unfortunately.

Kind regards,

SebA