VolumeNames disk telegraf exec


I have a w10 pro with telegraf-influx-grafana
I need to send to influxdb the disk name example
C: “Local”
D: “Data”
Now with the telegranf.conf only i get the instance (letter C,D, etc)
I put this part of code:

    # Disk times and queues
    ObjectName = "LogicalDisk"
    Instances = ["*"]
    Counters = [
      "% Idle Time",
      "% Disk Time",
      "% Disk Read Time",
      "% Disk Write Time",
      "% User Time",
      "% Free Space",
      "Current Disk Queue Length",
      "Free Megabytes",
      "Disk Read Bytes/sec",
      "Disk Write Bytes/sec",
      "Avg. Disk Queue Length",
      "Split IO/Sec"
    Measurement = "win_disk"
    # Set to true to include _Total instance when querying for all (*).

I make a shell script and try to get the names, seems work if i send to a csv but i dont sure how send to influx

$disks = Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, VolumeName

foreach ($disk in $disks) {
    $volumeName = $disk.Label
    Write-Output $volumeName


I dont sure if it is correct, i dont use shellscript usually…
I would like the “volumeName” go to win_disk measurement as a tag but i dont sure if is even possible…is ok to another measurement
The conf to telegraf to execute the script is

  interval = "3h"
  commands = [
     'powershell "C:\telegraf\telegraf.d\get_info.ps1"'
  timeout = "2m"
  data_format = "influx"

Nobody knows how send disk mames/labels to influx ?

If you could provide the CSV it generates and what metric you expect it would be helpful. Then someone could look at how it is getting parsed.

If you only have these two drives as well and you are running this on one system, you might also consider the enum processor you could have it add a tag for the values of “C” → “local” and “D” → “data”.

Thank you for your answer, i would like no use the csv and send the data direct to inlux

# Configuración de InfluxDB

$measurement = 'prueba_disco_powershell'

# Obtener los datos de los discos
$disks = Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, VolumeName, Size, FreeSpace, FileSystem

$data = @()

foreach ($disk in $disks) {
    $point = @{
        measurement = $measurement
        tags = @{
            Instance = $disk.DeviceID
            Name = $disk.VolumeName
            FileSystem = $disk.FileSystem
            Host = $env:COMPUTERNAME
        fields = @{
            Size = $disk.Size
            FreeSpace = $disk.FreeSpace
    $data += $point

# Convertir la lista de puntos de datos a JSON
$jsonData = $data | ConvertTo-Json -Depth 100

# Configurar la URL de la API HTTP de InfluxDB
# -ContentType "application/json"

Invoke-WebRequest '' -Method POST -Body $jsonData

but show my the error 400 bad request

This is not even using telegraf :wink:

If you wanted to pass this output to telegraf you would output your line protocol-based points to stdout versus sending it via a web request.