หน้าเว็บ

วันศุกร์ที่ 20 สิงหาคม พ.ศ. 2553

Export Active Directory Users to Excel Worksheet

VB Script :
Dim ObjWb 
 Dim ObjExcel 
 Dim x, zz 
 Set objRoot = GetObject("LDAP://RootDSE") 
 strDNC = objRoot.Get("DefaultNamingContext") 
 Set objDomain = GetObject("LDAP://" & strDNC) ' Bind to the top of the Domain using LDAP using ROotDSE 
 Call ExcelSetup("Sheet1") ' Sub to make Excel Document 
 x = 1 
 Call enummembers(objDomain) 
 Sub enumMembers(objDomain) 
 On Error Resume Next 
 Dim Secondary(20) ' Variable to store the Array of 2ndary email alias's 
 For Each objMember In objDomain ' go through the collection 

 If ObjMember.Class = "user" Then ' if not User object, move on. 
 x = x +1 ' counter used to increment the cells in Excel 

    objwb.Cells(x, 1).Value = objMember.Class 
    ' I set AD properties to variables so if needed you could do Null checks or add if/then's to this code 
    ' this was done so the script could be modified easier. 
 SamAccountName = ObjMember.samAccountName 
 Cn = ObjMember.CN 
 FirstName = objMember.GivenName 
 LastName = objMember.sn 
 initials = objMember.initials 
 Descrip = objMember.description 
 Office = objMember.physicalDeliveryOfficeName 
 Telephone = objMember.telephonenumber 
 EmailAddr = objMember.mail 
 WebPage = objMember.wwwHomePage 
 Addr1 = objMember.streetAddress 
 City = objMember.l 
 State = objMember.st 
 ZipCode = objMember.postalCode 
 Title = ObjMember.Title 
 Department = objMember.Department 
 Company = objMember.Company 
 Manager = ObjMember.Manager 
 Profile = objMember.profilePath 
 LoginScript = objMember.scriptpath 
 HomeDirectory = ObjMember.HomeDirectory 
 HomeDrive = ObjMember.homeDrive 
 AdsPath = Objmember.Adspath 
 LastLogin = objMember.LastLogin 

 zz = 1 ' Counter for array of 2ndary email addresses 
 For each email in ObjMember.proxyAddresses 
     If Left (email,5) = "SMTP:" Then 
 Primary = Mid (email,6) ' if SMTP is all caps, then it's the Primary 
     ElseIf Left (email,5) = "smtp:" Then 
        Secondary(zz) = Mid (email,6) ' load the list of 2ndary SMTP emails into Array. 
        zz = zz + 1 
     End If 
 Next 
 ' Write the values to Excel, using the X counter to increment the rows. 

 objwb.Cells(x, 2).Value = SamAccountName 
 objwb.Cells(x, 3).Value = CN 
 objwb.Cells(x, 4).Value = FirstName 
 objwb.Cells(x, 5).Value = LastName 
 objwb.Cells(x, 6).Value = Initials 
 objwb.Cells(x, 7).Value = Descrip 
 objwb.Cells(x, 8).Value = Office 
 objwb.Cells(x, 9).Value = Telephone 
 objwb.Cells(x, 10).Value = EmailAddr
 objwb.Cells(x, 11).Value = WebPage 
 objwb.Cells(x, 12).Value = Addr1 
 objwb.Cells(x, 13).Value = City 
 objwb.Cells(x, 14).Value = State 
 objwb.Cells(x, 15).Value = ZipCode 
 objwb.Cells(x, 16).Value = Title 
 objwb.Cells(x, 17).Value = Department 
 objwb.Cells(x, 18).Value = Company 
 objwb.Cells(x, 19).Value = Manager 
 objwb.Cells(x, 20).Value = Profile 
 objwb.Cells(x, 21).Value = LoginScript 
 objwb.Cells(x, 22).Value = HomeDirectory 
 objwb.Cells(x, 23).Value = HomeDrive 
 objwb.Cells(x, 24).Value = Adspath 
 objwb.Cells(x, 25).Value = LastLogin 
 objwb.Cells(x,26).Value = Primary 

 ' Write out the Array for the 2ndary email addresses. 
 For ll = 1 To 20 
 objwb.Cells(x,26+ll).Value = Secondary(ll) 
 Next 
 ' Blank out Variables in case the next object doesn't have a value for the property 
 SamAccountName = "-" 
 Cn = "-" 
 FirstName = "-" 
 LastName = "-" 
 initials = "-" 
 Descrip = "-" 
 Office = "-" 
 Telephone = "-" 
 EmailAddr = "-" 
 WebPage = "-" 
 Addr1 = "-" 
 City = "-" 
 State = "-" 
 ZipCode = "-" 
 Title = "-" 
 Department = "-" 
 Company = "-" 
 Manager = "-" 
 Profile = "-" 
 LoginScript = "-" 
 HomeDirectory = "-" 
 HomeDrive = "-" 
 Primary = "-" 
 For ll = 1 To 20 
 Secondary(ll) = "" 
 Next 
    End If 
    
    ' If the AD enumeration runs into an OU object, call the Sub again to itinerate 
    
    If objMember.Class = "organizationalUnit" or OBjMember.Class = "container" Then 
        enumMembers (objMember) 
    End If 
 Next 
 End Sub 
 Sub ExcelSetup(shtName) ' This sub creates an Excel worksheet and adds Column heads to the 1st row 
 Set objExcel = CreateObject("Excel.Application") 
 Set objwb = objExcel.Workbooks.Add 
 Set objwb = objExcel.ActiveWorkbook.Worksheets(shtName) 
 Objwb.Name = "Active Directory Users" ' name the sheet 
 objwb.Activate 
 objExcel.Visible = True 
 objwb.Cells(1, 2).Value = "SamAccountName" 
 objwb.Cells(1, 3).Value = "CN" 
 objwb.Cells(1, 4).Value = "FirstName" 
 objwb.Cells(1, 5).Value = "LastName" 
 objwb.Cells(1, 6).Value = "Initials" 
 objwb.Cells(1, 7).Value = "Descrip" 
 objwb.Cells(1, 8).Value = "Office" 
 objwb.Cells(1, 9).Value = "Telephone" 
 objwb.Cells(1, 10).Value = "Email" 
 objwb.Cells(1, 11).Value = "WebPage" 
 objwb.Cells(1, 12).Value = "Addr1" 
 objwb.Cells(1, 13).Value = "City" 
 objwb.Cells(1, 14).Value = "State" 
 objwb.Cells(1, 15).Value = "ZipCode" 
 objwb.Cells(1, 16).Value = "Title" 
 objwb.Cells(1, 17).Value = "Department" 
 objwb.Cells(1, 18).Value = "Company" 
 objwb.Cells(1, 19).Value = "Manager" 
 objwb.Cells(1, 20).Value = "Profile" 
 objwb.Cells(1, 21).Value = "LoginScript" 
 objwb.Cells(1, 22).Value = "HomeDirectory" 
 objwb.Cells(1, 23).Value = "HomeDrive" 
 objwb.Cells(1, 24).Value = "Adspath" 
 objwb.Cells(1, 25).Value = "LastLogin" 
 objwb.Cells(1, 26).Value = "Primary SMTP" 
 End Sub 
 MsgBox "Done" ' show that script is complete 

วันพฤหัสบดีที่ 22 กรกฎาคม พ.ศ. 2553

Windows Built-in Users and Default Groups

Items in italics are implicit placeholders, these items don’t appear in "Active Directory Users and Computers" but are available when applying permissions – membership is automatically calculated by the OS.

Group User/ Session Description
Account Operators   A built-in group that exists only on domain controllers. By default, the group has no members. By default, Account Operators have permission to create, modify, and delete accounts for users, groups, and computers in all containers and organizational units (OUs) of Active Directory except the Builtin container and the Domain Controllers OU. Account Operators do not have permission to modify the Administrators and Domain Admins groups, nor do they have permission to modify the accounts for members of those groups.
  Administrator A user account for the system administrator. This account is the first account created during operating system installation. The account cannot be deleted or locked out. It is a member of the Administrators group and cannot be removed from that group.
Administrators   A built-in group . After the initial installation of the operating system, the only member of the group is the Administrator account. When a computer joins a domain, the Domain Admins group is added to the Administrators group. When a server becomes a domain controller, the Enterprise Admins group also is added to the Administrators group. The Administrators group has built-in capabilities that give its members full control over the system. The group is the default owner of any object that is created by a member of the group.
  Anonymous A user who has logged on anonymously.
Authenticated Users   A group that includes all users whose identities were authenticated when they logged on. Membership is controlled by the operating system.
Backup Operators   A built-in group. By default, the group has no members. Backup Operators can back up and restore all files on a computer, regardless of the permissions that protect those files. Backup Operators also can log on to the computer and shut it down.
Batch   A group that implicitly includes all users who have logged on through a batch queue facility such as task scheduler jobs. Membership is controlled by the operating system.
Cert Publishers   A global group that includes all computers that are running an enterprise certificate authority. Cert Publishers are authorized to publish certificates for User objects in Active Directory.
Cert Server Admins   Certificate Authority Administrators - authorized to administer certificates for User objects in Active Directory. (Domain Local)
Cert Requesters   Members can request certificates (Domain Local)
Creator Group   A placeholder in an inheritable ACE. When the ACE is inherited, the system replaces this SID with the SID for the primary group of the object's current owner. The primary group is used only by the POSIX subsystem.
  Creator Owner A placeholder in an inheritable access control entry (ACE). When the ACE is inherited, the system replaces this SID with the SID for the object's current owner.
Dialup   A group that implicitly includes all users who are logged on to the system through a dial-up connection. Membership is controlled by the operating system.
Domain Admins   A global group whose members are authorized to administer the domain. By default, the Domain Admins group is a member of the Administrators group on all computers that have joined a domain, including the domain controllers. Domain Admins is the default owner of any object that is created in the domain's Active Directory by any member of the group. If members of the group create other objects, such as files, the default owner is the Administrators group.
Domain Computers   A global group that includes all computers that have joined the domain, excluding domain controllers.
Domain Controllers   A global group that includes all domain controllers in the domain. New domain controllers are added to this group automatically.
Domain Guests   A global group that, by default, has only one member, the domain's built-in Guest account.
Domain Users   A global group that, by default, includes all user accounts in a domain. When you create a user account in a domain, it is added to this group automatically.
Enterprise Admins   A group that exists only in the root domain of an Active Directory forest of domains. It is a universal group if the domain is in native mode, a global group if the domain is in mixed mode. The group is authorized to make forest-wide changes in Active Directory, such as adding child domains. By default, the only member of the group is the Administrator account for the forest root domain.
Enterprise Controllers   A group that includes all domain controllers an Active Directory directory service forest of domains. Membership is controlled by the operating system.
Everyone   A group that includes all users, even anonymous users and guests. Membership is controlled by the operating system.
Group Policy Creators Owners   A global group that is authorized to create new Group Policy objects in Active Directory. By default, the only member of the group is Administrator. The default owner of a new Group Policy object is usually the user who created it. If the user is a member of Administrators or Domain Admins, all objects that are created by the user are owned by the group. Owners have full control of the objects they own.
  Guest A user account for people who do not have individual accounts. This user account does not require a password. By default, the Guest account is disabled.
Guests   A built-in group. By default, the only member is the Guest account. The Guests group allows occasional or one-time users to log on with limited privileges to a computer's built-in Guest account.
HelpServicesGroup   XP - Group for the Help and Support Center
Interactive   A group that includes all users who have logged on interactively. Membership is controlled by the operating system.
  KRBTGT A service account that is used by the Key Distribution Center (KDC) service.
  Local System A service account that is used by the operating system.
Network   A group that implicitly includes all users who are logged on through a network connection. Membership is controlled by the operating system.
Network Configuration Operators   XP - Some admin privileges to manage configuration of networking features
  Nobody No security principal.
Power Users   A built-in group. By default, the group has no members. This group does not exist on domain controllers. Power Users can create local users and groups; modify and delete accounts that they have created; and remove users from the Power Users, Users, and Guests groups. Power Users also can install most applications; create, manage, and delete local printers; and create and delete file shares.
Pre-Windows 2000 Compatible Access   A backward compatibility group which allows read access on all users and groups in the domain
Principal Selfor Self Principal Selfor Self A placeholder in an ACE on a user, group, or computer object in Active Directory. When you grant permissions to Principal Self, you grant them to the security principal represented by the object. During an access check, the operating system replaces the SID for Principal Self with the SID for the security principal represented by the object.
Print Operators   A built-in group that exists only on domain controllers. By default, the only member is the Domain Users group. Print Operators can manage printers and document queues.
RAS and IAS Servers   A domain local group . By default, this group has no members. Computers that are running the Routing and Remote Access service are added to the group automatically. Members of this group have access to certain properties of User objects, such as Read Account Restrictions, Read Logon Information, and Read Remote Access Information.
Remote Desktop Users   XP - Members in this group are granted the right to logon remotely
Replicator   Windows NT domains, this group is called Replicators and is used by the directory replication service. In 2K/XP the group is present but is not used.
Schema Admins   A group that exists only in the root domain of an Active Directory forest of domains. It is a universal group if the domain is in native mode , a global group if the domain is in mixed mode . The group is authorized to make schema  changes in Active Directory. By default, the only member of the group is the Administrator account for the forest root domain.
Server Operators   A built-in group that exists only on domain controllers. By default, the group has no members. Server Operators can log on to a server interactively; create and delete network shares; start and stop services; back up and restore files; format the hard disk of the computer; and shut down the computer.
Service   A group that includes all security principals that have logged on as a service. Membership is controlled by the operating system.
Terminal Server Users   A group that includes all users who have logged on to a Terminal Services server. Membership is controlled by the operating system.
Users   A built-in group. After the initial installation of the operating system, the only member is the Authenticated Users group. When a computer joins a domain, the Domain Users group is added to the Users group on the computer. Users can perform tasks such as running applications, using local and network printers, shutting down the computer, and locking the computer. Users can install applications that only they are allowed to use if the installation program of the application supports per-user installation.

วันอังคารที่ 20 กรกฎาคม พ.ศ. 2553

การติดตั้งและคอนฟิกโปรแกรม MRTG บน Windows

รู้จักกับ MRTG
MRTG ย่อมาจาก Multi Router Traffic Grapher เป็นเครื่องมือที่ใช้สำหรับการมอนิเตอร์ดู Traffic Load บน Nerwork Links ซึ่งการทำงานของ MRTG จะมีการสร้าง HTML Pages ที่ประกอบด้วยภาพ (กราฟ) ชนิด PNG โดยภาพดังกล่าวนี้จะแสดงถึงปริมาณของทราฟฟิกบนเครือข่าย สามารถดูตัวอย่างได้ที่ ซึ่งการนำไปใช้งานส่วนใหญ่ก็จะนำไปมอนิเตอร์ดูทราฟฟิกตามพอร์ตต่าง ๆ ของเราเตอร์ ว่ามีทราฟฟิกหนาแน่นขนาดไหน

การติดตั้ง Active Perl
เนื่องจาก MRTG ต้องใช้ภาษา Perl ช่วยในการโปรเซส ให้ไปดาวน์โหลด Active Perl มาก่อน โดยต้องเป็นเวอร์ชัน 5.005 หรือสูงกว่า 5.6 เมื่อดาวน์โหลดมาแล้วก็ให้ทำการติดตั้ง โดยวิธีการติดตั้งก็ไม่ต้องทำอะไรครับ แค่กด Next ไปเรื่อย ๆ ก็เสร็จเอง หลังจากนั้นก็ไม่ต้องมีการคอนฟิกแต่ประการใดครับ ตรวจสอบว่า Perl binary directory เป็นรายการที่มีอยู่ใน System Path ของแล้วหรือยัง ด้วยการดูที่
Control Panel -> System -> Environment (เวอร์ชันของ OS ที่ต่างกัน อาจจะแตกต่างกันบ้าง)
โดยหาข้อความต่อไปนี้ :
C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...

การติดตั้งโปรแกรม MRTG
ในขั้นแรกก็ให้ไปดาวน์โหลดโปรแกรม MRTG โดยในที่นี้ของเลือกเป็น mrtg-2.9.22.zip (อาจจะเลือกเวอร์ชันที่ใหม่กว่านี้ก็ได้) เมื่อดาวน์โหลดมาเสร็จแล้วก็ให้ unzip ไฟล์ดังกล่าวไปไวที่ C:\mrtg-2.9.22

การทดสอบความพร้อมของ MRTG และ Perl ก็ทำได้ด้วยการเข้าไปในตำแหน่ง c:\mrtg-2.9.22\bin ให้พิมพ์คำว่า
perl mrtg

ถ้าทั้งสองอย่างติดตั้งพร้อมแล้วจะมี error message เกี่ยวกับการไม่มี mrtg configuration file ขึ้นมา

การคอนฟิก MRTG
ก่อนที่จะคอฟฟิกต้องทราบข้อมูล 2 อย่างต่อไปนี้
1. IP Address หรือ Host Name ของ SNMP port number ของอุปกรณที่คุณต้องการจะมอนิเตอร์ ซึ่งถ้าอุปกรณ์ของคุณเป็น เราเตอร์ ก็คือ IP ที่เป็น Gateway หรือ IP ที่เป็น ethernet บนเราเตอร์นั่น เอง หรือถ้าใครจะใช้ IP ของพอร์ต WAN ก็ได้เหมือนกัน
2.ต้องรู้ค่าของ read-only SNMP community string บนอุปกรณ์ ถ้าไม่รู้ก็ให้พยายามใช้ public ซึ่งเป็นค่า default

สิ่งแรกที่เราต้องเซ็ตอัพ mrtg คือการสร้าง default config file ดังนั้นตอนนี้ให้ไปที่ command prompt ด้วยการรันคำสั่ง cmd และให้ change ไดเร็คทอรี่ไปยัง c:\mrtg-2.9.22\bin แล้วให้พิมพ์คำสั่งดังนี้ :

perl cfgmaker public@x.x.x.x --global "WorkDir: c:\www\mrtg" --output mrtg.cfg

หรือถ้าต้องการให้กราฟแสดงผลมาจากด้านขวามือ (ปกติจะเป็นด้านซ้าย) และให้หน่วยของกราฟเป็น Bits per second (ปกติจะเป็น Byte) ก็อาจจะใช้คำสั่งดังนี้ :

perl cfgmaker --global "WorkDir: c:\www\mrtg" --global "Options[_]: growright,bits" public@x.x.x.x --output mrtg.cfg

ซึ่งเมื่อพิมพ์คำสั่งไปแล้ว ก็จะเป็นการสั่งให้มีการติดต่อกับ router เพื่ออ่านค่าพารามิเตอร์ของพอร์ตต่าง ๆ บนเราเตอร์ (Ethernet และ Wan) ไปเก็บลงสู่ไฟล์ mrtg.cfg

คำสั่งข้างบนนี้จะเป็นการสร้าง initial MRTG config file ที่มีชื่อว่า mrtg.cfg (ตามที่ระบุในคำสั่ง) ไว้ในตำแหน่ง c:\mrtg-2.9.22\bin และค่าของ WorkDir ซึ่งจากคำสั่งข้างบนจะอยู่ที่ c:\www\mrtg ก็เป็นตำแหน่งที่ใช้สำหรับการเก็บไฟล์ชนิดที่เป็น html page ซึ่งตำแหน่งนี้จะเก็บไว้ตรงไหนก็ได้ โดยค่านี้จะถูกบันทึกลงไฟล์ mrtg.cfg ซึ่งถ้าใช้ Nodepad เปิดดูไฟล์ mrtg.cfg จะมีสองบรรทัดแรกเป็นดังนี้ :

# Created by
# cfgmaker public@x.x.x.x --global 'WorkDir: c:\www\mrtg' --output mrtg.cfg

นั่นคือจะมีตำแหน่งที่ใช้เก็บ html page อยู่ในบรรทัดที่สอง และในส่วงล่างของไฟล์นี้จะมีคำสั่งภาษา html และพารามิเตอร์ของพอร์ตต่าง ๆ ที่จะนำไปใช้สร้างไฟล์ html ต่อไป

มาถึงตอนนี้ต้องไม่ลืมสร้างไดเร็คทอรี่ c:\www\mrtg ไว้ด้วย เพราะไม่งั้นจะไม่สามารถสร้างไฟล์ html ได้

ขั้นตอนต่อไปก็เป็นขั้นตอนที่สำคัญ คือการสร้าง html page วิธีการที่ basic ที่สุด ก็คือให้ไปที่ไดเร็คทอรี่ c:\mrtg-2.9.22\bin แล้วพิมพ์คำสั่งต่อไปนี้ :

perl mrtg mrtg.cfg

ให้ไปดูที่ไดเร็คทอรี่ c:\www\mrtg จะเห็นว่ามีไฟล์เกิดขึ้นจำนวนหลายไฟล์ ซึ่งจะมีชนิดของไฟล์เป็น 3 ประเภทคือ

1. html file ซึ่งจำนวนของไฟล์ประเภทนี้จะเท่ากับจำนวนของพอร์ต ต่าง ๆ ที่ใช้งานอยู่ของเราเตอร์ ไฟล์นี้เองที่เราจะต้องเปิดดูผ่าน browser เพื่อดูทราฟฟิกของพอร์ตต่าง ๆ
2. png file เป็นไฟล์ภาพที่ใช้แสดงกราฟของทราฟฟิก
3. log file

ซึ่งถ้าเปิดดู html ไฟล์ในตอนนี้เราจะเห็นแต่กราฟว่างเปล่า เป็นเพราะว่าตอนนี้คำสั่ง perl mrtg mrtg.cfg จะทำงานแค่ครั้งเดียวตอนที่พิมพ์ไปเท่านั้น วิธีที่จะให้มีกราฟเกิดขึ้นจะต้องพิมพ์คำสั่ง perl mrtg mrtg.cfg อยู่ตลอดทุกช่วงเวลา

การทำให้ MRTG รันตลอดช่วงเวลา
ขั้นแรกก็ให้เพิ่มออฟชั่นต่อไปนี้ (เป็น script หนึ่งบรรทัด) ไว้ในส่วนบน ๆ ของ config file (mrtg.cfg)

RunAsDaemon: yes

ให้ตำแหน่งของ command prompt ยังคงอยู่ที่ c:\mrtg-2.9.22\bin แล้วพิมพ์คำสั่งดังนี้

wperl mrtg --logging=eventlog mrtg.cfg

คำสั่งข้างบนนี้ จะเป็นการสั่งให้ mrtg รันทุกช่วงเวลา (ค่า default เป็นทุก ๆ 5 นาที) ซึ่งหลังจากนี้ไปผลของกราฟจะมีการเปลี่ยนแปลงทุก ๆ 5 นาที (ยกเว้นมีการปิดเครื่อง PC หรือ Sever)

จากที่กล่าวมาเมื่อใดที่คุณมีการปิดเครื่องหรือ restart เครื่องที่ได้ลง MRTG ไว้ ก็จะส่งผลให้ Service ของ MRTG ถูกปิดไปด้วย ซึ่งวิธีการที่จะรัน MRTG ขึ้นมาใหม่ก็คือการไปที่ Prompt --> c:\mrtg-2.9.22\bin แล้วป้อนคำสั่ง wperl mrtg --logging=eventlog mrtg.cfg ใหม่ทุกครั้งที่มีการปิดแล้วเปิดเครื่องใหม่

ซึ่งจะไม่สะดวกนักสำหรับเครื่องที่ต้องมีการปิด-เปิด บ่อย ๆ วิธีการที่ทำให้สะดวกขึ้นก็คือการเอาสั่ง ดังกล่าวไปสร้าง เป็น batch file แล้ว save ลงในตำแหน่ง Start Up ของเครื่อง แค่นี้ก็จะทำให้เครื่องของคุณมีการรัน MRTG Service ทุกครั้งที่เปิดเครื่อง

ถ้าต้องการทำ MRTG ที่มี Router หลายตัว
ต้องสร้างไฟล์คอนฟิก (cfg) จำนวน 3 ไฟล์ ตามจำนวน router โดยชื่อไฟล์ต้องต่างกัน ตำแหน่งเก็บไฟล์ html และไฟล์ภาพต่างกัน โดยกำหนดให้ชื่อ config file เป็น ดังนี้ (ใช้ชื่ออื่นก็ได้)

mrtg1.cfg, mrtg2.cfg และ mrtg3.cfg

และกำหนดให้ตำแหน่งการเก็บไฟล์ html เป็น (กำหนดเป็นชื่ออื่นก็ได้)
c:\www\mrtg1 สำหรับ router ตัวที่ 1
c:\www\mrtg2 สำหรับ router ตัวที่ 2
c:\www\mrtg3 สำหรับ router ตัวที่ 3

สร้างไฟล์คอนฟิกสำหรับ Router ตัวที่ 1
c:\mrtg-2.9.29\bin>perl cfgmaker public@x.x.x.x --global "WorkDir: c:\www\
mrtg1
" --output
mrtg1
.cfg

สร้างไฟล์คอนฟิกสำหรับ Router ตัวที่ 2
c:\mrtg-2.9.29\bin>perl cfgmaker public@x.x.x.x --global "WorkDir: c:\www\
mrtg2
" --output
mrtg2
.cfg

สร้างไฟล์คอนฟิกสำหรับ Router ตัวที่ 3
c:\mrtg-2.9.29\bin>perl cfgmaker public@x.x.x.x --global "WorkDir: c:\www\
mrtg3
" --output
mrtg3
.cfg

จากนั้นทำตามขั้นตอน การทำให้ MRTG รันตลอดช่วงเวลา เป็นอันเสร็จเรียบร้อย...

การย้ายโดเมน (Transfer Domain)

ขั้นตอนที่ 1 ตรวจสอบการ Lock ของผู้ให้บริการจดทะเบียนโดเมนเก่าก่อน ว่าได้ทำการ Lock Domain ไว้หรือไม่

1.1 โดยสามารถตรวจสอบได้ที่ http://www.internic.com/whois.html
1.2 ใส่ชื่อเว็บไซต์ของคุณลงในช่องดังภาพแล้วกดปุ่ม Submit
1.3 ระบบจะแสดงข้อมูลของโดเมนของคุณออกมา ซึ่งถ้าหากมี Status: REGISTRAR-LOCK นั่นแสดงว่าโดเมนของคุณถูก Lock อยู่ ต้องติดต่อไปยังผู้ให้บริการเก่าเพื่อทำการปลด Lock หรือหากคุณมี User & Password ในการ Manage Domain ก็ให้เข้าไปทำการปลด Lock โดเมนของคุณก่อน

ขั้นตอนที่ 2 ตรวจสอบชื่อผู้ดูแลโดเมน (Administrator) ของคุณ และ E-mail Account ที่ใช้ในการติดต่อ

2.1 โดยสามารถตรวจสอบได้ที่ http://whois.domaintools.com
2.2 ใส่ชื่อเว็บไซต์ของคุณลงในช่องดังภาพแล้วกดปุ่ม Search
2.3 ระบบจะแสดงข้อมูลของโดเมนของคุณออกมา ซึ่งถ้าหากได้ทำการปลด Lock แล้ว Status จะเป็น OK ดูรายละเอียดของ Administrator Contact และ E-mail ของ Administrator ซึ่งตรงนี้สำคัญมาก คือเมื่อมีการร้องขอให้มีการย้ายโดเมน ผู้ให้บริการใหม่จะแจ้งไปยังผู้ให้บริการเก่า และแจ้งไปยังผู้ดูแลโดเมน (Administrator) ตาม E-mail ที่ปรากฏ หาก E-mail ดังกล่าวไม่ใช่ของคุณเอง เมื่อมี E-mail ยืนยันการย้ายโดเมนส่งไปที่ Administrator Contact คุณก็จะไม่สามารถยืนยันการย้ายโดเมนได้ และทำให้การร้องขอย้ายโดเมน ของผู้ให้บริการใหม่นั้นถูกยกเลิกไป

หากทั้ง 2 ส่วนถูกต้องแล้ว ทางผู้ให้บริการใหม่จะดำเนินการย้ายโดเมนให้ท่าน โดยสามารถดำเนินการได้ทันที ส่วนการ Transfer Domain จะใช้ระยะเวลาประมาณ 7-10 วันทำการ ซึ่งขึ้นอยู่กับ การยืนยันจากทาง Administrator Contact และผู้ให้บริการเก่าแต่ละแห่งด้วย ทางลูกค้าต้องติดต่อไปยังผู้ให้บริการเก่าเพื่อขอ AUTH CODE เพื่อใช้ในการอนุมัติการย้ายด้วย ใน
ส่วนของการ Transfer Domain นี้จะไม่ส่งผลกระทบต่อการทำงานใด ๆ ของเว็บไซต์และ E-mail ของคุณแล้ว

* ควรกระทำก่อนการหมดอายุของโดเมนอย่างต่ำ 15 วัน

วันจันทร์ที่ 19 กรกฎาคม พ.ศ. 2553

Clustering กับ Load Balancing ต่างกันอย่างไร

Clustering

คือการจัดกลุ่มของคอมพิวเตอร์หลายๆตัวเพื่อให้สามารถทำงานได้เหมือนกับเป็นคอมพิวเตอ
ร์ตัวเดียวกัน

ดังนั้นไม่ว่า User เข้ามาใช้งานเครื่องใดภายในกลุ่มก็จะรู้สึกเหมือนใช้งานคอมพิวเตอร์เครื่องเดียวกัน คุณสมบัติสำคัญของการทำ Clustering คือการทำ Replication โดยในแง่ของ Web Application คือการทำ Session Replication ซึ่งตามปกติแล้ว Session ของ User จะถูกจัดเก็บใน Web Server เครื่องที่ User กำลังใช้งานอยู่เท่านั้น แต่การทำ Clustering จะเป็นการคัดลอก (Replicate) Session นั้นไปยัง Web Server อื่นภายในกลุ่มด้วย ทำให้ไม่ว่า User เข้าไปใช้งานใน Server เครื่องใดก็จะมี Session ของ User อยู่ด้วยเสมอ


Load balancing

คือการจัดกลุ่มของคอมพิวเตอร์หลายๆตัวเพื่อแบ่งงานกัน หรือกระจาย load การใช้งานของ user ไปยังคอมพิวเตอร์ภายในกลุ่ม เพื่อให้สามารถรับจำนวน user ที่เข้ามาใช้งานได้มากขึ้น หรือสามารถรับงานที่เข้ามาได้มากขึ้น นอกจากนั้นยังมีคุณสมบัติของ Fail Over คือหากมีคอมพิวเตอร์ภายในกลุ่มไม่สามารถทำงานได้ เช่น Down อยู่ หรือไม่สามารถรับงานหรือuserเพิ่มได้เนื่องจาก resource ที่ใช้ทำงานไม่พอ ตัว Load Balancer ที่เป็นตัวแจก load ให้คอมพิวเตอร์ภายในกลุ่มก็จะส่ง load ไปยังคอมพิวเตอร์เครื่องอื่นๆแทน จนกว่าคอมพิวเตอร์เครื่องนั้นจะกลับมาใช้งานได้ใหม่

การทำงานของ Load Balancer นั้นมี 3 ลักษณะด้วยกันได้แก่

1. Round-robin เป็นการส่ง traffic ไปยัง Server ภายในกลุ่มวนไปเรื่อยๆ
2. Sticky เป็นการส่ง traffic โดยยึดติดกับ Session ที่ user เคยเข้าไปใช้งาน เช่น ถ้า user เคยเข้าไปใช้ใน server ที่ 1 ภายในกลุ่ม traffic ของ user คนนั้นก็จะถูกส่งไปยัง server 1 เท่านั้น
3. Work load เป็นการส่ง traffic โดยดูที่ performance ของ server ภายในกลุ่มเป็นสำคัญ เช่นหาก server 1 มีงานมากกว่า server 2 ตัว load balancer ก็จะส่ง traffic ไปยัง server 2


การทำ Cluster Load Balance คือการผสมผสานการทำงานทั้งสองลักษณะเข้าด้วยกัน แต่หากจะเลือกใช้การทำงานแบบนี้แล้ว การใช้ Load Balance แบบ Sticky ก็จะไม่มีความหมายไป เนื่องจาก ทุกๆ Server ภายในกลุ่มเป็น Cluster กันอยู่แล้ว ดังนั้นจึงไม่มีเหตุผลใดที่จะส่ง Traffic ไปให้เครื่องเดิมเสมออีก ควรจะทำ Load Balance แบบ Round-robin หรือ Work load แทน

