This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

exec limitation?

Old posts that have not been replied to for several years.
Locked
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

exec limitation?

Post by CrazyCat »

hi there,

I'm trying to do a tcl using rrdtool, but it seems that the exec command have some limitations....
It don't takes all the arguments I pass:
TCL = [exec "$rrdtool create $rrdir/$rrdserv.rrd DS:userslocal:GAUGE:600:U:U DS:ircops:GAUGE:600:U:U DS:usersglobal:GAUGE:600:U:U DS:channels:GAUGE:600:U:U DS:invisibles:GAUGE:600:U:U DS:normals:GAUGE:600:U:U DS:totalservers:GAUGE:600:U:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797"]

Eggdrop response: Tcl error: couldn't execute "/usr/local/rrdtool-1.0.45/bin/rrdtool create /home/eggdrop/ircmrtg/irc.passion-tchat.com.rrd DS:userslocal:GAUGE:600:U:U DS:ircops:GAUGE:600:U:U DS:us": no such file or directory

Is there a way to use more than 150 chars in an exec command?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: exec limitation?

Post by egghead »

CrazyCat wrote:hi there,

I'm trying to do a tcl using rrdtool, but it seems that the exec command have some limitations....
It don't takes all the arguments I pass:
TCL = [exec "$rrdtool create $rrdir/$rrdserv.rrd DS:userslocal:GAUGE:600:U:U DS:ircops:GAUGE:600:U:U DS:usersglobal:GAUGE:600:U:U DS:channels:GAUGE:600:U:U DS:invisibles:GAUGE:600:U:U DS:normals:GAUGE:600:U:U DS:totalservers:GAUGE:600:U:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797"]

Eggdrop response: Tcl error: couldn't execute "/usr/local/rrdtool-1.0.45/bin/rrdtool create /home/eggdrop/ircmrtg/irc.passion-tchat.com.rrd DS:userslocal:GAUGE:600:U:U DS:ircops:GAUGE:600:U:U DS:us": no such file or directory

Is there a way to use more than 150 chars in an exec command?
Have you tried going into the shell and executing the command by hand?
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

yes, using the shell is ok.
I really think that the limitation is in the exec command, because changing the $rrdserv variable (adding or removing chars) doesn't change the length of the error message.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

First, lets correct the command.

It should be on one line, with no wrapping. If you need to wrap onto a second line, then the last caracter on the line should be \

The only problem with this, is you have opened quotes. Don't.

The Tcl exec command doesn't use quotes. The command and each argument should be seperate.

Second thing. Don't use the exec command for rrdtool.

When compiling rrdtool, make sure you specify the --with-tcl ./configure option. When installinging with "make site-install-tcl", you should have a working Tcl package.

Within your Tcl script, you can then include the line

Code: Select all

package require Rrd
(the capital is important).

You then have access to a Rrd Tcl namespace. Each command within the namespace is a rrd command like, create, graph and update.

One example is

Code: Select all

Rrd::update mystats.rrd --template numLines:numActions N:$lines:$ations
This is far faster than exec, and much more smooth.

There is allready a rrdtool stats script about, though I am not sure how public it is. I currently use it, though I don't have the original version.
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

hey! do you really want to making me learn rrdtool syntax? lool :)
Ok, so I will.
I hope tutorials are simple :)

Thanx a lot for these infos.
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

tutorials???

Post by CrazyCat »

ppslim, I think your idea is the better (using rrd package), but I've a little trouble:
where can I find rrd syntax for tcl?
thx if someone has a good link for me :)
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

or you can do it this way :
let the TCL create a batch script where you put the command in and then execute the script with eggdrop
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

no :)
rrdtool is really well, and enough simple to use (because I use some allready existing procedures).
If I want to make a really efficient tcl, I've to use the better engine :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The rrdtool Tcl package command format is exactly the same as the command line version.

Where on the command line you type "rrdtool <command> <parameters>", in Tcl you use "Rrd::<command> <parameters"

Ie, if the command line version starts with "rrdtool update", in Tcl, you use "Rrd::update"

If it starts "rrdtool graph", then you use "Rrd::graph"

The parameters part doesn't change, only the command used.
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

thanx ppslim :)
I was thinking it's something like this, but I wanted a confirmation... you just gave it to me.
Locked