
November 17th, 2012, 07:47 AM
|
 |
Known to taste like chicken
|
|
Join Date: Aug 2003
Location: In front of my computer
|
|
|
Cacti custom perl script
Hey guys,
I've done a lot of coding over the years, however I am currently working on my 2nd ever perl script.
What I am doing is building a custom Cacti graph which gets it's data from my perl script. When I run my script at the command line it works fine, however when it is called from cacti it graphs the result as 0.
I have narrowed the issue down to an SSH call in the script that looks like the below:
Code:
my $result = `/usr/bin/ssh -i /path/to/dsa_key root\@x.x.x.x "/path/to/remote/script | /bin/grep my_data"`;
#my $result = "data I should get back from the above line";
if I use the commented line everything works fine in Cacti and I get my nice shiny graph. If I use the SSH command line it works fine from the command line, but does not work when Cacti calls the script. I am completely at a loss as to what is wrong, and I'm not overly sure if it's my lack of knowledge in perl, or lack of knowledge in Cacti that's causing me problems.
I thought it may have been a permissions issue on the script, but I have tried 0644, 0755 and 0777 and all of them give me a 0 result in the graph.
Any help is much appreciated.
__________________
"Take thy beak from out my heart, and take thy form from off my door" - Homer J Simpson / Edgar Allan Poe
Looking for a project Idea?
|