Daniels Pitkevičs asked:
I have created php script for cacti which outputs data in format like:
Output of my script:
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 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.
<?php /*$content = file_get_contents("http://".$ARGV); $air_temperature = null; $air_humidity = null; $xml = simplexml_load_string($content); $air_temperature = $xml->Item->Value; $air_humidity = $xml->Item->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.
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.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.