Am new to cacti so please forgive me if my question sounds stupid, I have tried my best to find the solution for the problem but still needs help. I want to gather number of lines in the haproxy.log file from a remote front end(FE) machine, I have added this device successfully in cacti and graphs like load average are being drawn. I followed this: http://www.cacti.net/downloads/docs/html/how_to.html to add a graph to this device using shell script, I added a Data input method selecting Script/Command as the input type and /home/ubuntu/script.sh as the input string, added a output field too. Next I added a data source with out a template and selecting FE as the host, then as mentioned in the link I added the graph and things look fine till now, problem is that nothing is being plotted in the graph, cacti log files(Debug mode) shows the following:
CMDPHP: Poller[0] Host[5] DS[29] CMD: /home/ubuntu/script.sh, output: U 12/30/2011 12:35:07 AM - CMDPHP: Poller[0] Host[5] DS[29] WARNING: Result from CMD not valid. Partial Result: U
Now I know that script should print out the output only as this is one output field, my script contains the following
temp=$(sudo ssh -i /home/ubuntu/key.pem [email protected] '/var/log/haproxy.log | wc -l') echo $temp
the script is owned by ubuntu as there is no cacti user on cacti server, someone else installed cacti server and I have now been asked to take care of it.
If I execute the script from cacti server command line it works fine and am executing it as user ubuntu only.
Please help me I dont know where am I going wrong.
Thanks