2017年3月29日 星期三

2017年3月10日 星期五

106師生網路應用競賽

師生網路應用競賽

1.計分方法
http://contest.tc.edu.tw/plan.aspx
「臺中市106 年度中小學資訊網路應用競賽活動」補充事項
2.應用軟體
106年資訊網路應用競賽軟體版本
3.觀摩優秀作品
http://contest.tc.edu.tw/pub/showrank.aspx
4.中打,英打練習
競賽系統即日起到106年3月17日(星期五)為止開放練習,網址:http://contest.tc.edu.tw/typeweb2/typing/

http://game.hlc.edu.tw/typing/content.asp

5.複賽日期20170321-週二-AM09:00-12:00
6.準備隨身碟
7.午休練習到20170320-週一

2017年3月9日 星期四

SARG監控squid代理伺服器

SARG監控squid代理伺服器

標籤: sarg squid

SARG監控squid代理伺服器
SARG官方網站:http://sarg.sourceforge.net/
squid代理伺服器的缺點就是記錄檔過於複雜,一般來說要完全閱讀CentOS作業系統的紀錄檔是非常困難的,所以必需要仰賴其他工具來整理,Squid Analysis Report Generator(SARG)產生的報表可以讓我們輕鬆的掌握squid代理伺服器的使用記錄,以便了解Proxy伺服器的運作。

在安裝SARG套件前,必需要安裝Apache網頁伺服器,因為SARG以網頁方式呈現,所以必需要安裝Apache並啟動。

SARG套件下載
SARG套件可以從官方網站下載,或者可以使用其他網站所包裝好的RPM安裝,在此使用RPM安裝,目前沒有看到el6的套件,不過el5的套件一樣可以使用。
[root@localhost ]# wget http://pkgs.repoforge.org/sarg/sarg-2.2-1.el5.rf.x86_64.rpm
…中間省略…
Saving to: “sarg-2.2-1.el5.rf.x86_64.rpm”

100%[==================================================>] 323,184      142K/s   in 2.2s

2011-08-30 04:27:27 (142 KB/s) - “sarg-2.2-1.el5.rf.x86_64.rpm” saved [323184/323184]
Ø   SARG檔案來源:http://dag.wieers.com/rpm/packages/sarg/

當安裝SARG套件時發生錯誤,錯誤訊息告知SARG必須安裝GD套件
[root@localhost ~]# rpm -ivh sarg-2.2-1.el5.rf.x86_64.rpm
warning: sarg-2.2-1.el5.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
error: Failed dependencies:
        gd >= 1.8 is needed by sarg-2.2-1.el5.rf.x86_64
        libgd.so.2()(64bit) is needed by sarg-2.2-1.el5.rf.x86_64

由於缺少gd套件,所以由yum方式進行安裝。
[root@localhost /]# yum install -y gd    //安裝GD套件
Dependencies Resolved

============================================================================================
 Package          Arch                 Version                     Repository          Size
============================================================================================
Installing:
 gd               x86_64               2.0.35-10.el6               base               142 k

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 142 k

GD套件安裝完畢後,再次安裝SARG的rpm檔案,則可以正常安裝成功。
[root@localhost ~]# rpm -ivh sarg-2.2-1.el5.rf.x86_64.rpm
warning: sarg-2.2-1.el5.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing...                ########################################### [100%]
   1:sarg                   ########################################### [100%]


編輯/etc/httpd/conf.d的SARG設定檔
編輯sarg設定檔,預設只允許本機IP位址可以瀏覽。若要讓所有人都可以瀏覽,必需要開放所有網段允許連線。
[root@localhost html]# vi /etc/httpd/conf.d/sarg.conf
Alias /sarg /var/www/sarg

<Directory /var/www/sarg>
        DirectoryIndex index.html
        Order deny,allow
#       Deny from all           //取消限制所有網段不可以連線
        Allow from all
#       Allow from 127.0.0.1  //停用只允許本機IPv4連線
#       Allow from ::1        //停用只允許本機IPv6連線
        # Allow from your-workstation.com
</Directory>
Ø   若沒有修改上述設定會發生,則沒有使用權限,如下圖所示。

