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.

measure the lag bot

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

measure the lag bot

Post by juanamores »

I need a command to measure the lag of the bot every 10 minutes automatically.

Code: Select all

set adminchan "#adminchan"
bind time - "?0 * * * *" lagbot

proc lagbot { } {
global adminchan
putmsg $adminchan "Bot  lag is...... seconds"
}
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: measure the lag bot

Post by willyw »

juanamores wrote:I need a command to measure the lag of the bot every 10 minutes automatically.
...
Please define "the lag of the bot" for us.


In the meantime, and assuming that you are working on this yourself - if you need a way to have the bot ping somebody, then something like this will send out the ping request:

Code: Select all

putserv "privmsg NickToPing_here :\001PING [clock milliseconds]\001"
Then you could watch for the return.
Look up the
ctcr
bind, in tcl-commands.doc .

You could do some math with expr, and if you kept the time that the ping was sent out - subtract the time that it came back.
Would that be what you are looking for?

I hope some of this helps you to piece together something.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Re: measure the lag bot

Post by juanamores »

willyw wrote:Please define "the lag of the bot" for us.
Defined as the time after which the bot will respond to a command from any user (not a specific user).
I mean, what I need is that the measure Bot its own lag, with respect to any potential user who will use it.

Example:

My bot inform me #adminchan channel your lag is 30 seconds.
12:00:00 @Mybot ¦ My lag is 30 seconds
This would mean that my bot will take 30 seconds to answer a command of any user who uses it.

12:00:00 userx ¦ !hello
12:00:30 @Mybot ¦ hello userx
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: measure the lag bot

Post by willyw »

juanamores wrote: ...
Defined as the time after which the bot will respond to a command from any user (not a specific user).
I mean, what I need is that the measure Bot its own lag, with respect to any potential user who will use it.
...
I'm thinking that having the bot ping the user, then report the ping response time is what you are wanting. Please tell me, if this is incorrect.

Some time ago, I wrote myself a script to do just that because the bot is a trivia game bot, and sometimes users just get the feeling that they have a "laggy" connection and others are getting ahead of them. :)
So, I created a way for them to have the bot ping them, and report.

I used the ideas that I gave you above.
Have you had any time to write some of it for yourself yet, using those ideas? Post what you have, here. All of it. Then we can try to help you with it.

If this is totally new to you, you need to say so now. Your first post included some code, so it appears that you do know some basic tcl already, therefore that is how you will be treated. That will frustrate you, if you know no tcl at all. So, let us know. :)
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Re: measure the lag bot

Post by juanamores »

willyw wrote: I'm thinking that having the bot ping the user, then report the ping response time is what you are wanting. Please tell me, if this is incorrect.
.....
If this is totally new to you, you need to say so now. Your first post included some code, so it appears that you do know some basic tcl already, therefore that is how you will be treated. That will frustrate you, if you know no tcl at all. So, let us know. :)
I'm just starting to learn TCL, I know very little this it.
One idea might be, a code that ping 5 random users any of the channels where the bot is.

Then make an average in seconds responses of the 5 ping and save the result in a variable.
It is possible?
Sorry for my bad English and very grateful for your kindness in answering.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: measure the lag bot

Post by willyw »

juanamores wrote: ...
I'm just starting to learn TCL, I know very little this it.
Excellent! :) I hope you continue to learn TCL, and have fun with it.
One idea might be, a code that ping 5 random users any of the channels where the bot is.
You might want to reconsider this. Is it possible that the users would soon get tired of being pinged?

Or at least wonder why they are being pinged?

Perhaps it should ping just one user, and let that user be ... you.

Then make an average in seconds responses of the 5 ping and save the result in a variable.
It is possible?
Yes - if you want to learn the basics.

However - again - you might want to reconsider your plan. Of what use will this information really be?
Just because it is possible does not mean that it will be meaningful.

Ping response times can vary for a lot of different reasons. And those reasons can change, and do.

I don't know what you need this info for. But is it possible that it would be more meaningful if it was current? That's what I found, and do. The user can have the bot ping himself, when he wants to.

It is up to you. :)
Sorry for my bad English ...
Your English is fine. Don't worry. :)

Since this is new to you, here are a few links that will help you:

http://suninet.the-demon.de/
A great place to get started learning.

http://www.eggheads.org/support/egghtml ... mands.html
The Eggdrop related TCL commands.

http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
The rest of TCL commands.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: measure the lag bot

Post by willyw »

Have you experimented with this line that I posted earlier, yet?

Code: Select all

putserv "privmsg NickToPing_here :\001PING [clock milliseconds]\001" 
That will make the bot send a ping request to whatever nick you substitute in for NickToPing_here .

To make the bot watch for the return, go to:
http://www.eggheads.org/support/egghtml ... mands.html
and text search for:
bind ctcr
and read about that bind.
bind ctcr <flags> <keyword> <proc>
proc-name <nick> <user@host> <handle> <dest> <keyword> <text>

Description: just like ctcp, but this is triggered for a ctcp-reply (ctcp embedded in a notice instead of a privmsg)
Write a proc to correspond to a
bind ctcr
and you can capture the text returned.
Examine that text, and see if you can do anything with it. :)

Post your code here.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

It would help to have a clearer understanding of exactly what irc lag is.
Please read this page, as I believe it puts the whole thing into perspective, http://www.ircbeginner.com/ircinfo/h-lag.html
The key fact to gather from that explanation is...
No one is ever really lagged themselves; they are only lagged to each other.
...and that 'lag' is specific to Only Those 2 Users, and no one else.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Thanks to willyw for their ideas and Spike ^^ for clearing the concept of 'lag'.

I am modifying a shoucast.tcl and it took him well into him I'm just adding some details that are not essential.

This idea of ​​measuring the lag own bot, I saw another bot, which realizing you a status, returned by a canal a figure of lag.

Sometimes the bot does not answer to anyone, not just to a particular user, delay in responding to all, so I thought it might be a lag own bot with respect to all users.

But with explanations of Spike ^^ I see is just an optical illusion :)

Thank you so much to you both for your help.
Post Reply