prometheus-community / smartctl_exporter

Export smartctl statistics to prometheus
Apache License 2.0
264 stars 78 forks source link

collect-smartctl-json: shell fixes for script (#188) #189

Closed k0ste closed 2 months ago

k0ste commented 6 months ago
Collecting data for '/dev/sda'...       Saving to sat-Intel_S4510_S4610_S4500_S4600_Series_SSDs-INTEL_SSDSC2KB240G8-sda.json
Collecting data for '/dev/sdb'...       Saving to sat-Intel_S4510_S4610_S4500_S4600_Series_SSDs-INTEL_SSDSC2KB240G8-sdb.json
Collecting data for '/dev/bus/0'...jq: error (at <stdin>:34): null (null) cannot be matched, as it is not a string
        Saving to null-null--0.json
Collecting data for '/dev/bus/0'...jq: error (at <stdin>:34): null (null) cannot be matched, as it is not a string
        Saving to null-null--0.json
Collecting data for '/dev/nvme0'...     Saving to nvme-null-HUSMR7632BHP301-nvme0.json
Collecting data for '/dev/nvme1'...     Saving to nvme-null-HUSMR7632BHP301-nvme1.json
Collecting data for '/dev/nvme2'...     Saving to nvme-null-HUSMR7632BHP301-nvme2.json
Collecting data for '/dev/nvme3'...     Saving to nvme-null-HUSMR7632BHP301-nvme3.json
Collecting data for '/dev/nvme4'...     Saving to nvme-null-HUSMR7632BHP301-nvme4.json

The /dev/bus/* is some pseudo-device comes with Broadcom driver, after fix:

Collecting data for '/dev/sda'...       Saving to sat-Intel_S4510_S4610_S4500_S4600_Series_SSDs-INTEL_SSDSC2KB240G8-sda.json
Collecting data for '/dev/sdb'...       Saving to sat-Intel_S4510_S4610_S4500_S4600_Series_SSDs-INTEL_SSDSC2KB240G8-sdb.json
Collecting data for '/dev/nvme0'...     Saving to nvme-null-HUSMR7632BHP301-nvme0.json
Collecting data for '/dev/nvme1'...     Saving to nvme-null-HUSMR7632BHP301-nvme1.json
Collecting data for '/dev/nvme2'...     Saving to nvme-null-HUSMR7632BHP301-nvme2.json
Collecting data for '/dev/nvme3'...     Saving to nvme-null-HUSMR7632BHP301-nvme3.json
Collecting data for '/dev/nvme4'...     Saving to nvme-null-HUSMR7632BHP301-nvme4.json
robbat2 commented 6 months ago

1.+1 on dropping /dev/bus; other than weird raid controllers, I can't think of anything we need in there, that's captured in Linux source tree anyway.

  1. Should we allow-list the acceptable name characters rather than replace specific ones? [A-Za-z0-9._+*,-] would be my first-pass on allowed chars.
k0ste commented 5 months ago

@NiceGuyIT