Sync eng/common directory with azure-sdk-tools for PR 2381 (#3162)
* Add disk metrics script and template * Support linux disk matrics * Add continueOnError to write-filesystemmetrics.yml Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
This commit is contained in:
parent
68c7e28523
commit
2520b2b359
@ -0,0 +1,7 @@
|
||||
steps:
|
||||
- task: Powershell@2
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Write-FileSystemMetrics.ps1
|
||||
pwsh: true
|
||||
displayName: Write filesystem metrics
|
||||
continueOnError: true
|
||||
31
eng/common/scripts/Write-FileSystemMetrics.ps1
Normal file
31
eng/common/scripts/Write-FileSystemMetrics.ps1
Normal file
@ -0,0 +1,31 @@
|
||||
$drives = [IO.DriveInfo]::GetDrives() | Where-Object { $_.TotalSize -gt 0 -and $_.DriveType -eq 'Fixed' -and $null -ne $_.Name }
|
||||
|
||||
foreach($drive in $drives) {
|
||||
$entry = [ordered]@{
|
||||
"name"= "agent_driveinfo_size_bytes";
|
||||
"value"= $drive.TotalSize;
|
||||
"timestamp"= [DateTimeOffset]::UtcNow;
|
||||
"labels"= [ordered]@{
|
||||
"name"= $drive.Name;
|
||||
"volumeLabel"= $drive.VolumeLabel;
|
||||
"driveType"= $drive.DriveType.ToString();
|
||||
"driveFormat"= $drive.DriveFormat;
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)"
|
||||
|
||||
$entry = [ordered]@{
|
||||
"name"= "agent_driveinfo_available_bytes";
|
||||
"value"= $drive.AvailableFreeSpace;
|
||||
"timestamp"= [DateTimeOffset]::UtcNow;
|
||||
"labels"= [ordered]@{
|
||||
"name"= $drive.Name;
|
||||
"volumeLabel"= $drive.VolumeLabel;
|
||||
"driveType"= $drive.DriveType.ToString();
|
||||
"driveFormat"= $drive.DriveFormat;
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user