I'm running into some issues when I define my own custom script to output multiple results. I have followed the Cacti rule on outputting the results with:
<fieldname_1>:<value_1> <fieldname_2>:<value_2> ... <fieldname_n>:<value_n>
Source: http://www.cacti.net/downloads/docs/htm ... cacti.html
Here is my simple PHP script:
Code: Select all
#!/usr/bin/php
<?php
require_once('Class.Database.php');
$objDB = Database::getInstance();
$mysqli = $objDB->getConnection();
$trunkId = $argv[1];
$query = sprintf("SELECT `numOrig` , `numPeak` FROM `tbl_endpoints` WHERE `trunkId` = '%s'", $trunkId);
$res = $mysqli->query($query);
$data = $res->fetch_array(MYSQLI_ASSOC);
echo sprintf("numOrig:%s numPeak:%s\n",$data["numOrig"],$data["numPeak"]);
?>
Code: Select all
# ./graphEndpoints2.php 4018
numOrig:15 numPeak:37
Same script works fine if I just output single data with numOrig or numPeak. Graphs are generated...
I saw many others faced same problem and some got fixed by deleting *.rra and generating... Others by adding one DS at a time... I have tried everything but just can not figure it out... One of my graph started working overnight and than it stopped...
Any suggestions?
Thanking in advance.
Version:
Cacti Version 0.8.8b
Ubuntu: 14.04.5 LTS
mySQL: mysql Ver 14.14 Distrib 5.5.54
PHP: PHP 5.5.9-1ubuntu4.21 (cli)