Need Help with Script...

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
..:Dude:..
Posts: 4
Joined: Sat Sep 10, 2005 4:47 am

Need Help with Script...

Post by ..:Dude:.. »

Hi,

i have created a new "Data Input Method" as command/script:

echo -e "auth xxxxxx\nbw_stats\nq"|netcat localhost 4000|grep Down|cut -f 1 -d \||cut -f 2 -d ' '

This connects to the mldonkey and shows me the current download

Alternative i tried:

perl <path_cacti>/scripts/down.pl

Conntent of down.pl:

Code: Select all

#!/usr/bin/perl 

$down = `sh /eseldown/mlstats/ml_down.sh`; 

print $down;  
Conntent of ml_down.sh:

Code: Select all

#!/bin/sh

#If you have a password stated in mldonkey then type it instead of "MyPassword":
AUTH="auth xxxxxx"

DOWN=$(echo -e "$AUTH\nbw_stats\nq"|netcat localhost 4000|grep Down|cut -f 1 -d \|)

kDOWN=$(echo $DOWN|cut -f 2 -d ' ')
echo "$kDOWN"
1. question. Can i run a shell script direct in "Data Input Methods" ?

2. I created a graph with this 2 Methods above, but the graph shows nothing...?
Attachments
cacti_data_template_eseldown.xml
(2.89 KiB) Downloaded 314 times
cacti_graph_template_eseldown.xml
(5.07 KiB) Downloaded 313 times
cacti_data_template_testdown.xml
2nd try...
(2.9 KiB) Downloaded 264 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Dude,
I'm not quite sure that I understand everything you said. First, why do you use both scripts, the perl one and the shell? The shell script should work on its own (perhaps use echo -n to suppress newline).
For debugging, you may su to your cacti user (e.g. cacti or cactiuser or so; see your crontab) and run this script from the shell. Please post output. As for the xml attachments: Personally, I'd prefer some screenshots of the objects; for me its faster to debug. Another hint: Settings -> General -> logging level=Debug puts lots of debugging output into <path_cacti>/log/cacti.log. You will find the call of your shell script with the output produced and so on.
Reinhard
..:Dude:..
Posts: 4
Joined: Sat Sep 10, 2005 4:47 am

Post by ..:Dude:.. »

Log says:

09/11/2005 12:05:09 AM - CMDPHP: Poller[0] Host[1] DS[47] CMD: sh /eseldown/mlstats/ml_down.sh, output: 56.4

09/11/2005 12:05:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/php/cacti/rra/localhost_eseldown_46.rrd --template 1126389905:56.4
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Dude,
well, that looks fine. Please have a look at the timestamp of the rrd. Does it get updated? Or check using "rrdtool info <rrd>". What about your graph? Still broken?
Reinhard
..:Dude:..
Posts: 4
Joined: Sat Sep 10, 2005 4:47 am

Post by ..:Dude:.. »

Ok.....now its working. I tooked the wrong graph mode.

Here:

http://thomasott.homeip.net/php/cacti/g ... &leaf_id=7
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests