Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Trying to capture the output of invoke-nasysstat and export to csv file and I'm finding that all the latency values report as 0:00:00; which is not the case when I'm looking at the "live" output. Any ideas?
RdLat | WrLat | TotLat |
0:00:00 | 0:00:00 | 0:00:00 |
0:00:00 | 0:00:00 | 0:00:00 |
0:00:00 | 0:00:00 | 0:00:00 |
Solved! See The Solution
Nevermind. Figured it out.
Nevermind. Figured it out.
What was the solution?
I was rounding the latency values as a number instead of treating it as a time value.
Here's something I used to timestamp each count:
$sample = Invoke-NaSysstat -Count 1 | Select-Object -Property @{Name = 'Time';E = {(Get-Date -Format s)}}, CPU, CIFS, RdOps, WrOps, TotOps, NetRcvd, NetSent, DiskRd, DiskWr, RdLat, WrLat,
Totlat
That'll produce something like this for $sample:
Time : 2015-10-20T22:29:18
CPU : 14.430506260567344222793527850
CIFS : 10331
RdOps : 3.9333333333333333333333333333
WrOps : 19.866666666666666666666666667
TotOps : 9570.666666666666666666666667
NetRcvd : 2639462.4
NetSent : 6981973.3333333333333333333333
DiskRd : 2114082.1333333333333333333333
DiskWr : 1854122.6666666666666666666667
RdLat : 00:00:00.0011864
WrLat : 00:00:00.0001040
TotLat : 00:00:00.0003713
And then you can see the multiple properties that RdLat contains by: ($sample.RdLat)
Which produces:
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 0
Ticks : 9264
TotalDays : 1.07222222222222E-08
TotalHours : 2.57333333333333E-07
TotalMinutes : 1.544E-05
TotalSeconds : 0.0009264
TotalMilliseconds : 0.9264
So to pull out TotalMilliseconds: ($sample.RdLat).TotalMilliSeconds
Gives you:
0.9264
Invoke-NaSysstat -Controller $ControllerObj -Count 2 | Select-Object cpu,diskrd,RdLat,WrLat|Export-Csv -Path path -Append -NoTypeInformation -NoClobber
I used this command to generate statistics in csv file