...

Text file src/github.com/Azure/azure-sdk-for-go/eng/common/scripts/Write-FileSystemMetrics.ps1

Documentation: github.com/Azure/azure-sdk-for-go/eng/common/scripts

     1$drives = [IO.DriveInfo]::GetDrives() | Where-Object { $_.TotalSize -gt 0 -and $_.DriveType -eq 'Fixed' -and $null -ne $_.Name }
     2
     3foreach($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}

View as plain text