【公告】本站停止維護
因為工作關系,現在已無心力再維護此 Blog 內容,最新文章請至 http://www.weithenn.org
這裡是 http://www.weithenn.org 備份站台及打屁聊天的地方...
IBM System x and BladeCenter Power Configurator 方便用來計算 IBM Server 的耗電量 (功率 W、安培 A、BTU...等數量)
標籤: Great Software
今天開始找一些有關 HD Streaming 的相關資料,跟我之前了解的 Windows 2003 Server-Media Server 架設有點不同,換成用 IIS Smooth Streaming 才能達成 HD Streaming 的效果,分享一下找到的相關參考網址。
以下內容轉貼來源為:有痔難申 活動辦法
標籤: Try Your Lucky
實作完 [Apache mod_cband 流量限制] 功能後雖然可以即時看到流量,但也希望為流量留下歷史記錄,因此安裝文字模式網頁瀏覽器 lynx 去抓取 cband-status 成果網頁中 Limit 及 Current 的流量數值來畫出 MRTG 圖,在開始玩本次實作以前請先確定您的 MRTG 已安裝並正確定設定,若無可參考本站 MRTG-主機網卡流量統計 文章。(請尊重 weithenn 的辛勞!!)
有關於如何設定 Apache mod_cband 請參考站內文章 [Apache mod_cband 頻寬限制]
安裝文字模式網頁瀏覽器 lynx 已便屆時可順利抓取需要的欄位值。(請尊重 weithenn 的辛勞!!)
#cd /usr/ports/www/lynx //切換至安裝路徑
#make install clean //安裝套件並清除安裝過程中產生不必要檔案測試抓取 Limit 及 Current 欄位值,環境說明如下
http://www.weithenn.org/cband-statushttp://www.weithenn.org(請尊重 weithenn 的辛勞!!)將 cband-status 網頁資料 Dump 出來後再利用 grep 及 cut 指定來過濾出我們要抓取目前流量中的 Limit、Current 欄位值,如下為抓取 Limit 數值(請尊重 weithenn 的辛勞!!)
#lynx -dump -nolist -width=150 'http://www.weithenn.org/cband-status' | grep 'www.weithenn.org' | cut -d" " -f11 | cut -d/ -f1建立 jiakai.sh 內容就是抓取目前流量中 Limit、Current 欄位值 (編輯完後記得權限要設為 755 哦)
#vi /usr/local/etc/mrtg/weithenn.sh
#!/bin/sh
CURRENT=`/usr/local/bin/lynx -dump -nolist -width=150 'http://www.weithenn.org/cband-status' | grep 'www.weithenn.org' | cut -d" " -f11 | cut -d/ -f2`
LIMIT=`/usr/local/bin/lynx -dump -nolist -width=150 'http://www.weithenn.org/cband-status' | grep 'www.weithenn.org' | cut -d" " -f11 | cut -d/ -f1`
echo $CURRENT
echo $LIMIT
echo '0'
echo '0'抓取 Limit、Current 欄位值後便利用 MRTG 把抓取的數值畫出圖來了,MRTG 設定檔 weithenn.cfg 內容如下(請尊重 weithenn 的辛勞!!)
Target[apache]: `/usr/local/etc/mrtg/weithenn.sh` //抓取 Limit、Current 欄位值
Options[apache]: growright,gauge //growright 流量圖由右向左 gauge 數值不累加
Title[apache]: Bandwidth Traffic Status -- www.weithenn.org //網頁的 title (Browser 左上方文字)
PageTop[apache]: <h1>Bandwidth Traffic Status -- www.weithenn.org</h1> //流量網頁內的標題產生檔案,下列指令執行 2 ~ 3 次到沒錯誤訊息後就代表完成了,因為我的環境為 zh_TW.UTF-8 所以必須加上 env LANG=C 才可順利執行,並於執行後將結果寫入 mrtg.log 中。(請尊重 weithenn 的辛勞!!)
#env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/weithenn.cfg --logging /var/log/mrtg.log 將如下指令寫入排程內以便達成自動產生流量圖表 (每五分鐘執行一次)(請尊重 weithenn 的辛勞!!)
#crontab -e
*/5 * * * * `env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/weithenn.cfg --logging /var/log/mrtg.log` //每五分鐘執行一次當執行 MRTG Log 後會產生執行後的記錄檔,其實也是用這個記錄檔來比較前後的量並畫出流量圖的,若您想直接把數據做成報告可利用如下指令快速達成,MRTG Log 總共五個欄位:(請尊重 weithenn 的辛勞!!)
了 解各欄位值後比較麻煩的大概就只有時間 TimeStamp 的部份而以,我們可以利用如下 Perl 指令來將 TimeStamp 轉換成 Localtime,若 MRTG Log 名稱為 weithenn.log 如下指令即可轉換欄位一 TimeStamp 為 Localtime
#perl -p -e 's/^\d+/localtime $&/e' <>直接存取 SNMP 資訊畫出 MRTG 圖。
SNMP Traffic Grapher This freeware utility allows monitoring of supporting SNMPv1 and SNMPv2c devices including Cisco, Livingstone, Riverstone etc.
標籤: Great Software