5

I have created php script for cacti which outputs data in format like: <variable>:<value>
Output of my script: temperature:20 humidity:15 Then I created data input method where input string is: php <path_cacti>/scripts/getTempHumData.php <host> Script is placed in cacti folder / scripts.
Input field is hostname - in script I use it as $ARGV[0] variable.
Output fields are two - temperature and humidity.
Then I assigned that script to device, added everything it needed, turned off SNMP usage for device. Device status is 'up'.
Then I created graph template and graph and assigned it to graph tree. But graph cannot be seen - it just shows that image cannot be found (that small red x in browser).
I edited my script to pass contant values in the same format, I looked in cacti/log/cacti.log but there is no entries with my host IP.
Also, there are no rrd file which graph needs - in debug mode it tries to create, but there is no rrd file created. Also in data source path rrd file which is pointed does not exists.
How can I solve this error?
Thank You in advance.

Script code:

<?php
/*$content = file_get_contents("http://".$ARGV[0]);
$air_temperature = null;
$air_humidity = null;

$xml = simplexml_load_string($content);
$air_temperature = $xml->Item[1]->Value;
$air_humidity = $xml->Item[2]->Value;

echo "temperature:".$air_temperature." humidity:".$air_humidity;*/
echo "temperature:20 humidity:15";
?>

RRD file is not created automattically, of course after running command which is given when I turn on debug, I got my rrd file. But NaN values are shown for each needed value.

1 Answers1

1

There are a wide variety of problems that can cause NaN in Cacti graphs.

The best thing to do is to work through the debugging checklist in the Cacti documentation.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940