Commits

Zoom Quiet  committed e0e3b92
  • Participants

Comments (0)

Files changed (48)

File Doc/3rd week Requirement Specification v0.1.txt

+第三需求确认后,需要修改的内容包括:
+0. MogileFS详细信息需要动态刷新。
+1. Device容量信息采用进度条方式显示。
+2. Host与Deviec状态需动态、实时更新。
+3. 修改密码整合到管理选项页面中。
+4. 准备发布V0.6版本。
+
+
+根据以上需求,组内成员讨论后得出本周实现方案与任务安排:
+
+0825 第三周任务
+ Qichao Cen:
+ 1、將修改密碼頁面和配置刷新時間選項放入管理選項頁面。
+ Ziling Su(SA):
+ 1、配置web服務器用於發佈item版本。
+ Yi Feng(IM):
+ 1、在web服務器上配置mogadm工具,並給出配置説明文件。
+ 2、編寫一個用於更新Device和Host狀態的Python腳本文件update_status.py
+ Chuantong Huang(EA):
+ 0、根據update_status.py文件的輸出數據動態刷新網頁。
+ 1、MogileFS詳細信息頁面添加定時更新,可配置刷新時間。
+ 2、Device容量顯示採用進度條方式。
+ 3、添加Domain和Class信息的顯示。

File Doc/MogBench Project Plan v0.1.wps

Binary file added.

File Doc/MogBenchDB.png

Added
New image

File Doc/Mogbench_V0.65 Readme.txt

+Team: MogBench
+Version: Demo V0.6.5
+Date:   2008-08-27
+Editer: ChuanTong.Huang
+
+发布说明:
+
+###.运行需知:###
+0.系统需求
+    Django 0.962
+    python2.5
+    MySQLdb for python2.5(自行上网下载对应不同操作系统的包,并安装)
+    
+0.使用文件create_mogbenchdb.sql里的SQL脚本创建一个数据库。
+1.在本地新建一个文件夹,并命名为: mogbench ; 如 D:\mogbench;  for Lniux : /home/mogbench/
+2.下载文件夹内全部内容,放到 mogbench/ 目录下。
+3.修改setting.py文件:
+  3.1  找到  “TEMPLATE_DIRS” 变量,把原句 :["D:/MogileFS_demo_V_0.35/mogbench/html/"]
+    修改成你新建目录的绝对路径,(django0.98要求绝对路径) 
+    如 for windowns:  “D:/mogbench/html/” 
+                    TEMPLATE_DIRS = ( "D:/mogbench/html/" )  #html模版目录
+       for lniux:    
+                    TEMPLATE_DIRS = ( "/home/mogbench/html/" )  #html模版目录
+    注意用 ‘/’ 不是 '\'
+    
+    
+  3.2 同样在本文件(最后一行)找到 STATIC_PATH 变量,修改成绝对目录
+      形如:        STATIC_PATH = "D:/mogbench/media"
+      即加上你新建的文件新夹。
+      
+  3.3 同理修改以下的数据库配置信息
+    DATABASE_ENGINE = 'mysql'           # 你使用的数据库类型,默认mysql
+    DATABASE_NAME = 'mogbenchdb'        # 数据库名称,你必需先运行本程序提供的SQL脚本文件		    				(create_mogbenchdb.sql),创建默认数据库mogbenchdb
+    DATABASE_USER = 'root'              # 访问数据库的用户名
+    DATABASE_PASSWORD = 'admin'         # 数据库用户密码
+    DATABASE_HOST = '192.168.1.183'     # 数据库服务器地址
+    DATABASE_PORT = '3306'              # 数据库服务器默认访问端口,非默认自己修改
+
+4.修改以setting.py文件后,运行目录下的manage.py脚本(注意,一定要在此目录下运行),命令行形如:
+
+    $ python manage.py runserver 80
+      #输出以下信息表示运行成功,直接使用 http://127.0.0.1 可访问网站
+        Django version 0.96.2, using settings 'demo.settings'
+        Development server is running at http://127.0.0.1:80/
+        Quit the server with CTRL-BREAK.
+        Validating models...
+        0 errors found.
+
+
+   80表示端口,不指定默认使用 80000,你可以自行指定端口   
+    
+
+5.添加一个系统的计划任务,定时执行脚本文件:update_status.py,定时间隔自行考虑,建议2分钟.
+    
+
+
+
+#---------------------------------------------------------------------------------------------
+Mogbench系统功能说明
+
+Editer: 黄传通 
+Date  : 2008-08-27
+
+1.用户验证功能。	    http://.../login/
+  1-1.添、删管理员。        http://.../admin_mgr/   
+  1-2.退出系统。            http://.../logout/
+   
+                            
+2.添加、删除MogileFS系统    http://.../addmogilefs/
+
+
+3.添加,删除Tracker。        http://.../addtracker/
+                            
+
+4.可监视的MogileFS系统列表。http://.../index/
+
+
+5.监视MogileFS的实时信息。 http://.../mog_view/?mogID=n                         
+  (v0.65版系统最主要功能)
+  包括实时监控Tracker、Host、Device的运行状态,device的储存容量,文件数。
+  主要使用一个更新脚本(update_status.py),让系统定时执行,把状态同步到本地数据库,在网页上显示。
+
+   
+
+6.查、删日志功能。            http://.../viewlog/?aID=n
+
+
+7.注意事项:
+  7-1 所添加的mogilefs系统数据库IP地址格式必须是正确的IPv4地址格式,且允许远程连接。
+  7-2 所添加的mogilefs系统db及track必须在同一个网络下,保证至少一台track正常运行才能返回实时信息,否则只返回数据库信息。
+
+附:
+
+项目使用到的开发包与工具
+MogileFS 2.08
+python 2.5
+Django 0.962
+MySQL 5.1.3
+MySQLdb 1.2.2c1 for py2.5
+Adobe Dreamweaver CS3

File Doc/Python Development Specification.wps

Binary file added.

File Doc/Requirement Configuration v0.2.txt

+客户已在答疑后看了模版页面,前提出了以下小几点修改,同时对大部分功能作了肯定回答:
+1.Tracker(addtracker.html)添加只需IP、商品与所属组群信息。(Tracker名称去除,新增端口)
+2.组群信息总汇(tableview.html)中去掉多余信息(文件总汇信息)。列名称作小修改
+3.组群详细信息(mogfs_view.html)页的dev信息全拼到host中。简化tracker信息。

File Doc/Requirement Specification v0.1 .wps

Binary file added.

File Doc/Structure of Tables of MogileFS Database.txt

+前面对mogileFS做了一下简单介绍,这儿开始对他进行剖析。
+首先剖析他用来做文件西信息track的表结构。
+使用到的数据表
+
+server_settings 
+服务器的一些配置信息,采用key=>value的记录方式保存。
+
+domain 
+域定义
+
+hosts 
+主机定义,主机的ip,存储节点服务所开的端口等信息。
+
+device 
+主机上的可用设备定义,包括设备可用空间,使用的权重等信息,由存储服务定时更新设备的情况。
+
+class 
+文件分类定义
+
+file 
+记录文件的基本信息,属于什么类别,他的key和文件大小等信息
+
+tmpfile 
+复制的临时文件信息?
+
+file_to_delete 
+记录要做删除的文件
+
+file_to_delete_later 
+要延迟删除的文件
+
+file_on 
+记录什么设备上有什么文件,一个文件在不同设备上的存储各有一条记录。
+
+file_on_corrupt 
+损坏的文件,哪一个文件在什么设备上损坏了。
+
+file_to_replicate 
+要做分发的文件,记录来源设备,失败次数和下次重试的时间等信息。
+
+fsck_log 
+文件检查日志
+
+unreachable_fids 
+不可到达的文件列表

File Doc/closure report.wps

Binary file added.

File Doc/database.txt

+MogileFS系统数据库
++----------------------+
+| Tables_in_mogilefs   |
++----------------------+
+| class                | 
+| device               | 
+| domain               | 
+| file                 | 
+| file_on              | 
+| file_on_corrupt      | 
+| file_to_delete       | 
+| file_to_delete_later | 
+| file_to_replicate    | 
+| fsck_log             | 
+| host                 | 
+| server_settings      | 
+| tempfile             | 
+| unreachable_fids     | 
++----------------------+
+
+
+----> describe class;
++-------------+----------------------+------+-----+---------+-------+
+| Field       | Type                 | Null | Key | Default | Extra |
++-------------+----------------------+------+-----+---------+-------+
+| dmid        | smallint(5) unsigned | NO   | PRI | NULL    |       | 
+| classid     | tinyint(3) unsigned  | NO   | PRI | NULL    |       | 
+| classname   | varchar(50)          | YES  |     | NULL    |       | 
+| mindevcount | tinyint(3) unsigned  | NO   |     | NULL    |       | 
++-------------+----------------------+------+-----+---------+-------+
+
+
+
+----> describe device;
++----------+------------------------------------------------+------+-----+---------+-------+
+| Field    | Type                                           | Null | Key | Default | Extra |
++----------+------------------------------------------------+------+-----+---------+-------+
+| devid    | mediumint(8) unsigned                          | NO   | PRI | NULL    |       | 
+| hostid   | mediumint(8) unsigned                          | NO   |     | NULL    |       | 
+| status   | enum('alive','dead','down','readonly','drain') | YES  | MUL | NULL    |       | 
+| weight   | mediumint(9)                                   | YES  |     | 100     |       | 
+| mb_total | mediumint(8) unsigned                          | YES  |     | NULL    |       | 
+| mb_used  | mediumint(8) unsigned                          | YES  |     | NULL    |       | 
+| mb_asof  | int(10) unsigned                               | YES  |     | NULL    |       | 
++----------+------------------------------------------------+------+-----+---------+-------+
+
+
+
+----> describe domain;
++-----------+----------------------+------+-----+---------+-------+
+| Field     | Type                 | Null | Key | Default | Extra |
++-----------+----------------------+------+-----+---------+-------+
+| dmid      | smallint(5) unsigned | NO   | PRI | NULL    |       | 
+| namespace | varchar(255)         | YES  | UNI | NULL    |       | 
++-----------+----------------------+------+-----+---------+-------+
+
+----> describe  file;
++----------+----------------------+------+-----+---------+-------+
+| Field    | Type                 | Null | Key | Default | Extra |
++----------+----------------------+------+-----+---------+-------+
+| fid      | int(10) unsigned     | NO   | PRI | NULL    |       | 
+| dmid     | smallint(5) unsigned | NO   | MUL | NULL    |       | 
+| dkey     | varchar(255)         | YES  |     | NULL    |       | 
+| length   | int(10) unsigned     | YES  |     | NULL    |       | 
+| classid  | tinyint(3) unsigned  | NO   |     | NULL    |       | 
+| devcount | tinyint(3) unsigned  | NO   |     | NULL    |       | 
++----------+----------------------+------+-----+---------+-------+
+
+
+----> describe  file_on;
++-------+-----------------------+------+-----+---------+-------+
+| Field | Type                  | Null | Key | Default | Extra |
++-------+-----------------------+------+-----+---------+-------+
+| fid   | int(10) unsigned      | NO   | PRI | NULL    |       | 
+| devid | mediumint(8) unsigned | NO   | PRI | NULL    |       | 
++-------+-----------------------+------+-----+---------+-------+
+
+
+----> describe file_on_corrupt;
++-------+-----------------------+------+-----+---------+-------+
+| Field | Type                  | Null | Key | Default | Extra |
++-------+-----------------------+------+-----+---------+-------+
+| fid   | int(10) unsigned      | NO   | PRI | NULL    |       | 
+| devid | mediumint(8) unsigned | NO   | PRI | NULL    |       | 
++-------+-----------------------+------+-----+---------+-------+
+
+
+----> describe  file_to_delete;
++-------+------------------+------+-----+---------+-------+
+| Field | Type             | Null | Key | Default | Extra |
++-------+------------------+------+-----+---------+-------+
+| fid   | int(10) unsigned | NO   | PRI | NULL    |       | 
++-------+------------------+------+-----+---------+-------+
+
+
+
+----> describe file_to_delete_later;
++----------+------------------+------+-----+---------+-------+
+| Field    | Type             | Null | Key | Default | Extra |
++----------+------------------+------+-----+---------+-------+
+| fid      | int(10) unsigned | NO   | PRI | NULL    |       | 
+| delafter | int(10) unsigned | NO   | MUL | NULL    |       | 
++----------+------------------+------+-----+---------+-------+
+
+
+----> describe file_to_replicate;
++-----------+----------------------+------+-----+---------+-------+
+| Field     | Type                 | Null | Key | Default | Extra |
++-----------+----------------------+------+-----+---------+-------+
+| fid       | int(10) unsigned     | NO   | PRI | NULL    |       | 
+| nexttry   | int(10) unsigned     | NO   | MUL | NULL    |       | 
+| fromdevid | int(10) unsigned     | YES  |     | NULL    |       | 
+| failcount | tinyint(3) unsigned  | NO   |     | 0       |       | 
+| flags     | smallint(5) unsigned | NO   |     | 0       |       | 
++-----------+----------------------+------+-----+---------+-------+
+
+
+----> describe fsck_log;
++--------+-----------------------+------+-----+---------+----------------+
+| Field  | Type                  | Null | Key | Default | Extra          |
++--------+-----------------------+------+-----+---------+----------------+
+| logid  | int(10) unsigned      | NO   | PRI | NULL    | auto_increment | 
+| utime  | int(10) unsigned      | NO   | MUL | NULL    |                | 
+| fid    | int(10) unsigned      | YES  |     | NULL    |                | 
+| evcode | char(4)               | YES  |     | NULL    |                | 
+| devid  | mediumint(8) unsigned | YES  |     | NULL    |                | 
++--------+-----------------------+------+-----+---------+----------------+
+
+
+----> describe  host;
++---------------+-----------------------------+------+-----+---------+-------+
+| Field         | Type                        | Null | Key | Default | Extra |
++---------------+-----------------------------+------+-----+---------+-------+
+| hostid        | mediumint(8) unsigned       | NO   | PRI | NULL    |       | 
+| status        | enum('alive','dead','down') | YES  |     | NULL    |       | 
+| http_port     | mediumint(8) unsigned       | YES  |     | 7500    |       | 
+| http_get_port | mediumint(8) unsigned       | YES  |     | NULL    |       | 
+| hostname      | varchar(40)                 | YES  | UNI | NULL    |       | 
+| hostip        | varchar(15)                 | YES  | UNI | NULL    |       | 
+| altip         | varchar(15)                 | YES  | UNI | NULL    |       | 
+| altmask       | varchar(18)                 | YES  |     | NULL    |       | 
++---------------+-----------------------------+------+-----+---------+-------+
+
+
+----> describe server_settings;
++-------+--------------+------+-----+---------+-------+
+| Field | Type         | Null | Key | Default | Extra |
++-------+--------------+------+-----+---------+-------+
+| field | varchar(50)  | NO   | PRI | NULL    |       | 
+| value | varchar(255) | YES  |     | NULL    |       | 
++-------+--------------+------+-----+---------+-------+
+
+
+----> describe tempfile;
++------------+----------------------+------+-----+---------+----------------+
+| Field      | Type                 | Null | Key | Default | Extra          |
++------------+----------------------+------+-----+---------+----------------+
+| fid        | int(10) unsigned     | NO   | PRI | NULL    | auto_increment | 
+| createtime | int(10) unsigned     | NO   |     | NULL    |                | 
+| classid    | tinyint(3) unsigned  | NO   |     | NULL    |                | 
+| dmid       | smallint(5) unsigned | NO   |     | NULL    |                | 
+| dkey       | varchar(255)         | YES  |     | NULL    |                | 
+| devids     | varchar(60)          | YES  |     | NULL    |                | 
++------------+----------------------+------+-----+---------+----------------+
+
+
+----> describe  unreachable_fids;
++------------+------------------+------+-----+---------+-------+
+| Field      | Type             | Null | Key | Default | Extra |
++------------+------------------+------+-----+---------+-------+
+| fid        | int(10) unsigned | NO   | PRI | NULL    |       | 
+| lastupdate | int(10) unsigned | NO   | MUL | NULL    |       | 
++------------+------------------+------+-----+---------+-------+
+
+

File Mogbench_V0.65 Readme.txt

+Team: MogBench
+Version: Demo V0.6.5
+Date:   2008-08-27
+Editer: ChuanTong.Huang
+
+发布说明:
+
+###.运行需知:###
+0.系统需求
+    Django 0.962
+    python2.5
+    MySQLdb for python2.5(自行上网下载对应不同操作系统的包,并安装)
+    
+0.使用文件create_mogbenchdb.sql里的SQL脚本创建一个数据库。
+1.在本地新建一个文件夹,并命名为: mogbench ; 如 D:\mogbench;  for Lniux : /home/mogbench/
+2.下载文件夹内全部内容,放到 mogbench/ 目录下。
+3.修改setting.py文件:
+  3.1  找到  “TEMPLATE_DIRS” 变量,把原句 :["D:/MogileFS_demo_V_0.35/mogbench/html/"]
+    修改成你新建目录的绝对路径,(django0.98要求绝对路径) 
+    如 for windowns:  “D:/mogbench/html/” 
+                    TEMPLATE_DIRS = ( "D:/mogbench/html/" )  #html模版目录
+       for lniux:    
+                    TEMPLATE_DIRS = ( "/home/mogbench/html/" )  #html模版目录
+    注意用 ‘/’ 不是 '\'
+    
+    
+  3.2 同样在本文件(最后一行)找到 STATIC_PATH 变量,修改成绝对目录
+      形如:        STATIC_PATH = "D:/mogbench/media"
+      即加上你新建的文件新夹。
+      
+  3.3 同理修改以下的数据库配置信息
+    DATABASE_ENGINE = 'mysql'           # 你使用的数据库类型,默认mysql
+    DATABASE_NAME = 'mogbenchdb'        # 数据库名称,你必需先运行本程序提供的SQL脚本文件		    				(create_mogbenchdb.sql),创建默认数据库mogbenchdb
+    DATABASE_USER = 'root'              # 访问数据库的用户名
+    DATABASE_PASSWORD = 'admin'         # 数据库用户密码
+    DATABASE_HOST = '192.168.1.183'     # 数据库服务器地址
+    DATABASE_PORT = '3306'              # 数据库服务器默认访问端口,非默认自己修改
+
+4.修改以setting.py文件后,运行目录下的manage.py脚本(注意,一定要在此目录下运行),命令行形如:
+
+    $ python manage.py runserver 80
+      #输出以下信息表示运行成功,直接使用 http://127.0.0.1 可访问网站
+        Django version 0.96.2, using settings 'demo.settings'
+        Development server is running at http://127.0.0.1:80/
+        Quit the server with CTRL-BREAK.
+        Validating models...
+        0 errors found.
+
+
+   80表示端口,不指定默认使用 80000,你可以自行指定端口   
+    
+
+5.添加一个系统的计划任务,定时执行脚本文件:update_status.py,定时间隔自行考虑,建议2分钟.
+    
+
+
+
+#---------------------------------------------------------------------------------------------
+Mogbench系统功能说明
+
+Editer: 黄传通 
+Date  : 2008-08-27
+
+1.用户验证功能。	    http://.../login/
+  1-1.添、删管理员。        http://.../admin_mgr/   
+  1-2.退出系统。            http://.../logout/
+   
+                            
+2.添加、删除MogileFS系统    http://.../addmogilefs/
+
+
+3.添加,删除Tracker。        http://.../addtracker/
+                            
+
+4.可监视的MogileFS系统列表。http://.../index/
+
+
+5.监视MogileFS的实时信息。 http://.../mog_view/?mogID=n                         
+  (v0.65版系统最主要功能)
+  包括实时监控Tracker、Host、Device的运行状态,device的储存容量,文件数。
+  主要使用一个更新脚本(update_status.py),让系统定时执行,把状态同步到本地数据库,在网页上显示。
+
+   
+
+6.查、删日志功能。            http://.../viewlog/?aID=n
+
+
+7.注意事项:
+  7-1 所添加的mogilefs系统数据库IP地址格式必须是正确的IPv4地址格式,且允许远程连接。
+  7-2 所添加的mogilefs系统db及track必须在同一个网络下,保证至少一台track正常运行才能返回实时信息,否则只返回数据库信息。
+
+附:
+
+项目使用到的开发包与工具
+MogileFS 2.08
+python 2.5
+Django 0.962
+MySQL 5.1.3
+MySQLdb 1.2.2c1 for py2.5
+Adobe Dreamweaver CS3

File mogbench/Readme.txt

+Team: MogBench
+Version: Demo V0.6.5
+Date:   2008-08-27
+Editer: ChuanTong.Huang
+
+发布说明:
+
+###.运行需知:###
+0.系统需求
+    Django 0.962
+    python2.5
+    MySQLdb for python2.5(自行上网下载对应不同操作系统的包,并安装)
+    
+0.使用文件create_mogbenchdb.sql里的SQL脚本创建一个数据库。
+1.在本地新建一个文件夹,并命名为: mogbench ; 如 D:\mogbench;  for Lniux : /home/mogbench/
+2.下载文件夹内全部内容,放到 mogbench/ 目录下。
+3.修改setting.py文件:
+  3.1  找到  “TEMPLATE_DIRS” 变量,把原句 :["D:/MogileFS_demo_V_0.35/mogbench/html/"]
+    修改成你新建目录的绝对路径,(django0.98要求绝对路径) 
+    如 for windowns:  “D:/mogbench/html/” 
+                    TEMPLATE_DIRS = ( "D:/mogbench/html/" )  #html模版目录
+       for lniux:    
+                    TEMPLATE_DIRS = ( "/home/mogbench/html/" )  #html模版目录
+    注意用 ‘/’ 不是 '\'
+    
+    
+  3.2 同样在本文件(最后一行)找到 STATIC_PATH 变量,修改成绝对目录
+      形如:        STATIC_PATH = "D:/mogbench/media"
+      即加上你新建的文件新夹。
+      
+  3.3 同理修改以下的数据库配置信息
+    DATABASE_ENGINE = 'mysql'           # 你使用的数据库类型,默认mysql
+    DATABASE_NAME = 'mogbenchdb'        # 数据库名称,你必需先运行本程序提供的SQL脚本文件		    				(create_mogbenchdb.sql),创建默认数据库mogbenchdb
+    DATABASE_USER = 'root'              # 访问数据库的用户名
+    DATABASE_PASSWORD = 'admin'         # 数据库用户密码
+    DATABASE_HOST = '192.168.1.183'     # 数据库服务器地址
+    DATABASE_PORT = '3306'              # 数据库服务器默认访问端口,非默认自己修改
+
+4.修改以setting.py文件后,运行目录下的manage.py脚本(注意,一定要在此目录下运行),命令行形如:
+
+    $ python manage.py runserver 80
+      #输出以下信息表示运行成功,直接使用 http://127.0.0.1 可访问网站
+        Django version 0.96.2, using settings 'demo.settings'
+        Development server is running at http://127.0.0.1:80/
+        Quit the server with CTRL-BREAK.
+        Validating models...
+        0 errors found.
+   80表示端口,不指定默认使用 8000,你可以自行指定端口   
+    
+
+5.添加一个系统的计划任务(crontab),定时执行脚本文件:update_status.py,定时间隔自行考虑,建议2分钟.
+  使用update_status.py之前需要在/etc/mogilefs/目錄下添加一個配置文件mogilefs.conf,内容如下:
+  lib = /path/to/lib #即為安裝trunk/utils/包的路徑。ubuntu8.04下為/usr/lib/perl5/5.8.8
+    
+
+#---------------------------------------------------------------------------------------------
+Mogbench系统功能说明
+
+Editer: 黄传通 
+Date  : 2008-08-27
+
+1.用户验证功能。	    http://.../login/
+  1-1.添、删管理员。        http://.../admin_mgr/   
+  1-2.退出系统。            http://.../logout/
+   
+                            
+2.添加、删除MogileFS系统    http://.../addmogilefs/
+
+
+3.添加,删除Tracker。        http://.../addtracker/
+                            
+
+4.可监视的MogileFS系统列表。http://.../index/
+
+
+5.监视MogileFS的实时信息。 http://.../mog_view/?mogID=n                         
+  (v0.65版系统最主要功能)
+  包括实时监控Tracker、Host、Device的运行状态,device的储存容量,文件数。
+  主要使用一个更新脚本(update_status.py),让系统定时执行,把状态同步到本地数据库,在网页上显示。
+
+   
+
+6.查、删日志功能。            http://.../viewlog/?aID=n
+
+
+7.注意事项:
+  7-1 所添加的mogilefs系统数据库IP地址格式必须是正确的IPv4地址格式,且允许远程连接。
+  7-2 所添加的mogilefs系统db及track必须在同一个网络下,保证至少一台track正常运行才能返回实时信息,否则只返回数据库信息。
+
+附:
+
+项目使用到的开发包与工具
+MogileFS 2.08
+python 2.5
+Django 0.962
+MySQL 5.1.3
+MySQLdb 1.2.2c1 for py2.5
+Adobe Dreamweaver CS3