Cluster คือ อะไร

ความหมายของ Cluster มีหลายความหมาย ที่แตกต่างกันไป แต่ความหมายของ Cluster Solution สำหรับ MPP จะพูดถึงการทำ HA (High Availability) เป็นหลัก คือรูปแบบลักษณะของระบบทีออกแบบมาเพื่อให้มีความคงอยู่สูง โดยมีการสนับสนุนการทำงานแทนกันในระบบ เมื่อเครื่องใดเครื่องหนึ่งเกิดผิดพลาด จะมีอีกเครื่องที่เตรียมพร้อมสำหรับการทำงานแทนทันที เหมาะสำหรับการใช้งาน ในระบบฐานข้อมูล หรือระบบที่ต้องการความมั่นคงสูง เช่น ระบบฐานข้อมูล ที่สำคัญมากๆ อย่างเช่น ระบบโรงพยาบาลที่ระบบ ต้องรันตลอด 24 ชม. จึงมีความจำเป็นที่จะต้องเพิ่ม ความมั่นคงของระบบให้มากที่สุด โดยการสร้าง Cluster ที่มีมากกว่าหนึ่งเครื่อง และ ตั้งค่าเป็นแบบ High Availability เพื่อทำให้คอมพิวเตอร์สามารถทำงานแทนกันในกรณีที่เครื่องใดเครื่องหนึ่งผิดพลาดหรือเกิดการเสียหายขึ้น โดยระบบจะยังคงทำงานได้ด้วยการทำงานของอีกเครื่องทดแทนตัวที่เสียหาย

มีประโยชน์อย่างไร

Cluster เป็นรูปแบบการรองรับการใช้งาน และการเข้าถึงจากหลายๆ โหนด โดยมีข้อมูลปลายทางเดียวกัน ซึ่งข้อมูลปลายทางจะต้องถูกเก็บอยู่ใน Share Storage หรือ SAN ( Storage Area Network ) โดยเนื้อที่สำหรับจัดเก็บจะต้องถูกแบ่งอย่างน้อย 2 Partition ที่จำเป็น ซึ่งส่วนที่จัดเก็บ คอนฟิก Cluster เรียกว่า Quorum จะทำหน้าที่ในการ เก็บค่าที่จำเป็นและสั่งให้เครื่องแต่ละโหนดทำงานภายใต้ข้อกำหนดด้านคอนฟิก ที่เหมือนกัน เป็นส่วนที่สำคัญ ถ้าส่วนนี้หายไป ระบบ Cluster จะทำงานไม่ได้ หรือจะล่มไปนั่นเอง ส่วนอีก 1 Partition จะเป็นที่จัดเก็บ Data ของระบบงาน
    ประโยชน์ที่ได้รับ คือการทำงานแบบ High Availability ซึ่งจะช่วยลดเวลา Downtime ของระบบให้น้อยลงไป สำหรับกรณีที่ระบบเกิดความเสียหายที่มีผลมาจาก Hardware ต่างๆเช่น Mainboard, CPU, Ram, Raid โดยเฉพาะปัญหาจาก Harddisk ซึ่งแม้ว่าเราจะรองรับการแก้ปัญหาด้วยการทำ Mirror แล้วก็ตามแต่บางครั้งก็ยังไม่สามารถตอบโจทย์หรือแก้ไขปัญหาดังกล่าวนี้ได้ หรือแม้กระทั่งผลที่เกิดจาก Firmware Server มีปัญหา เมื่อเกิดปัญหานี้ขึ้นมาโดยปกติเราต้องใช้เวลาสำหรับการซ่อมแซมเพื่อแก้ปัญหาดังกล่าวโดยอาจต้องใช้เวลานานตามแต่อาการ ซึ่งถ้าระบบไม่ได้ทำ Cluster แล้ว ย่อมจะหมายถึงการปิดระบบเพื่อแก้ปัญหา แต่ถ้าเป็นระบบ Cluster แล้ว ระบบจะยังคงสามารถดำเนินการต่อไปได้เพียงแค่ Server อีก Node ที่ Standby อยู่จะถูก Active ขึ้นมาทำงานโดยอัตโนมัติ ซึ่ง ผู้ใช้แทบจะไม่รู้สึกเลยว่าระบบมีปัญหาเกิดขึ้นแต่อย่างใด

องค์ประกอบของ Windows Cluster ขั้นพื้นฐาน

Hardware : Server Node 1, Node 2, AD Server, Storage เป็นอย่างน้อย
Software : Windows Standard สำหรับ AD , Windows Enterprise สำหรับ Server Node , SQL Enterprise สำหรับ Database