Hddtemp, Don't Report non-SMART Devices

Hi,

I got hddtemp up and running (using check_mk). All works fine, but for my DVD writer, I get the following from hddtemp,
/dev/sr0: TSSTcorp CDDVDW SH-S203N : S.M.A.R.T. not available

So then this device always shows up with a temperature of 0C in LibreNMS. I’d like to remove it (not really valid data) … I don’t care if hddtemp drops it, or if it’s filtered in LibreNMS - either one is fine. Is there a way to do this?

Thanks!

I don’t know how to remove that from the code. But you could go to settings of the device then Health and blank out the High and Low values.

Yep, no alarms then, but the non-existent item still shows up in Health … right?

I don’t mind taking a stab at it, but to make sure we’re on the same page - I’m thinking nothing should be reported (through hddtemp) for devices that don’t support it. Agreed?

Thanks!

sure take stab at it and submit PR. :slight_smile:

OK, seems it’s just a one-liner … or really, just a minor change to 1 line. I don’t have a fork (for a PR) of the repository, are you able to submit this?

Here is the change, in hddtemp. Change,
content=echo "$output" | awk -F": " 'BEGIN{ ORS="" }{ print "|"$1"|"$2"|"$3"|";} ' | sed 's/[° ]C|/|C|/g' | sed 's/[° ]F|/|F|/g' | tr -cd '\12\14\40-\176'

to,
content=echo "$output" | awk '{ if ($0 !~ /not available/) { print $0 } }' | awk -F": " 'BEGIN{ ORS="" }{ print "|"$1"|"$2"|"$3"|";} ' | sed 's/[° ]C|/|C|/g' | sed 's/[° ]F|/|F|/g' | tr -cd '\12\14\40-\176'

So just adding the test for “not available”. Tried it out here, works perfectly. In my log now,
Sensor Deleted: temperature hddtemp 2 /dev/sr0: Optiarc DVD RW AD-7280S

And the non-existent sensor goes away.

Thanks!

you should be able to find what file need to edit in the repo and it will allow you to fork it and edit then you can push PR.

OK, done! PR #153.

Thanks!

I don’t think you submitted to the LibreNMS repo

Correct - I submitted to librenms-agent … is that not right?

ah okay no that is right. my bad.

NP! Figured I had it messed up … :wink: