All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hardware.DiskPart.DiskPart.yaml Maven / Gradle / Ivy

The newest version!
---
extends:
- ../Hardware/Hardware
connector:
  displayName: Windows - DiskPart
  platforms: Any system
  reliesOn: The DISKPART.EXE command-line utility
  information: This connector discovers and monitors the logical disks in a Microsoft Windows system through the DISKPART.EXE utility.
  version: 1.0
  detection:
    appliesTo:
    - NT
    criteria:
    # OS should be Windows
    - type: deviceType
      keep:
      - NT
    # Diskpart must be int he path and return something meaningful. Please note that we're using CHCP 437 to make sure the locale is English.
    - type: commandLine
      commandLine: CHCP 437&&DISKPART.EXE /S ${file::exit.txt}
      expectedResult: Leaving DiskPart
      timeout: 120
    tags: [ hardware, windows ]
monitors:
  logical_disk:
    discovery:
      sources:
        source(1):
          # Source(1) = DISKPART.EXE running "list volume" and "exit
          type: commandLine
          commandLine: CHCP 437&&DISKPART.EXE /S ${file::listVolume.txt}
          timeout: 120
          computes:
            # Run Source(1) through an AWK script
            # ID;Label;Letter;VolumeType;FileSystem;Size;Status;MoreInformation
          - type: awk
            script: ${file::diskPart.awk}
            separators: ;
            keep: ^MSHW;
            selectColumns: 2,3,4,5,6,7,8,9
            # Exclude DVDs and stupid stuff
            # ID;Label;Letter;VolumeType;FileSystem;Size;Status;MoreInformation
          - type: excludeMatchingLines
            column: 4
            valueList: CD-ROM,DVD-ROM,Removable
          - type: prepend
            column: 5
            value: "File System: "
          - type: prepend
            column: 8
            value: "Volume Information: "
      mapping:
        # The InstanceTable
        source: ${source::monitors.logical_disk.discovery.sources.source(1)}
        attributes:
          id: $1
          __display_id: $2
          raid_level: $4
          info: ${awk::join(" ", $5, $8)}
          hw.parent.type: enclosure
          name: ${awk::sprintf("%s (%s - %s)", $2, $4, bytes2HumanFormatBase2($6))}
        metrics:
          hw.logical_disk.limit: $6
    collect:
      # Collection is multi-instance
      type: multiInstance
      keys:
      - id
      sources:
        source(1):
          # Source(1) = DISKPART.EXE running "list volume" and "exit
          type: commandLine
          commandLine: CHCP 437&&DISKPART.EXE /S ${file::listVolume.txt}
          timeout: 120
          computes:
            # Run Source(1) through an AWK script
            # ID;Status;
          - type: awk
            script: ${file::diskPart.awk}
            separators: ;
            keep: ^MSHW;
            selectColumns: 2,8
            # Duplicate the status column
            # ID;Status;Status
          - type: duplicateColumn
            column: 2
            # Now translate Status to Patrol Status
            # status
          - type: translate
            column: 2
            translationTable: ${translation::LogicalDiskTranslationTable}
      mapping:
        # ValueTable = Source(1)
        source: ${source::monitors.logical_disk.collect.sources.source(1)}
        attributes:
          id: $1
        metrics:
          hw.status{hw.type="logical_disk"}: $2
        legacyTextParameters:
          StatusInformation: $3
translations:
  LogicalDiskTranslationTable:
    Resynching: degraded
    Unknown: failed
    Failed: failed
    Formatting: ok
    Failed Rd: degraded
    Failed Redundancy: degraded
    Default: UNKNOWN
    Healthy: ok
    Regenerating: degraded
    Rebuild: degraded




© 2015 - 2024 Weber Informatics LLC | Privacy Policy