Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 5, 2024

Conversation

k0ste
Copy link
Contributor

@k0ste k0ste commented Dec 30, 2023

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

* Remove `"`, `(` and `)` from file names (see prometheus-community#188)
* Added regex ignore for some devices, fixes:

```
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
```

Signed-off-by: Konstantin Shalygin <[email protected]>
@k0ste k0ste mentioned this pull request Dec 30, 2023
@robbat2
Copy link
Contributor

robbat2 commented Dec 30, 2023

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
Copy link
Contributor Author

k0ste commented Jan 25, 2024

@NiceGuyIT

@NiceGuyIT NiceGuyIT merged commit bcd3a7d into prometheus-community:master May 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants