matusnovak / prometheus-smartctl

HDD S.M.A.R.T exporter for Prometheus written in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SCSI endpoints

gkovelman opened this issue · comments

Hi,
Any plans on supporting SCSI datapoints?
It would be very useful for my use case with monitoring temperatures and data errors.

I don't know if you have a way to test the code, so here's sample query from my device with smartctl --all -d scsi /dev/sda --json: https://pastebin.com/KeUGciwp.
I can also contribute a PR if there are guidelines.

Hi @gkovelman

If you could make a PR that would be really great. I would appreciate that.

There are no coding guidelines. Simply follow what is already in the Python file, that's it. If you need re-structure the code in order to fit yours, that's fine too.

The only guideline I would have is that the nested items, such as these ones:

{
   ...
   "user_capacity": {
    "blocks": 11721045168,
    "bytes": 6001175126016
  }
}

Should produce these metrics:

user_capacity_blocks{drive="/dev/sda"}
user_capacity_bytes{drive="/dev/sda"}

One more thing I would like to add, if you decide to make a PR, is to create gauges (from prometheus_client import Gauge or other types) on demand.

I have found out that not all metrics are reported by smartctl and it also depends on the manufacturer of that drive. So creating them when a new key is found in the JSON output would be great. A very simple implementation is already done by checking for existing metrics in METRICS global variable.

Thanks to #8 the SCSI endpoints are now available. Use docker image tag v1.3.0 or newer.