Multiple Output Fields

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
nitesh152
Posts: 1
Joined: Thu Apr 06, 2017 9:24 am

Multiple Output Fields

Post by nitesh152 »

Hello All,

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"]);
?>
When script is executed output is:

Code: Select all

# ./graphEndpoints2.php 4018
numOrig:15 numPeak:37
Also I have followed the Cacti doc on creating the "Data Input Methods" with identical "Output Fields" and create "Data Sources" with multiple "Data Source Item". Than create Graph under "Graph Management" and define the "Graph Items" manual. Turn on the debug info and all is good but no data.

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)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests