Web Parser for Hyper-V Bandwidth Meter Web Parser for Hyper-V Bandwidth Meter is a web-interface for Hyper-V bandwidth usage reports. Virtual machine administrators/owners can log in to the Web Parser to see their VPS/VDS bandwidth usage reports online. Web hosting provider (or Hyper-V server administrator) can see the reports for all the virtual machines at a time. Sample report: HostsTools.com Page 1
System requirements The WebParser requires IIS 7.0 (or higher) and ASP.NET 4.0 (or higher). Also it uses IIS SMTP and CDO to send email notifications. Please look at http://www.jppinto.com/2009/03/install-cdonts-mail-component-and-smtp-on-windows-server-2008/ to find out how to install the CDO on Windows 2008. Security Users must enter a secret key (password) to log in to the Web Parser. There is USERS.TXT file on the server with all the secret keys listed. The file format is: KEY:VirtualMachineName The key for the server administrator ends with :all. Like this: 18732C78731C4A3B:all This key allows to see all the reports for all the virtual machines. For security reasons we recommend to change the default key in the :all string. Installation and settings 1. Check ISAPI and CGI restrictions section in IIS setting and set Allowed for ASP.NET 4.0 2. Copy all the files from WebParser.ZIP to some folder on the server. In this document we assume that the folder is C:\web-parser\ 3. If you copied the files to C:\web-parser\ the website files is in C:\web-parser\web-parser-bwhyperv, so this is the Web Parser site home directory. 4. Open Web.config file (in C:\web-parser\web-parser-bwhyperv) with Notepad and specify the path to users.txt file in PathUsersFile section. It should be c:\web-parser\users.txt if you are going to keep the file in c:\web-parser\ folder. Example: <setting name="pathusersfile" serializeas="string"> <value>c:\web-parser\users.txt</value> </setting> 5. In PathLogsBwHyperV section of the Web.config file specify the path to the directory with the Hyper-V Bandwidth Meter log files. By default it is C:\Program Files\BwHyperV\logs\ Example: <setting name="pathlogsbwhyperv" serializeas="string"> <value>c:\program Files\BwHyperV\logs\</value> </setting> 6. Create C:\TempImageFiles folder. HostsTools.com Page 2
7. Create an IIS application pool named stats-bwhyperv and select.net 4.0 and Classic pipeline mode for this pool. 8. Go to Advanced Settings of stats-bwhyperv pool and set: Enable 32-bit Applications = True Identity = ApplicationPoolIdentity HostsTools.com Page 3
9. Create stats-bwhyperv.[yourdomainhere] site, select stats-bwhyperv pool for it, specify C:\webparser\web-parser-bwhyperv path and (for security reasons) select any available port (except 80), for example 20389. Do not forget to open this port in firewall. 10. Set main.aspx as Default Document for this site. 11. Once the site is created, go to Feature Views > IIS > Authentication > Anonymous Authentication > Action > Edit and select Application pool identity HostsTools.com Page 4
12. Now it is time to set the needed permissions. Run Windows Explorer, open C:\web-parser folder and add IIS AppPool\stats-bwhyperv user with Read(&Execute),List rights. Do the same for C:\Program Files\BwHyperV\logs folder. See the pictures below: HostsTools.com Page 5
13. Set Full Control for C:\ TempImageFiles folder: HostsTools.com Page 6
14. And also Full Control for c:\web-parser\users.txt file. 15. Add IIS AppPool\stats-bwhyperv user to IIS_IUSR group. HostsTools.com Page 7
16. Open C:\web-parser\makeusersvds.vbs script with Notepad and change CONST path parameter so it has a full path to the users.txt file. Also specify your email addresses in to_mail and cc_mail parameters. The Web Parser will send the secret key list to those email addresses. 17. Now you need to create a scheduled task for the Web Parser (so it can find the new virtual machines and create secret keys for them). Start cmd.exe and execute the following command (Please specify the server Administrator password instead of AdministratorPasswordHere) : SCHTASKS /Create /RU Administrator /RP AdministratorPasswordHere /SC DAILY /TN MakeUsersVds /TR C:\web-parser\makeusersvds.bat /RI 15 /DU 23:59 This command will create a task in Windows Task Scheduler, the task runs every 15 minutes and if a new virtual machine was created the Web Parses will generate a secret key for that machine, add it to users.txt file and send the updated list to the server administrator. The keys for the old machines stay the same. You can specify other user (if you do not want to use the Administrator one) in /RU part of the command and its password in /RP part, but first be sure that user has access permissions to Hyper-V resources and Full control on the Web Parser folders and files. 18. Wait till you get the list of the secret keys from the Web Parser by email and then tell the appropriate keys and the site URL to the virtual machine owners/admins. Do not forget to include the port to the URL. And keep the :all key in secret. HostsTools.com Page 8