How to write ONLY ping STATISTICS to a file every hour? - ping

I'm always pinging my ISP gateway whenever I'm on my PC. My ISP likes to throttle my connection, so I have to keep a close eye on it. Is there anyway to write the ping statistics, and just the statistics to a file every hour on the hour?
EDIT: I run ping -D 10.0.0.1 in a terminal, and I would like to be able to save only the summary or statistics that is printed whenever you press CTRL+\ (SIGQUIT) to a file every hour. So the file would look like so:
[1446131810] 100/100 packets, 0% loss, min/avg/ewma/max = 1.818/3.493/3.918/4.254 ms
[1446191810] 200/200 packets, 0% loss, min/avg/ewma/max = 1.818/3.493/3.918/4.254 ms
[1446251810] 300/300 packets, 0% loss, min/avg/ewma/max = 1.818/3.493/3.918/4.254 ms

Maybe you could make a script with endless loop that will make one ping each iteration and write to a log file if there is a failure.
Take a look at this forum thread: http://www.computerhope.com/forum/index.php?topic=120285.0

Related

mysql max_user_connections bot traffic

Every month or two a swarm of robot visits my site and opens up connections so fast that my current max_user_connection value of 25 (will increase it to 75) is reached. Currently I restart the server and it works fine again until the next swarm comes. It is a webshop programmed in perl which tries to get the data using DBI connect.
So I have some questions :
Will the problem solve itself after some time or will the open process run until reset and try to get infos from the locked DB ?
Is it possible to do a small query to check for max user connections on the DB to exit if it is to high ?
Any other idea to get protection from DOS attacks or bot swarms (thought about rectriciting Asian IPs in htaccess) ?
You can detect ( for example robots ) with a module. For example HTTP::BrowserDetect.
use HTTP::BrowserDetect;
my $browser = HTTP::BrowserDetect->new($user_agent_string);
if ( $browser->robot() ) {
# dont open an mysql connection,
# return a cached version of the requested page
# or something like that
...
}

What's best options for video streaming or max data transfer using SuperWebSocket

Minimum To Achieve:- Send nearly or more than 1 mb/second to other websocket clients.
Questions:--
Is it possible video streaming with SuperWebSocket?
What options/features of SuperWebSocket can be used like Asynch
mode/JsonCommands/CustomSession/etc to achieve fastest data
transfer?
How to sequence a big data sent in chunks but if received without any order at client or server side? Is there anything built in to sequence these chunks or I have to manually send sequence nos in message itself?
What I have tried:--
Multiple secure sessions with same port and different paths in javascript code
ws = new WebSocket(wss://localhost:8089/1/1)
ws = new WebSocket(wss://localhost:8089/2/2)
ws = new WebSocket(wss://localhost:8089/3/3)
with above sessions I send large data in chunks but it's not receiving in expected order at server/client side and also after successfully sending large chunk (size=55000kb) that session closes automatically!
I am looking into sample projects of SuperWebSocket but not sure where to go! I am open to try any option inside SuperWebsocket. Thanks
1) I am not sure it does, but if it provides an API to send Byte[], it may be enough.
2) No idea about this one, the documentation may explain it.
3) What do you mean without order? WebSockets is TCP based, so data segments sent in the same connection will arrive in the same order they were sent.
4) Why would you open different connections to the same site? There is also probably limitations about the connections that you can open to the same host. One should be OK, open several is not going to increment your bandwidth, only will increment your problems.
I develop a WebSocket server component that handles messages as Stream derived objects and has an acceptable performance so far, you may like to give it a try.

mysql-proxy 0.8.3 load balance can not work

I have three Mysql Nodes listed below:
Master Address: 192.168.1.77:3306
Slave1 Address: 192.168.1.76:3306
Slave2 Address: 192.168.1.69:3306
and after i installed mysql-proxy of version 0.8.3 on 192.168.1.67, and create my configuration below:
[mysql-proxy]
admin-username=proxy
admin-password=proxy
admin-lua-script=/local/software/mysql-proxy/lib/mysql-proxy/lua/admin.lua
proxy-read-only-backend-addresses = 192.168.1.76:3306,192.168.1.69:3306
proxy-backend-addresses=192.168.1.77:3306
proxy-lua-script=/local/software/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua
log-file=/local/software/mysql-proxy/log/mysql-proxy.log
plugin-dir=/local/software/mysql-proxy/lib/mysql-proxy/plugins
plugins=proxy,admin,debug,replicant
log-level=debug
keepalive=true
edited file: rw-splitting.lua
min_idle_connections = 1,
max_idle_connections = 2,
then start mysql-proxy like the way:
./bin/mysql-proxy --defaults-file=mysql-proxy.cnf
logon the proxy:
mysql -uproxy -ppassword -P4040 -h192.168.1.67
and when i execute select sql again and again to open different mysql-proxy 4040 window, but from log i found that all the select sql queries are sent to the same server for 76, however only if i shutdown the 76, then it will send the queries to slave 69. i don't know why load balance not to work, is there some place what i made a mistake? thank you in advance.
rw-splitting.lua seems to leave some of the implementation as an exercise for the reader. There is a comment 'pick a random backend' but I see no implementation of it, or a round robin technique. The code seems to fill the backend servers from the top moving on to the next in the array when there are not idle connections.
If there are always idle connections at the master then the current implementation prefers to go there. After that it uses the first idle connection in the read only backend servers list. In this case 76 until you shut it down when it moved on to 69. I can't see why 77, the read/write backend is not being preferred. Possibly this is related to the number of idle connections available.
It would seem that seeking the lowest proxy.global.backends.connected_clients, the number of connections currently active on the backend, would be a good way to prioritize the backend used.
You should also take a look at the balance module lib/mysql-proxy/lua/proxy/balance.lua

Avoid printing job exit codes in SGE with option -sync yes

I have a Perl script which submits a bunch of array jobs to SGE. I want all the jobs to be run in parallel to save me time, and the script to wait for them all to finish, then go on to the next processing step, which integrates information from all SGE output files and produces the final output.
In order to send all the jobs into the background and then wait, I use Parallel::ForkManager and a loop:
$fork_manager = new Parallel::ForkManager(#as);
# #as: Max nb of processes to run simultaneously
for $a (#as) {
$fork_manager->start and next; # Starts the child process
system "qsub <qsub_options> ./script.plx";
$fork_manager->finish; # Terminates the child process
}
$fork_manager->wait_all_children;
<next processing step, local>
In order for the "waiting" part to work, however, I have had to add "-sync yes" to the qsub options. But as a "side effect" of this, SGE prints the exit code for each task in each array job, and since there are many jobs and the single tasks are light, it basically renders my shell unusable due to all those interupting messages while the qsub jobs are running.
How can I get rid of those messages? If anything, I would be interested in checking qsub's exit code for the jobs (so I can check everything went ok before the next step), but not in one exit code for each task (I log the tasks' error via option -e anyway in case I need it).
The simplest solution would be to redirect the output from qsub somewhere, i.e.
system("qsub <qsub options> ./script.plx >/dev/null 2>&1");
but this masks errors that you might want to see. Alternatively, you can use open() to start the subprocess and read it's output, only printing something if the subprocess generates an error.
I do have an alternate solution for you, though. You could submit the jobs to SGE without -sync y, and capture the job id when qsub prints it. Then, turn your summarization and results collection code into a follow on job and submit it with a dependency on the completion of the first jobs. You can submit this final job with -sync y so your calling script waits for it to end. See the documentation for -hold_jid in the qsub man page.
Also, rather than making your calling script decide when to submit the next job (up to your maximum), use SGE's -tc option to specify the maximum number of simultaneous jobs (note that -tc isn't in the man page, but it is in qsub's -help output). This depends on you using a new enough version of SGE to have -tc, of course.

How does google update their google finance graphs?

i'm looking at a stock/index:
http://www.google.com/finance?q=google
I've got firebug open, in firefox and when the price updates on the page, i dont see any GETs or POSTs, just a get maybe 30 to 60 seconds later.
Surely if the page is being updated with a value, wouldnt firebug show this data reaching the page as it happens? Or does firebug collect connections in batches?
Look further back in the GET connection logs to see if there is a connection that was opened but not closed. It's likely that the page is opening an XmlHttpRequest connection to the data server and keeping the connection open indefinitely. This is common for streaming data situations, even when the data stream is fairly low volume. If this is the case, then new data will arrive on the open connection without any new connection activity reported in the log.
There is one request that never finishes responding (or at least not for the time I watched), you can see this in the NET panel, this response periodically outputs more data which is then used to update the application. If you examine the request you will see that it specifies a header Transfer-Encoding: Chunked, which is used for these purposes, see http://en.wikipedia.org/wiki/Chunked_transfer_encoding.