Skip to content

Commit b19ea8f

Browse files
azure-sdkhallipr
andauthored
Sync eng/common directory with azure-sdk-tools for PR 2381 (Azure#25731)
* Add disk metrics script and template * Support linux disk matrics * Add continueOnError to write-filesystemmetrics.yml Co-authored-by: Patrick Hallisey <[email protected]>
1 parent d25ff0a commit b19ea8f

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
steps:
2+
- task: Powershell@2
3+
inputs:
4+
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Write-FileSystemMetrics.ps1
5+
pwsh: true
6+
displayName: Write filesystem metrics
7+
continueOnError: true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
$drives = [IO.DriveInfo]::GetDrives() | Where-Object { $_.TotalSize -gt 0 -and $_.DriveType -eq 'Fixed' -and $null -ne $_.Name }
2+
3+
foreach($drive in $drives) {
4+
$entry = [ordered]@{
5+
"name"= "agent_driveinfo_size_bytes";
6+
"value"= $drive.TotalSize;
7+
"timestamp"= [DateTimeOffset]::UtcNow;
8+
"labels"= [ordered]@{
9+
"name"= $drive.Name;
10+
"volumeLabel"= $drive.VolumeLabel;
11+
"driveType"= $drive.DriveType.ToString();
12+
"driveFormat"= $drive.DriveFormat;
13+
}
14+
}
15+
16+
Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)"
17+
18+
$entry = [ordered]@{
19+
"name"= "agent_driveinfo_available_bytes";
20+
"value"= $drive.AvailableFreeSpace;
21+
"timestamp"= [DateTimeOffset]::UtcNow;
22+
"labels"= [ordered]@{
23+
"name"= $drive.Name;
24+
"volumeLabel"= $drive.VolumeLabel;
25+
"driveType"= $drive.DriveType.ToString();
26+
"driveFormat"= $drive.DriveFormat;
27+
}
28+
}
29+
30+
Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)"
31+
}

0 commit comments

Comments
 (0)