Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Truenas SNMP exporter

09 Oct 2021 »

zpoolDescr #.3 = STRING: oricoA
zpoolSize #.1 = INTEGER: 25034752
zpoolUsed #.1 = INTEGER: 366581
zpoolAvailable #.4 = INTEGER: 899712777
zpoolHealth # online(0), degraded(1), faulted(2), offline(3), unavail(4), removed(5)

zvolDescr #.1 = STRING: nvme/esxi6-flash-ds
zvolSize #.1 = INTEGER: 131072004
zvolUsed #.1 = INTEGER: 12742140
zvolAvailable #.1 = INTEGER: 208719694
zvolReferenced #.1 = INTEGER: 7553203

datasetDescr #.1 = STRING: boot-pool/ROOT
datasetSize #.1 = INTEGER: 24251018
datasetUsed #.1 = INTEGER: 365180
datasetAvailable #.1 = INTEGER: 23885838

hddTempDevice # string da0 da1 ada0 nvd0
hddTempValue # 41000


zfsArcSize #.0 = Gauge32: 26288777
zfsArcMeta #.0 = Gauge32: 638834
zfsArcData #.0 = Gauge32: 25647720
zfsArcHits #.0 = Gauge32: 2127255356
zfsArcMisses #.0 = Gauge32: 24503533
zfsArcC #.0 = Gauge32: 26335347
zfsArcP #.0 = Gauge32: 24565288
zfsArcMissPercent #.0 = STRING: 0.22811610704906116
zfsArcCacheHitRatio #.0 = STRING: 99.77
zfsArcCacheMissRatio #.0 = STRING: 0.23
zfsL2ArcHits #.0 = Counter32: 4629098
zfsL2ArcMisses #.0 = Counter32: 19863879
zfsL2ArcRead #.0 = Counter32: 40120202
zfsL2ArcWrite #.0 = Counter32: 3900941555
zfsL2ArcSize #.0 = Gauge32: 205686406

prometheus.yml

scrape_configs:
  - job_name: 'truenas'
    scrape_interval: 15s
    static_configs:
      - targets:
        - 127.0.0.1:9117
    metrics_path: /snmp
    params:
      module: [freenas]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance 
      - target_label: __param_target
        replacement: truenas2

global:
  external_labels:
    origin_prometheus: prometheus01

remote_write:
  - url: https://prometheus-prod-10-prod-us-central-0.grafana.net/api/prom/push
    basic_auth:
      username: <username>
      password: eyJrIjoiN2Y2ZjUyN2ZiZTA

generator.yml

modules:
  freenas:
    auth:
      community: public
    walk:
    - zpoolDescr
    - memTotalFree
    - memTotalReal
    - memAvailReal
    #- ssCpuRawIdle
    - ssCpuIdle
    - laEntry # load average
    # host resource metrics
    - hrSystemUptime
    - hrSystemProcesses
    - hrSystemMaxProcesses
    - hrMemorySize
    - hrStorageSize
    - hrStorageUsed
    - hrProcessorLoad # non idle percent past minute
    # interface metrics
    - ifAdminStatus # 1=up,2=down,3=testing
    - ifOperStatus # 1=up,2=down,3=testing,4=unknown,5=dormant,6=notPresent,7=lowerLayerDown
    - ifLastChange
    - ifInDiscards
    - ifInErrors
    - ifOutDiscards
    - ifOutErrors
    - ifHCInOctets
    - ifHCOutOctets
    # tcp metrics
    - tcpMaxConn
    - tcpActiveOpens
    - tcpPassiveOpens
    - tcpEstabResets
    - tcpCurrEstab
  #- zpoolDescr #.3 = STRING: oricoA
    - zpoolSize #.1 = INTEGER: 25034752
    - zpoolAllocationUnits
    - zpoolUsed #.1 = INTEGER: 366581
    - zpoolAvailable #.4 = INTEGER: 899712777
    - zpoolHealth # online(0), degraded(1), faulted(2), offline(3), unavail(4), removed(5)

  #- zvolDescr #.1 = STRING: nvme/esxi6-flash-ds
    - zvolSize #.1 = INTEGER: 131072004
    - zvolUsed #.1 = INTEGER: 12742140
    - zvolAllocationUnits
    - zvolAvailable #.1 = INTEGER: 208719694
    - zvolReferenced #.1 = INTEGER: 7553203

    #- datasetDescr #.1 = STRING: boot-pool/ROOT
    - datasetAllocationUnits
    - datasetSize #.1 = INTEGER: 24251018
    - datasetUsed #.1 = INTEGER: 365180
    - datasetAvailable #.1 = INTEGER: 23885838

      #- hddTempDevice # string da0 da1 ada0 nvd0
    - hddTempValue # 41000


    - zfsArcSize #.0 = Gauge32: 26288777
    - zfsArcMeta #.0 = Gauge32: 638834
    - zfsArcData #.0 = Gauge32: 25647720
    - zfsArcHits #.0 = Gauge32: 2127255356
    - zfsArcMisses #.0 = Gauge32: 24503533
    - zfsArcC #.0 = Gauge32: 26335347
    - zfsArcP #.0 = Gauge32: 24565288
    - zfsArcMissPercent #.0 = STRING: 0.22811610704906116
    - zfsArcCacheHitRatio #.0 = STRING: 99.77
    - zfsArcCacheMissRatio #.0 = STRING: 0.23
    - zfsL2ArcHits #.0 = Counter32: 4629098
    - zfsL2ArcMisses #.0 = Counter32: 19863879
    - zfsL2ArcRead #.0 = Counter32: 40120202
    - zfsL2ArcWrite #.0 = Counter32: 3900941555
    - zfsL2ArcSize #.0 = Gauge32: 205686406
  #version: 1
    #lookups:
    #- old_index: ifIndex
    #  new_index: ifName
    lookups:
      - source_indexes: [ifIndex]
        lookup: ifName
      - source_indexes: [zvolIndex]
        lookup: zvolDescr
      - source_indexes: [zpoolIndex]
        lookup: zpoolDescr
      - source_indexes: [datasetIndex]
        lookup: datasetDescr 
      - source_indexes: [hddTempIndex]
        lookup: hddTempDevice
      - source_indexes: [laIndex] #loadAverageIndex
        lookup: laNames
      - source_indexes: [hrStorageIndex] 
        lookup: hrStorageDescr
      - source_indexes: [hrDeviceIndex] 
        lookup: hrDeviceDescr

Issue zpool size miscalculation

https://www.truenas.com/community/threads/snmp-incorrect-values-when-calculating-pool-size-values.87638/