File mogbench/__init__.py

+#coding: utf-8	

File mogbench/add_moggroup.py

+#coding: utf-8	
+# Add MogGroup 
+from django.http import HttpResponseRedirect
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context
+from django.db import connection
+from admin_exist import AdminExists
+from write_log import WriteEvent
+import MySQLdb
+
+# Main Process of Add
+def AddMogGroup(request):
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+
+    res = {}
+
+    mogName = request.POST.get('mogName', None)
+    mogdbIP = request.POST.get('mogdbIP', None)
+    dbName = request.POST.get('dbName', None)
+    dbUser = request.POST.get('dbUser', None)
+    dbPsw = request.POST.get('dbPsw', None)
+
+    if mogName and mogdbIP and dbName and dbUser and dbPsw:
+        if TestIP(mogdbIP):
+            try:
+                conn = MySQLdb.connect(host = mogdbIP, user = dbUser, passwd = dbPsw, db = dbName)
+                cursor = conn.cursor()
+                cursor.execute("select hostid from host") #随便运行一条SQL语句查一下是否正确表结构
+                conn.close()
+            except Exception, e:
+                msg = ("添加组群 %s,连接数据库 IP=%s db=%s user=%s, psw=%s \n出错!请确认数据库信息再添加!") % \
+                      (mogName, mogdbIP, dbName, dbUser, dbPsw)
+                return render_to_response('messages.html',{'msg':msg, 'url':"../addmogilefs"})
+
+            if Add(mogName, mogdbIP, dbName, dbUser, dbPsw):
+                WriteEvent(request, 'Add MogileFS Group -> %s' % mogName)
+                res['AddOk'] = 'AddOk'
+        else:
+            res['WrongIP'] = 'WrongIP'
+    else:
+        res['Empty'] = 'Empty'
+    
+    # Get  info  of  all  mogs  from  DB
+    allMogs = []
+    singleMog =  {}
+    cursor = connection.cursor()
+    cursor.execute("select * from mogfs_group")
+    for record in cursor.fetchall():
+        singleMog['id'] = record[0]
+        singleMog['name'] = record[1]
+        allMogs.append(singleMog.copy())
+    
+    res['Mogilefs'] = allMogs
+    
+    context = Context(res)
+    return render_to_response('addmogilefs.html', context)
+      
+# Add (for mog_group)
+def Add(mogName, mogdbIP, dbName, dbUser, dbPsw):
+    connect = connection.cursor()
+ 
+    sql = "insert into mogfs_group (mName,mdbIP,mdbName,mdbUser,mdbPsw) values (%s,%s,%s,%s,%s)"
+
+    param = (mogName, mogdbIP, dbName, dbUser, dbPsw)
+    connect.execute(sql, param)
+    connect.close()
+
+    return True
+
+# Test IP
+def TestIP(mogdbIP):
+    if mogdbIP.__len__() > 15 or mogdbIP.__len__() < 7:
+        return False
+    else:
+        dota = 0
+        gap = 0
+        for ch in mogdbIP:
+            if ch.isdigit():
+                gap = gap + 1
+                if gap > 3:
+                    return False
+            elif ch == '.':
+                dota = dota + 1
+                if dota > 3 or gap == 0:
+                    return False
+                gap = 0
+    return True
+
+if __name__ == '__main__': #8.模块入口
+   AddMogGroup()

File mogbench/add_tracker.py

+# Add a tracker
+from django.http import HttpResponseRedirect
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context
+from django.db import connection
+from admin_exist import AdminExists
+
+# Main Process of add tracker
+def AddTracker(request):
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+
+    trackerIP = request.POST.get('trackerIP', None)
+    trackerPort = request.POST.get('trackerPort', None)
+    mogGroupID = request.POST.get('mogGroup', None)
+
+    res = {}
+
+    if trackerIP and trackerPort and mogGroupID:
+
+        bRes = True
+
+        # For IP
+        if not TestIP(trackerIP):
+            res['WrongIP'] = 'WrongIP'
+            bRes = False
+        else:
+            if not Add(trackerIP, trackerPort, mogGroupID):
+                bRes = False
+        
+        # For Port
+        if bRes:
+            if trackerPort.__len__() <= 4:
+                for ch in trackerPort:
+                    if not ch.isdigit():
+                        bRes = False
+                        break
+                if bRes:
+                    res['AddOk'] = 'AddOk'
+                else:
+                    res['WrongPort'] = 'WrongPort'
+            else:
+                res['WrongPort'] = 'WrongPort'
+        
+    else:
+        res['Empty'] = 'Empty'
+
+    connect = connection.cursor()
+    
+    # all mog's name
+    mogGroups= ()
+    sql = "select * from mogfs_group"
+    connect.execute(sql)
+    mogGroups = connect.fetchall()
+    res['mogGroups'] = mogGroups
+
+    # all currnet trackers
+    allTrackers = ()
+    sql = "select * from trackers"
+    connect.execute(sql)
+    allTrackers = connect.fetchall()
+    res['allTrackers'] = allTrackers
+        
+    connect.close()
+    
+    context = Context(res)
+    return render_to_response('addtracker.html', context)
+
+# Function for add
+def Add(trackerIP, trackerPort, mogGroupID):
+    connect = connection.cursor()
+    
+    sql = "insert into trackers (MogGroupID, trackerIP, trackerPort) values (%s,%s,%s)"
+    param = (mogGroupID, trackerIP, trackerPort)
+    connect.execute(sql, param)
+        
+    connect.close()
+
+    return True
+
+# Test IP
+def TestIP(trackerIP):
+    if trackerIP.__len__() > 15 or trackerIP.__len__() < 7:
+        return False
+    else:
+        dota = 0
+        gap = 0
+        for ch in trackerIP:
+            if ch.isdigit():
+                gap = gap + 1
+                if gap > 3:
+                    return False
+            elif ch == '.':
+                dota = dota + 1
+                if dota > 3 or gap == 0:
+                    return False
+                gap = 0
+    return True
+
+
+# Get all mogGroups' name (for choice)
+def GetMogGroup(mogGroups):
+    connect = connection.cursor()
+    sql = "select mName from mogfs_group"
+    connect.execute(sql)
+    mogGroups = connect.fetchall()
+    
+
+# Get all Trackers that exists
+def GetAllTracker(allTrackers):
+    connect = connection.cursor()
+    sql = "select * from trackers"
+    connect.execute(sql)
+    allTrackers = connect.fetchall()
+        
+    
+if __name__ == '__main__':
+    AddTracker()   

File mogbench/admin_exist.py

+#coding: utf-8	
+'''检测用户是否已登录'''
+
+from django.http import HttpResponse
+
+def AdminExists(request):
+    '''检测用户是否已登录'''
+    AdminID = request.session.get('aLoginID', None)
+    if AdminID:
+        return True
+    else:
+        return False
+
+        
+if __name__ == "__main__":
+    AdminExists(None)

File mogbench/admin_manage.py

+#coding: utf-8	
+'''用户管理选项实现'''
+from django.http import HttpResponseRedirect
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context
+from django.db import connection
+from admin_exist import AdminExists
+from write_log import WriteEvent
+import string
+import md5
+
+
+
+# Add a ID of admin
+def AddAdmin(userID, password, email = 'none'):
+    '''添加管理员'''
+    res = True
+    code = md5.new()
+    code.update(password)
+    code_psw = code.hexdigest()
+
+    connect = connection.cursor()
+    sql = "select * from admin where (aLoginID) = (%s)"
+    param = (userID,)
+    connect.execute(sql, param)
+    temp = connect.fetchall()
+    
+    if not temp:
+        sql = "insert into admin (aLoginID,aPsw) values (%s,%s)"
+        param = (userID,code_psw)
+        connect.execute(sql, param)
+    else:
+        res = False
+        
+    connect.close()
+
+    return res
+
+# Add a ID of admin
+def DelAdmin(aLoginID):
+    '''删除管理员'''
+
+    res = True
+    
+    connect = connection.cursor()
+    sql = "select * from admin where (aLoginID) = (%s)"
+    param = (aLoginID,)
+    connect.execute(sql, param)
+    temp = connect.fetchall()
+    
+    if temp:
+        sql = "delete from admin where aLoginID = (%s)"
+        param = (aLoginID,)
+        connect.execute(sql, param)
+    else:
+        res = False
+        
+    connect.close()
+    
+    return res
+
+# Get all info of 
+def GetAdminInfo():
+    connect = connection.cursor()
+    sql = "select aID,aLoginID,aEmail from admin"
+    connect.execute(sql)
+    allRecord = connect.fetchall()
+
+    res  = []
+    value = {}
+    
+    for record in allRecord:
+        sql = "select logTime,logEvent from klog "
+        sql = sql + "where aLoginID = (%s) order by logTime desc limit 1"
+        param = (record[1],)
+        connect.execute(sql, param)
+        temp = connect.fetchall()
+        
+        value['id'] = record[0]
+        value['aLoginID'] = record[1]
+        value['email'] = record[2]
+
+        if temp:
+            value['logTime'] = temp[0][0]
+        else:
+            value['logTime'] = "-"
+        
+        res.append(value.copy())
+            
+    connect.close()
+    return res
+
+# Modify  Password
+def modify(request):
+    password = request.POST.get('newPsw', None)
+    password2 = request.POST.get('newPsw2', None)
+    email = request.POST.get('txtEmail', None)
+    AdminID = request.session.get('aLoginID', None)
+
+    append_obj = {}
+    
+    if password and password2:
+        if password != password2:
+            append_obj['MNotSame'] = 'NotSame'
+            
+        else:
+            append_obj['UpdateOk'] = 'UpdateOk'
+            my_md5 = md5.new()
+            my_md5.update(password)
+            md5_password = my_md5.hexdigest()
+
+            sql = "update admin set aPsw = (%s), aEmail = (%s) where aLoginID = (%s)"
+            param = (md5_password, email, AdminID)
+    
+            connect = connection.cursor()
+            connect.execute(sql, param)
+            # Test ?
+            connect.close()
+            
+    else:
+        append_obj['MEmpty'] = 'Empty'
+             
+    return append_obj
+
+# Edit Flush Time
+def EditFlushTime(request, res):
+    flushTime = request.POST.get('flushTime', None)
+
+    if  flushTime:
+        if not flushTime.isdigit():
+            res["TimeFaile"] = "TimeFaile"
+           
+        elif not string.atof(flushTime) < 5:
+            sql = "update config set flushTime = (%s) where aid = (%s)"  
+            param = (flushTime, '1')    #  "1" ??
+
+            connect = connection.cursor()
+            if connect.execute(sql, param):
+                res["TimeOk"] = "TimeOk"
+            else:
+                res["TimeFaile"] = "TimeFaile"
+            connect.close()
+        else:
+            res["TimeLimit"] = "TimeLimit"
+
+
+# Admin Management (main)
+def adminManage(request):
+    if AdminExists(request):
+        aLoginID = request.session.get('aLoginID', None)
+    else:
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+
+    #
+    # For Modify Psw
+    #
+    res = modify(request)
+    res['AdminID'] = aLoginID
+    
+    #
+    #  For Add
+    #
+    AddLoginID = request.POST.get('loginID', None)
+    passWord = request.POST.get('txtpsw', None)
+    passWord2 = request.POST.get('txtpsw2', None)
+    email = request.POST.get('txtEmail', None)
+    if AddLoginID and passWord and passWord2:
+        if AddLoginID == aLoginID:
+            res['NameExist'] = 'NameExist'  # The new name has already existed
+        else:
+            if passWord == passWord2:
+                if AddAdmin(AddLoginID, passWord, email):
+                    WriteEvent(request, "add Admin -> %s" % AddLoginID)
+                    res['AddOk'] = 'AddOk'      # Admin add sucessful
+                else:
+                    res['NameExist'] = 'NameExist' #  Error...
+            else:
+                res['NotSame'] = 'NotSame'  # The password is not same
+    else:
+        if AddLoginID or passWord or passWord2:
+            res['Empty'] = 'Empty'          # The table isn't integrity
+        
+    #
+    #  For Del
+    #
+    DelLoginID = request.POST.get('delUserID', None)
+
+    if DelLoginID:
+        if DelAdmin(DelLoginID):
+            WriteEvent(request, "delete Admin -> %s" % DelLoginID)
+            res['DelOk'] = 'DelOk'
+        else:
+            res['NameNotExist'] = 'NameNotExist'
+
+    # Get Admin Info
+    res['AdminsLogs' ] = GetAdminInfo()
+
+    # For edit flush-time
+    EditFlushTime(request, res)
+    
+    context = Context(res)
+    return render_to_response('admin_mgr.html', context)
+
+#-------------------以下 by toontong  --------------------------------------------   
+def ViewLog(request):
+    '''查看日志,对应viewlog.html页面
+        
+    '''
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+        
+    adminID = request.GET.get('aID', None)
+    nPage = request.GET.get('page', None)
+    
+    if not adminID.isdigit():
+        return render_to_response('messages.html',{'msg':'找不到该用户日志!', 'url':'../admin_mgr'})
+    if not nPage:
+        nPage = 0
+    
+    connect = connection.cursor()
+    sqlCmd = ((("select aLoginID from admin where aID= %s ") % (adminID)))
+    connect.execute(sqlCmd)
+    LoginID = connect.fetchall() 
+    if not LoginID[0][0]:
+        return render_to_response('messages.html',{'msg':'找不到该用户日志!', 'url':'../admin_mgr'})
+    sqlCmd = (("select count(lID) FROM klog WHERE aloginID='%s' ") % (LoginID[0][0]))    
+        
+    connect.execute(sqlCmd)
+    allRecord = connect.fetchall()
+    if not allRecord:
+        return render_to_response('messages.html',{'msg':'找不到该用户日志!', 'url':'../admin_mgr'})
+    nPagelistNumber = 15        #每页显示15条日志
+    nSumPage = allRecord[0][0] / nPagelistNumber #每页显示15条日志
+    
+    nPage = int(nPage) * nPagelistNumber         #每页显示15条日志
+    sql = (("select * from klog where aloginID='%s' order by logTime desc LIMIT %s, %d") %\
+            (LoginID[0][0], nPage, nPagelistNumber))
+    connect.execute(sql)
+    allRecord = connect.fetchall()
+
+    if not allRecord:
+        return render_to_response('messages.html',{'msg':'找不到该用户日志!', 'url':'../admin_mgr'})
+    
+    Logs = []
+    
+    for res in allRecord:
+        log = {}
+        log['id'], log['time'], log['event'] = res[0], res[2], res[3]
+        Logs.append(log)
+        
+    connect.close()
+    Sum = range(1, nSumPage)
+    return render_to_response('viewlog.html', {'LoginID':allRecord[0],'Logs':Logs,'adminID':adminID, 'SumPage':Sum})
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+if __name__ == '__main__':
+    pass     

File mogbench/create_mogbenchdb.sql

+# Creater: ChuanTong.Huang
+# Emain:  ChuanTong.Huang@gmail.com
+# Version: v0.6
+# Saved: 2008-08-26 20:29:50
+# 
+
+CREATE DATABASE IF NOT EXISTS mogbenchdb;
+use mogbenchdb;
+
+# Database: mogbenchdb
+# Table: 'admin'
+CREATE TABLE IF NOT EXISTS `admin` (
+  `aID` mediumint(8) unsigned NOT NULL auto_increment,
+  `aLoginID` char(50) NOT NULL,
+  `aPsw` char(100) NOT NULL default '',
+  `aEmail` char(100) NOT NULL default '',
+  PRIMARY KEY  (`aID`),
+  UNIQUE KEY `aLoginID` (`aLoginID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'config'
+CREATE TABLE IF NOT EXISTS `config` (
+  `aid` int(10) unsigned NOT NULL auto_increment,
+  `flushTime` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`aid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'device_status'
+CREATE TABLE IF NOT EXISTS `device_status` (
+  `mogid` mediumint(9) NOT NULL default '0',
+  `hostid` mediumint(9) NOT NULL default '0',
+  `devid` bigint(20) NOT NULL default '0',
+  `status` char(20) NOT NULL default '',
+  PRIMARY KEY  (`mogid`,`devid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'django_content_type'
+CREATE TABLE IF NOT EXISTS `django_content_type` (
+  `id` int(11) NOT NULL auto_increment,
+  `name` varchar(100) NOT NULL,
+  `app_label` varchar(100) NOT NULL,
+  `model` varchar(100) NOT NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `app_label` (`app_label`,`model`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'django_session'
+CREATE TABLE IF NOT EXISTS `django_session` (
+  `session_key` varchar(40) NOT NULL,
+  `session_data` longtext NOT NULL,
+  `expire_date` datetime NOT NULL,
+  PRIMARY KEY  (`session_key`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'django_site'
+CREATE TABLE IF NOT EXISTS `django_site` (
+  `id` int(11) NOT NULL auto_increment,
+  `domain` varchar(100) NOT NULL,
+  `name` varchar(50) NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'host_status'
+CREATE TABLE IF NOT EXISTS `host_status` (
+  `mogid` mediumint(9) NOT NULL default '0',
+  `hostid` mediumint(9) NOT NULL default '0',
+  `status` char(20) NOT NULL default '',
+  PRIMARY KEY  (`hostid`,`mogid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'klog'
+CREATE TABLE IF NOT EXISTS `klog` (
+  `lID` bigint(20) unsigned NOT NULL auto_increment,
+  `aloginID` char(100) NOT NULL,
+  `logTime` datetime NOT NULL,
+  `logEvent` text NOT NULL,
+  PRIMARY KEY  (`lID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'mogfs_group' 
+CREATE TABLE IF NOT EXISTS `mogfs_group` (
+  `mID` int(10) unsigned NOT NULL auto_increment,
+  `mName` char(100) NOT NULL default '',
+  `mdbIP` char(100) NOT NULL default '',
+  `mdbName` varchar(100) NOT NULL default '',
+  `mdbUser` varchar(100) NOT NULL default '',
+  `mdbPsw` varchar(100) NOT NULL default '',
+  PRIMARY KEY  (`mID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+
+# Database: mogbenchdb
+# Table: 'trackers'
+CREATE TABLE IF NOT EXISTS `trackers` (
+  `trackerID` mediumint(10) NOT NULL auto_increment,
+  `MogGroupID` int(10) unsigned NOT NULL default '0',
+  `trackerIP` char(50) NOT NULL,
+  `trackerPort` int(4) NOT NULL default '6001',
+  `status` char(20) NOT NULL default 'alive',
+  PRIMARY KEY  (`trackerID`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
+
+INSERT INTO `admin`(aLoginID,aPsw) values('admin','21232f297a57a5a743894a0e4a801fc3');
+INSERT INTO config (flushTime) VALUES(60);
+

File mogbench/delete.py

+#coding: utf-8	
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.db import connection
+from admin_exist import AdminExists
+from write_log import WriteEvent
+
+
+def deletetracker(trackerID):
+    '''删除一个tracker'''
+    try:
+        connect = connection.cursor()
+        sqlCmd = ("DELETE FROM trackers WHERE trackerID = %s") % (trackerID)
+        connect.execute(sqlCmd)
+        connect.close()
+        return 1
+    except Exception, e:
+        return 0
+
+def delTracker(request):
+    '''删除一个Tracker
+    '''
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+        
+    tracID = request.GET.get('trackerID', None)
+    if not tracID:
+        return render_to_response("messages.html", {'msg':"找不到Tracker!",'url':'../addtracker/'})
+    if (deletetracker(tracID) == 0):
+       return render_to_response("messages.html", {'msg':"删除失败,数据库中没该信息!",'url':'../addtracker/'})
+    else:
+       WriteEvent(request, ('delete Tracker -> %s') % (tracID))
+       return render_to_response("messages.html", {'msg':"删除成功!" , 'url':'../addtracker/'})
+        
+        
+def delMogileFS(request):
+    '''删除一个群组,同时把所属tracker删除'''
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+    mogID = request.GET.get('mogID', None)
+    if not mogID.isdigit():
+        return render_to_response("messages.html", {'msg':"找不到MogileFS组群!",'url':'../index'})
+    
+    connect = connection.cursor()
+    sqlCmd = ("DELETE FROM trackers WHERE MogGroupID = %s") % (mogID)
+    connect.execute(sqlCmd)
+    sqlCmd = ("DELETE FROM mogfs_group WHERE mID = %s") % (mogID)
+    connect.execute(sqlCmd)
+    connect.close()
+    
+    WriteEvent(request, 'delete MogileFS system -> %s' % mogID)
+    return render_to_response("messages.html", {'msg':"删除成功,点击返回首页!" , 'url':'../index'})
+
+def delLog(request):
+    '''删除一个日志'''
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+    
+    logID = request.GET.get('logID', None)
+    if not logID.isdigit():
+        return render_to_response("messages.html", {'msg':"找不到日志记录!点击返回管理页!",'url':'../admin_mgr'})
+    
+    connect = connection.cursor()
+    sqlCmd = ("DELETE FROM klog WHERE lID = %s") % (logID)
+    connect.execute(sqlCmd)
+    connect.close()
+    
+    return render_to_response("messages.html", {'msg':"<SCRIPT language=JavaScript> history.back()</SCRIPT>",'url':""   })
+ 
+if __name__ == '__main__': #8.模块入口
+   delTracker()        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+if __name__ == '__main__':
+    pass  

File mogbench/front_page.py

+#coding: utf-8	
+from django.http import HttpResponseRedirect
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context
+from admin_exist import AdminExists
+    
+def index(request):
+    if not AdminExists(request):
+        return render_to_response('messages.html',{'msg':'请先登录', 'url':'../login'})
+    else:
+        AdminID = request.session.get('aLoginID', None)
+        context = Context({'AdminID' : AdminID})
+        return render_to_response('index.html', context)

File mogbench/html/404.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--404 Error</title>
+<link href="/site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+  404
+ 
+ 
+</body>
+</html>

File mogbench/html/500.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--500 Error</title>
+<link href="/site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+500
+ 
+ 
+</body>
+</html>

File mogbench/html/addmogilefs.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--添加MogileFS系统组群</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<map name="Map" id="Map"><area shape="rect" coords="2,3,318,59" href="../index" target="_self" alt="首页" />
+</map>
+<table style="width: 100%; height: 60px">
+    <tr>
+      <td width="320"> 
+        <img src="../site_media/logo.png" width="320" height="60" border="0" usemap="#Map" />        
+      </td>
+        <td valign="baseline">
+          <ul id="nav"> 
+               <li><a href="../logout/" >退出</a></li>  
+               <li><a href="../admin_mgr/" >管理选项</a></li>    
+               <li><a href="../addtracker/" >Tracker管理</a></li> 
+               <li><a href="../addmogilefs/" id="current">添加组群</a></li> 
+               <li><a href="../index" >首 页</a></li> 
+        </ul> 
+       </td>
+     </tr>
+</table>
+<div align="center"><br />
+<form id="form1" name="form1" method="post" action="">
+  <table width="85%" border="0" cellpadding="1" cellspacing="2" class="index_table">
+    <tr>
+      <td height="30" colspan="2" class="title">添加MogileFS系统组群</td>
+    </tr>
+    <tr>
+      <td width="39%" class="index_td1">名称:</td>
+      <td width="61%" class="index_td2">
+          <input type="text" name="mogName" id="mogName" />      </td>
+    </tr>
+    <tr>
+      <td class="index_td1">数据库IP地址:</td>
+      <td class="index_td2">
+      	<input type="text" name="mogdbIP" id="mogdbIP" />      </td>
+    </tr>
+    <tr>
+      <td class="index_td1">数据库名称:</td>
+      <td class="index_td2"><input type="text" name="dbName" id="dbName" /></td>
+    </tr>
+    <tr>
+      <td class="index_td1">数据库用户:</td>
+      <td class="index_td2"><input type="text" name="dbUser" id="dbUser" /></td>
+    </tr>
+     <tr>
+      <td class="index_td1">数据库密码:</td>
+      <td class="index_td2"><input type="password" name="dbPsw" id="dbPsw" /></td>
+    </tr>
+     <tr>
+      <td colspan="2" class="index_table"><label>
+        <input type="submit" name="button" id="button" value="提交" />
+      </label>
+      &nbsp;&nbsp;&nbsp;&nbsp;
+        <label>
+         <input type="reset" name="button2" id="button2" value="重置" />
+        </label></td>
+      </tr>
+  </table>
+  {% if AddOk %}
+   	<font color="red"><b>添加成功</b></font>
+  {% endif %}
+  {% if Empty %}
+ 	<font color="red" size="-1">所填写数据库必需是已存在的MogileFS数据库</font> 
+   {% endif %}
+  {% if WrongIP %}
+	<font color="red"><b>IP错误</b></font>
+  {% endif %}
+  </form>
+  <br>
+  
+  <table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+  <tr>
+    <td colspan="2" height="30" class="title">删除MogileFS系统(注意:这是个危险的操作,将删除所属所有Tracker!)</td>
+    </tr>
+  <tr>
+    <td width="39%" class="info_tile">名称</td>
+    <td width="61%" class="info_tile">
+      <label>        </label>
+      <label>操作</label></td>
+  </tr>
+   {% for mog in Mogilefs%}
+  <tr>
+    <td class='info_td'>{{mog.name}}</td>
+    <td class='info_td'><a href="#"><a href="../delmogilefs/?mogID={{mog.id}}" onClick="javascript:return confirm('确定要删除吗?')">删除</a></td>
+  </tr>
+   {% endfor%}
+</table>
+  
+</div>
+</body>
+</html>

File mogbench/html/addtracker.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--添加 Tracker</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<map name="Map" id="Map"><area shape="rect" coords="2,3,318,59" href="../index" target="_self" alt="首页" />
+</map>
+<table style="width: 100%; height: 60px">
+    <tr>
+      <td width="320"> 
+        <img src="../site_media/logo.png" width="320" height="60" border="0" usemap="#Map" />        
+      </td>
+        <td valign="baseline">
+          <ul id="nav"> 
+               <li><a href="../logout/" >退出</a></li>
+               <li><a href="../admin_mgr/" >管理选项</a></li>    
+               <li><a href="../addtracker/" id="current">Tracker管理</a></li> 
+               <li><a href="../addmogilefs/" >添加组群</a></li> 
+               <li><a href="../index" >首 页</a></li> 
+        </ul> 
+       </td>
+     </tr>
+</table>
+  <div align="center"><br>
+    <table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+      <tr>
+        <td width="28%" class="info_tile"> IP</td>
+        <td width="28%" class="info_tile">端口</td>
+        <td width="17%" class="info_tile">所属组群</td>
+        <td width="14%" class="info_tile">操作</td>
+      </tr>
+      {% for info in allTrackers %}
+      <tr>
+        <td class="info_td">{{ info.2 }}</td>
+        <td class="info_td">{{ info.3 }}</td>
+        <td class="info_td">{{ info.1 }}</td>
+        <td class="info_td"><a href="../deltracker/?trackerID={{ info.0}}"  onClick="javascript:return confirm('确定要删除吗?')">删除</a></td>
+      </tr>
+      {% endfor %}
+    </table>
+    <br>
+    <form id="form1" name="form1" method="post" action="">
+	<table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+  <tr>
+    <td colspan="2" class="title">添加 Tracker</td>
+    </tr>
+  <tr>
+    <td width="41%" class="index_td1">IP:</td>
+    <td width="59%" class="index_td2">
+      <label>
+        <input type="text" name="trackerIP" id="trackerIP" />
+        </label>    </td>
+  </tr>
+  <tr>
+    <td class="index_td1">IP端口:</td>
+    <td class="index_td2">
+      <label>
+        <input type="text" name="trackerPort" id="trackerPort" />
+        </label>    </td>
+  </tr>
+  <tr>
+    <td class="index_td1">组群:</td>
+    <td class="index_td2">
+      <label>
+        <select name="mogGroup" id="mogGroup">
+	  {% for mogs in mogGroups %}
+          <option value={{ mogs.0 }}>{{ mogs.1 }}</option>
+          {% endfor %}
+        </select>
+        </label>    </td>
+  </tr>
+  <tr>
+    <td class="index_td1">&nbsp;</td>
+    <td class="index_td2">&nbsp;</td>
+  </tr>
+  <tr>
+    <td colspan="2" class="index_table"><label>
+      <input type="submit" name="button" id="button" value="提交" />
+    </label>&nbsp;&nbsp;&nbsp;&nbsp;
+      <label>
+      <input type="reset" name="button2" id="button2" value="重置" />
+      </label></td>
+    </tr>
+
+</table>
+   {% if WrongIP %}
+      <font color="red"><b>IP错误</b></font>
+   {% endif %}
+   {% if WrongPort %}
+      <font color="red"><b>端口错误</b></font>
+   {% endif %}
+   {% if AddOk %}
+      <font color="red"><b>添加成功</b></font>
+   {% endif %}
+   </form>
+</div>
+</body>
+</html>

File mogbench/html/admin_mgr.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--管理员选项</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<map name="Map" id="Map"><area shape="rect" coords="2,3,318,59" href="../index" target="_self" alt="首页" />
+</map>
+<table style="width: 100%; height: 60px">
+    <tr>
+      <td width="320"> 
+        <img src="../site_media/logo.png" width="320" height="60" border="0" usemap="#Map" />        
+      </td>
+        <td valign="baseline">
+          <ul id="nav"> 
+               <li><a href="../logout/" >退出</a></li>
+               <li><a href="../admin_mgr/" id="current">管理选项</a></li>    
+               <li><a href="../addtracker/" >Tracker管理</a></li> 
+               <li><a href="../addmogilefs/" >添加组群</a></li> 
+               <li><a href="../index" >首 页</a></li> 
+        </ul> 
+       </td>
+     </tr>
+</table>
+ <div align="center">  <br>
+   <table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+     
+     <tr>
+       <td class="info_tile">用户</td>
+       <td class="info_tile">邮箱</td>
+       <td class="info_tile">最后登录时间</td>
+       <td class="info_tile">操作</td>
+     </tr>
+ 
+    {% for record in AdminsLogs %}
+     <tr>
+       <td class="info_td">{{ record.aLoginID }}</td>
+       <td class="info_td">{{ record.email }}</td>
+       <td class="info_td">{{ record.logTime }}</td>
+       <td class="info_td"><a href="../viewlog/?aID={{ record.id }}">查看日志</a></td>
+     </tr>
+    {% endfor %}
+   </table>
+   <br>
+
+<form id="form1" name="form1" method="post" action="">
+  <table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+    <tr>
+      <td colspan="2" class="title">修改密码</td>
+    </tr>
+    <tr>
+      <td width="40%" class="index_td1">密码:</td>
+      <td width="60%" class="index_td2"><label>
+        <input type="password" name="newPsw" id="newPsw" />
+      </label></td>
+    </tr>
+    <tr>
+      <td class="index_td1">确认:</td>
+      <td class="index_td2"><label>
+        <input type="password" name="newPsw2" id="newPsw2" />
+      </label></td>
+    </tr>
+    <tr>
+      <td class="index_td1"><label></label>
+        邮件: </td>
+      <td class="index_td2"><label>
+        <input type="text" name="txtEmail" id="txtEmail" />
+      </label></td>
+    </tr>
+    <tr>
+      <td colspan="2"><input type="submit" name="btnMofPsw" id="btnMofPsw" value="提交" />
+      <label>&nbsp;&nbsp;&nbsp;&nbsp;
+      <input type="reset" name="button" id="button" value="重置" />
+      </label></td>
+    </tr>
+  </table>
+  {% if Empty %}
+      <font color="red"><b>注: 密码不能为空</b></font>
+  {% else %}
+      {% if NotSame %}
+          <font color="red"><b>密码不一样</b></font>
+      {% else %}
+          {% if UpdateOk %}
+	       <font color="red"><b>修改成功!</b></font>
+	  {% endif %}
+      {% endif %}
+  {% endif %}
+</form>
+   <form id="form2" name="form2" method="post" action="">
+   <table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+     <tr>
+       <td colspan="2" class="title">添加管理者</td>
+     </tr>
+     <tr>
+       <td width="40%" class="index_td1">登录名</td>
+       <td width="60%" class="index_td2">
+         <label>
+           <input type="text" name="loginID" id="loginID" />
+          </label>       </td>
+     </tr>
+     <tr>
+       <td class="index_td1">密码</td>
+       <td class="index_td2"> 
+         <label>
+           <input type="password" name="txtpsw" id="txtpsw" />
+          </label>       </td>
+     </tr>
+     <tr>
+       <td class="index_td1">确认密码</td>
+       <td class="index_td2"> 
+         <label>
+           <input type="password" name="txtpsw2" id="txtpsw2" />
+          </label>       </td>
+     </tr>
+     <tr>
+       <td class="index_td1">邮箱 (可选)</td>
+       <td class="index_td2"> 
+         <label>
+           <input type="text" name="txtEmail" id="txtEmail" />
+          </label>       </td>
+     </tr>
+     <tr>
+       <td colspan="2" class="index_table"><label>
+         <input type="submit" name="button" id="button" value="提交" />
+       </label>
+       &nbsp;&nbsp;&nbsp;&nbsp;
+        <label>
+        <input type="reset" name="button2" id="button2" value="重置" />
+        </label></td>
+      </tr>
+   </table>
+   {% if Empty %}
+       <font color="red"><b>填写未完整</b></font>
+   {% else %}
+       {% if NameExist %}
+           <font color="red"><b>管理用户已存在</b></font>
+       {% endif %}
+       {% if NotSame %}
+	   <font color="red"><b>密码填写不正确!</b></font>	
+       {% endif %}
+       {% if AddOk %}
+	   <font color="red"><b>添加成功!用户登录后才在上表显示!</b></font>	
+       {% endif %}
+   {% endif %}
+
+   </form>   
+   <br>
+<form id="form3" name="form3" method="post" action="">
+<table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+  <tr>
+    <td colspan="2" class="title">删除管理者</td>
+    </tr>
+  <tr>
+    <td width="40%" class="index_td1">用户名:</td>
+    <td width="60%" class="index_td2">
+      <label class="index_td2">
+        <input type="text" name="delUserID" id="delUserID" />
+        </label>    
+      <label>
+        <input type="submit" name="btnDelAdmin" id="btnDelAdmin" value="提交" />
+        </label>    </td>
+   </tr>
+</table>
+   {% if DelOk %}
+       <font color="red"><b>删除成功!</b></font>
+   {% endif %}
+   {% if NameNotExist %}
+       <font color="red"><b>管理用户不存在!</b></font>
+   {% endif %}
+</form>
+
+
+<form id="form4" name="form4" method="post" action="">
+<table width="85%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+  <tr>
+    <td colspan="2" class="title">修改数据刷新间隔时间</td>
+    </tr>
+  <tr>
+    <td width="40%" class="index_td1">间隔时间 (秒) :</td>
+    <td width="60%" class="index_td2">
+      <label class="index_td2">
+        <input type="text" name="flushTime" id="flushTime" />
+        </label>    
+      <label>
+        <input type="submit" name="btnFlushTime" id="btnFlushTime" value="提交" />
+        </label>    </td>
+   </tr>
+</table>
+   {% if TimeOk %}
+       <font color="red"><b>修改成功!</b></font>
+   {% else %}
+	{% if TimeFaile %}
+          <font color="red"><b>修改失败!</b></font>
+   	{% else %}
+		{% if TimeLimit %}
+          		<font color="red"><b>刷新时间不能少于5秒!</b></font>
+        	{% endif %}
+	{% endif %}
+   {% endif %}
+</form>
+
+
+<p>&nbsp;</p>
+</div>
+</body>
+</html>

File mogbench/html/index.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Kingsoft MogileFS Files Manage System--首页</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<map name="Map" id="Map"><area shape="rect" coords="2,3,318,59" href="../index" target="_self" alt="首页" />
+</map>
+<table style="width: 100%; height: 60px">
+<tr>
+      <td width="320"> 
+        <img src="../site_media/logo.png" width="320" height="60" border="0" usemap="#Map" />        
+      </td>
+        <td align="left" valign="baseline">
+       <ul id="nav"> 
+               <li><a href="../logout/" >退出</a></li> 
+               <li><a href="../admin_mgr/" >管理选项</a></li>    
+               <li><a href="../addtracker/" >Tracker管理</a></li> 
+               <li><a href="../addmogilefs/" >添加组群</a></li> 
+               <li><a href="../index" id="current">首 页</a></li> 
+        </ul> 
+       </td>
+  </tr>
+</table>
+<div align="center">
+<br>
+<table width="85%" border="0" cellspacing="4" cellpadding="4">
+  <tr>
+    <td class="title">系统中已存在的MogileFS组群</td>
+  </tr>
+  <tr>
+    <td class="index_table"><table width="100%" border="0" cellpadding="2" cellspacing="2" class="index_table">
+      <tr>
+        <td class="info_tile">Name</td>
+        <td class="info_tile">Tracker</td>
+        <td class="info_tile">Host</td>
+        <td class="info_tile">Dve</td>
+        <td class="info_tile">Domain</td>
+        <td class="info_tile">class</td>
+        <td class="info_tile">state</td>
+      </tr>
+      {% for mog in mogGroups %}
+      <tr class="index_table">
+        <td class="info_td"><a href="../mogfs_view/?mogID={{mog.ID}}">{{mog.name}}</a></td>
+        <td class="info_td">{{mog.Tracker}}</td>
+        <td class="info_td">{{mog.Host}}</td>
+        <td class="info_td">{{mog.Dev}}</td>
+        <td class="info_td">{{mog.Domain}}</td>
+        <td class="info_td">{{mog.Class}}</td>
+        <td class="info_td">{{mog.State}}</td>
+      </tr>
+      {% endfor%}
+    </table>
+    
+    </td>
+  </tr>
+  <tr>
+    <td>&nbsp;</td>
+  </tr>
+</table>
+</div>
+</body>
+
+</html>

File mogbench/html/login.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>登录 Kingsoft MogileFS Files Manage System</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+<style type="text/css">
+<!--
+#apDiv1 {
+	position:absolute;
+	left:392px;
+	top:152px;
+	width:216px;
+	height:132px;
+	z-index:1;
+}
+-->
+</style>
+</head>
+
+<body>
+<label><form id="form1" name="form1" method="post" action="">
+<div id="apDiv1">
+  <table width="100%" border="0" height="" cellpadding="1" cellspacing="2" class="index_table">
+    <tr>
+      <td height="28" colspan="2" align="center" class="title">管理员登录</td>
+    </tr>
+    <tr>
+      <td width="50%" class="index_td1">帐 号:</td>
+      <td width="50%" class="index_middle"><label></label>
+          <label>
+          <input type="text" name="UserID" id="UserID" />
+          </label>      </td>
+    </tr>
+    <tr>
+      <td class="index_td1">密 码:</td>
+      <td class="index_middle"><label>
+        <input type="password" name="txtPsw" id="txtPsw" />
+        </label> </td>
+    </tr>
+    <tr>
+      <td height="23" colspan="2" class="index_table"><label>
+        <input type="submit" name="button" id="button" value="提交" />
+        </label>
+        <label>
+        <input type="reset" name="button2" id="button2" value="重置" />
+        </label></td>
+      </tr>
+    <tr>
+      <td height="18" colspan="2" align="center" class="context" >
+      测试用户、密码均为admin <br><br><br>
+      Kingsoft.Kcpy.Mogbench</td>
+      </tr>
+  </table>
+</div>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+  <tr>
+    <td><img src="../site_media/logo.png" width="320" height="60" border="0" usemap="#Map" /></td>
+  </tr>
+</table>
+</form> </label>
+
+<map name="Map" id="Map">
+<area shape="rect" coords="1,2,309,54" href="../index" />
+</map>
+</body>
+</html>

File mogbench/html/logout.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>退出 Kingsoft MogileFS Files Manage System</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+<style type="text/css">
+<!--
+#apDiv1 {
+	position:absolute;
+	left:264px;
+	top:136px;
+	width:334px;
+	height:85px;
+	z-index:1;
+}
+-->
+</style>
+</head>
+<div><br>
+
+
+</div>
+<body>
+<div id="apDiv1">
+  <table width="100%" border="0" cellpadding="2" cellspacing="2" class="info_td">
+    <tr>
+      <td class="info_td">安全退出</td>
+    </tr>
+    <tr>
+      <td class="index_table"><a href="../login">点击返回</a></td>
+    </tr>
+    <tr>
+      <td>&nbsp;</td>
+    </tr>
+  </table>
+</div>
+</body>
+</html>

File mogbench/html/messages.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>登录 Kingsoft MogileFS Files Manage System</title>
+<link href="../site_media/css.css" rel="stylesheet" type="text/css" />
+<style type="text/css">
+<!--
+#apDiv1 {
+	position:absolute;
+	left:392px;
+	top:152px;
+	width:265px;
+	height:132px;
+	z-index:1;
+}
+-->
+</style>
+</head>
+
+<body>
+<label>
+<div id="apDiv1">
+  <table  class="index_table" width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
+    <tr>
+      <td align="center">提示</td>
+    </tr>
+    <tr>
+      <td align="center"><br>{{msg}}<br><br></td>
+    </tr>
+    <tr>
+      <td align="center" valign="middle"><a href="{{url}}">点击返回</a></td>
+    </tr>
+  </table>
+</div>
+
+<table style="width: 100%; height: 60px">
+    <tr>
+      <td width="320">