Monad (PowerShell) functions for simple monitoring of current TFVC server requests
This isn't exposed via our object model, but we have a couple of web methods exposed via VersionControl/v1.0/Administration.asmx that give you the current requests, optionally with the details of the request (QueryServerRequests, QueryServerRequestsWithDetails).
Using Monad's built-in xml adaptor, we can still leverage these calls. Here's a few simple functions for monitoring what's currently going on with the TFVC server.
If you want to be able to run these against your TFVC server on a machine other than the server itself, you'll need to edit the file [TF Server Install Dir]\Web Services\web.config and in the webServices section change the 2 "remove" strings to "add" to allow post/get access (well, at least the HttpGet one).
In each of the functions, I used the full name to help make it clear what's going on (format-table instead of ft, clear-host instead of clear, start-sleep instead of sleep, etc.).
Caveat: there's likely a better way to do this - I just needed something quick.
function requests_raw
{
param ([string]$server = "localhost")
$wc = new-object System.Net.WebClient
$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$url = "https://$($server):8080/VersionControl/v1.0/administration.asmx/QueryServerRequests"
$x = [xml]$wc.DownloadString($url)
$x.arrayofanytype.anytype
}
function requests
{
param ([string]$server = "localhost")
requests_raw $server | sort -descending executiontime | format-table -auto user,webmethod,executiontime,serverprocessid
}
function watch_requests
{
param ([string]$server = "localhost", [int]$sleep_time = 300)
for (;;) { clear-host ; requests $server ; start-sleep $sleep_time }
}