設定SARG設定檔
SARG設定檔內有很多設定,不過剛安裝好SARG後,並不一定要馬上設定,不過可以將下列幾個設定值做參考。
[root@localhost ~]# vi /etc/sarg/sarg.conf
# sarg.conf
#
# TAG:  language
…中間省略…
#language English       //預設為英文,若有中文語言包可以切換語言,若要使用其他語言,要將#移除。
…中間省略…
# TAG:  access_log file
#       Where is the access.log file
#       sarg -l file
#
#access_log /usr/local/squid/var/logs/access.log
access_log /var/log/squid/access.log             //分析記錄檔位置
…中間省略…
# TAG:  title
#       Especify the title for html page.
#
#title "Squid User Access Reports"                  //標題名稱
…中間省略…
# TAG:  temporary_dir
#       Temporary directory name for work files
#       sarg -w dir
#
#temporary_dir /tmp                    //分析資料暫存位置
…中間省略…
# TAG:  output_dir
#       The reports will be saved in that directory
#       sarg -o dir
#
#output_dir /var/www/html/squid-reports
output_dir /var/www/sarg/ONE-SHOT       //分析資料產出位置
…中間省略…
# TAG:  output_email
#       Email address to send the reports. If you use this tag, no html reports will be generated.
#       sarg -e email
#
#output_email none
…中間省略…
# TAG: charset name
#      ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
#      graphic character sets for writing in alphabetic languages
#      You can use the following charsets:
#               Latin1          - West European
#               Latin2          - East European
#               Latin3          - South European
#               Latin4          - North European
#               Cyrillic
#               Arabic
#               Greek
#               Hebrew
#               Latin5          - Turkish
#               Latin6
#               Windows-1251
#               Koi8-r
#
#charset Latin1              //網頁編碼

Apache服務重新啟動
編輯SARG設定檔,依需求修改設定,所有設定修改後,都必需要重新啟動Apache網頁伺服器,否則設定無法生效。
[root@localhost ~]# service httpd restart                 //重新啟動Apache
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

產生每日、周、月報表
SARG可以依日、周、月報表收集squid代理伺服器的資料。建議可以自行加入排程每天產生。
[root@localhost ~]# sarg -o /var/www/sarg/ONE-SHOT    //1次報表
SARG: Records in file: 1357, reading: 100.00%
[root@localhost ~]# sarg -o /var/www/sarg/daily     //日報表
SARG: Records in file: 1357, reading: 100.00%
[root@localhost ~]# sarg -o /var/www/sarg/weekly    //周報表
SARG: Records in file: 1357, reading: 100.00%
[root@localhost ~]# sarg -o /var/www/sarg/monthly   //月報表
SARG: Records in file: 1357, reading: 100.00%

SARG報表
開啟瀏覽器,網址列輸入【http://IP/sarg】,就可以開啟SARG首頁,會分成一次、日、周、月報表。

SARG會依每個時間平均產生流量報表,點選進入可以看到更多資訊。

Jerry_IT資訊技術手札

2014-08-27 18:06:17

2017年3月5日 星期日

校外教學規劃-106年3月25日


 A景點介紹,文字、圖片、錄影帶等。選取部分文字,滑鼠右鍵,google再搜尋。
B路線規劃,交通工具,時間。
1.從梧棲國中出發,
2.田寮月世界

【高雄景點】田寮月世界,泥火山惡地超壯觀地貌,美國CNN評選高雄必看 ...

 

3.田寮石頭廟斗姥廟 

高雄】田寮石頭廟(無極慈玄聖天宮)--體驗趨吉避凶結緣美食@ 淳寶爸


 
4.民雄金桔觀光工廠

民雄金桔觀光工廠- 觀光工廠-帶嘉回家

 




2017年3月3日 星期五

B路線規劃,交通工具,時間。

Optoins:Indexes:如果沒有預設首頁,那會把整個目錄內容印出來(最好不要有)。

網頁根目錄:這是 rpm 版本的預設值。
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes FollowSymLinks

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>  
這裡是設定目錄,照你的需要去設定。
Optoins:
    ExecCGI:讓你的目錄可以執行如CGI。
    FollowSymLinks:讓你的Link能連接到其他目錄。
    Indexes:如果沒有預設首頁,那會把整個目錄內容印出來(最好不要有)。
    MultiViews:多國語言支援功能。
    All:全部都有,不支援MultiViews。
AllowOverride :
    指的是 .htaccess 這個檔案。
Order allow,deny:啟用 allow and deny 設定。
    例如,我只要讓 edu.tw 的網域存取,我可以設定:
        deny : all
        allow : form edu.tw

2017年3月2日 星期四

netstat -an

*/2 * * * * netstat -an | grep ESTABLISHED | awk '/^tcp/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr  >> /tmp/t1
*/2 * * * * date >> /tmp/t1