Archive for the ‘網路管理’ Category
Boomerang 中的 Bandwidth & Latency 測試方式..
- First download a 32 byte gif 10 times serially. This is used to measure latency
We discard the first measurement because that pays the price for the TCP handshake (3 packets) and TCP slow-start (4 more packets). All other image requests take two TCP packets (one for the request and one for the response). This gives us a good idea of how much time it takes to make an HTTP request from the browser to our server.
Once done, we calculate the arithmetic mean, standard deviation and standard error at 95% confidence for the 9 download times that we have. This is the latency number that we beacon back to our server.
- Next download images of increasing size until one of the times out
We choose image sizes so that we can narrow down on a bandwidth range as soon as possible. See the code comments in boomerang.js for full details.
Image timeouts are set at between 1.2 and 1.5seconds. If an image times out, we stop downloading larger images, and retry the largest image 4 more times[3]. We then calculate the bandwidth for the largest 3 images that we downloaded. This should result in 7 readings unless the test timed out before that [4]. We calculate the median, standard deviation and standard error from these values and this is the bandwidth that we beacon back to our server.
全国网路连线品质监控..
现在机房除了做 smokeping 侦对外面几个主要的程式做监控,希望能够更进一步有其他资讯可以参考。在网路上看到了大陆有个叫监控X的网站,里面有一个用户体验(访问速度)跟踪,只是因为是公司使用,不便把资料放在别人的主机或依附他人的服务,所以就参考了他的网页,配合 Y! 的 Boomerang 自己弄了一个。
除了在统计上 Boomerang 的测试会准一点外,借用了监控X的 UI,并稍做修改。在时段选择上加上了最近一小时,跟踪历史部份也改以 Ajax 方式做即时的更新,另外也把一些 js lib 都换新版的用。虽然还有三个是已知的缺陷,不过暂时不想去改动了,等之后再说吧。
这东西算是最近玩比较好玩的东西了….
Y! Boomerang 只測 latency 不測 bandwidth…
最近用了 Y! 的 Boomerang 要來做全國連線品質監測,不過他有個問題是 latency 和 bandwidth 是同一個模組的功能,並沒有參數直接可以設定只跑 latency 不做 bandwidth 測試,但即使設 1 次測試,以現在的來訪數,流量大概會上升 5~10M。在現在是固定頻寬的狀況下,並不是很好。
所以只好在 js 中直接把他處理掉,抓沒壓過的來,把其中 1063 行這段改掉,就會在做完 latency 後直接回傳給統計主機了。
1 2 3 | if (!this.runs_left) { this.finish(); } |
改成
1 2 3 | if (!this.latency_runs) { this.finish(); } |
Hostmonitor Check Oracle 設定…
在 Hostmonitor 上要設定 Oracle 檢查,搞了幾天終於搞定了。
主要有幾點需要注意的,
1. Hostmonitor 是 32bits 的軟體,因此安裝的 Oracle Client 也需要是 32bits。因為我 OS 是 2008 64bits,在這一點上我卡關了一些時間,試了好幾個終於搞定,他不會用 64bits 的 oci。
2. Oracle Client 可以只裝 Instant Client 部份,因為只需要有 oci.dll 就好。
3. 需要設定 Oracle_Home Path 的環境變數於系統上.
4. Hostmonitor 使用 TNS Alias 當設定,因此需要於安裝路徑下的 network/admin 下建立 tnsname.ora 與 sqlnet.ora。
最重要的一點,當上面都弄好了,如果發現 Hostmonitor 要不是說還是找不到 oci.dll 或是 TNS resolve 錯誤,那就重啟動 Hostmonitor 就好了。
Smokeping Alexa World Top 100 Web Sites 監控…
最近 NI 同仁提出了一個需求,需要能監控公司對 Alexa 上世界排名前 100 的網站的連線品質,因此用 Perl 寫了這支 Scripts,使用非常簡單,只要先在 smokeping 的 config 裡加上 @include /usr/local/smokeping/alexaworld,然後再把下面這支程式放到 Crontab 去跑,這樣就能夠動態的產生 World Top 100 的列表並由 Smokeping 監控了。
#!/usr/bin/perl # Smokeping Alexa World Top 100 Web Sites Configuration Generater # Jasont(AT)batlab.net 2009/11/17 use strict; use Encode; use LWP::Simple; use URI::URL; my $worldtop_url = "http://www.alexa.com/topsites/global;"; # Get WorldTop my $topid = 1; my @worldtops_name; my @worldtops_link; for ( my $i = 0; $i < 5; $i++ ) { my $url = url($worldtop_url.$i); my $page = get($url); if ( $page ) { Encode::from_to($page, "utf-8", "Big5"); my @lines = split('\n', $page); foreach ( @lines ) { if ( / \>\<strong\>(.*)\<\/strong\>\<\/a\> \<br\/>/ ) { $worldtops_name[$topid] = $1; next; } if ( /class=\"offsite\"\>(.*)\<\/a\>/ ) { $worldtops_link[$topid] = $1; $topid++; next; } } } } # Create Smokeping Config - WorldTop 100 `/bin/echo "+ WorldTop100\n\nmenu = WorldTop100\ntitle = Alexa World Top 100 Sites\n" > /tmp/alexaworld`; foreach my $index ( 1..$#worldtops_name ) { #print "$index: $worldtops_name[$index]\t$worldtops_link[$index]\n"; if ( $index%20 == 1 ) { my $indexdif = $index+19; `/bin/echo "++ Top\"$index\"-\"$indexdif\"\n\nmenu = WorldTop\"$index\"~\"$indexdif\"\ntitle = WorldTop\"$index\"~\"$indexdif\"\n" >> /tmp/alexaworld`; } `/bin/echo "+++ Top\"$index\"\n\nmenu = Top\"$index\"_$worldtops_link[$index]\ntitle = Top\"$index\"_$worldtops_link[$index]\nhost = $worldtops_link[$index]\n" >> /tmp/alexaworld`; } `/bin/cp -f /tmp/alexaworld /usr/local/smokeping/etc/`; `/bin/ps -ef|/bin/grep smokeping | /bin/grep FPing | /bin/awk '{ print "kill -1 "$2}' | /bin/sh`; exit;