One of the few missing features of Provisioning Services is a write cache of central monitoring center PVS, which measures the file size Write Cache Target Side (Cache settings on the HD customer) from a central location. It would be very useful for POC and pilots to estimate the storage requirements for the final infrastructure as well as trend analysis during normal operations.
As such functionality does not require huge coding skills, I spent some time today the development of a small tool that should help until we get as a feature of building appropriate PVS.
I am aware that there are several ways to do this and most of them are much more elegant than I do, but I tried to find the simplest approach. So I decided to go for the good old Windows batch script, which is understood by most admins out there and work ... J
So, the tool consists of two scripts and a file with all the goals we 'want to monitor. Scripts are:
- Check_Write_Cache_Size.cmd , which reads targets.txt file line by line and calls the working script (of worker.cmd) with a parameter the location of the write cache file (default is d :. vdiskcache) and a second parameter that contains the name of the current target. Once the script has gone through all the targets, it will pause for 15 seconds and repeat.
- Worker.cmd , which just reads .vdiskcache file size (in bytes) and written together with a certain time and date information in a csv file. Hereby, it will create a single file for each target device (which is why we pass the computer name as the second parameter)
Both scripts assume to live inside C :. Temp. If you do not want to, just modify the relevant sections within scripts. Also, you must run the scripts with administrative user who is able to access the share target of $ peripherals. Finally, you must include all the goals you want to monitor in the Targets.txt file. Each target needs to be on a single line. Below is an example of Targets.txt:
Targets.txt
Windows7PVS001
Windows7PVS002
Windows7PVS003
to start the monitoring, it is easier to start a command prompt as an administrator (in case you use UAC) and move your prompt in the C: Temp. Then just call the Check_Write_Cache_Size.cmd script.
The following scripts, but please keep in mind that you need to be tested before running them in production. Also please check the disclaimer at the end of the blog:
Check_Write_Cache_Size.cmd
ECHO OFF
: Start
for / F %% i in (C: temp targets.txt) does cmd / Q /cc:tempworker.cmd %% i . d $ vdiskcache %% i
TIMEOUT / T 15 / NOBREAK
goto: Start
Worker.cmd
echo off
echo% date%% time%% ~ z1 >> C: temp 2.csv%
After stopping the script, you should see a single .csv file for each target. Everyone should look like the one below (please note that the size is in bytes):
Windows7PVS001.csv
Fri 11/04/2011 ; 9: 10: 00.65; 25811403
Fri, 04/11/2011; 9: 10: 15.33; 258 114 03
Fri 11/04/2011; 9: 10: 30.32; 265 324 452
Fri 11/04/2011; 9: 10: 45.33; 265328635
Fri, 04/11/2011; 9: 11: 00.32; 265328635
Fri, 04/11/2011; 9: 11: 15.31; 265 328 635
Fri 11/04/2011; 9: 11: 30.33; 273693421
Fri, 04/11/2011; 9: 11: 45.31; 273 720 012
Now just open Excel and import the csv. Be sure to mark the semicolon as separator. Now you should be able to create good little graphic on the size of the write cache.
If you would like more information on the PVS Write Cache, check my recent blogs (here and here).
Denial of
This code / software sample is provided "AS IS" without representation, warranty or condition of any kind. You can use, modify and distribute at your own risk. CITRIX DISCLAIMS ALL WARRANTIES, EITHER EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software code / sample can introduce errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (B) it may not be possible to make the / example of fully functional software code; and (c) Citrix may, without notice or liability to you, cease to provide the current version and / or all future versions of the software code / sample. In any case, the software / code should be used to support ultra-hazardous activities, including but not limited to life support or blasting operations. CITRIX, ITS AFFILIATES OR AGENTS BE LIABLE FOR BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THE CODE software / SAMPLE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the software / code belongs to Citrix, any distribution of the code should include only your own standard award of copyright, and not that of Citrix. You agree to indemnify and defend Citrix against any claim arising from your use, modification or distribution of the code.
0 Komentar