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

Add 1-Wire sensor monitoring #3822

Merged
merged 1 commit into from Jun 15, 2018

Conversation

Projects
None yet
4 participants
@dspinellis
Contributor

dspinellis commented Jun 14, 2018

Auto-detect and display data from multiple 1-Wire temperature sensors.
Sensor names are user-configurable.

@dspinellis

This comment has been minimized.

Contributor

dspinellis commented Jun 14, 2018

1-wire

Here is an image of the resultant dashboard.

'absolute', 1, 10])
self.definitions['temp']['lines'] = lines
return len(self.probes) > 0
except Exception as error:

This comment has been minimized.

@ilyam8

ilyam8 Jun 14, 2018

Member

Some suggestions:

  1. Make exception more specific
  2. Remove all code from try/except block which can not cause an exception

Like:

try:
    filenames = os.listdir(W1_DIR)
except OSError as err:  # i believe we only need OSError here, but i am not sure
    self.error(err)
    return None

...
...

This comment has been minimized.

@dspinellis

dspinellis Jun 14, 2018

Contributor

Done.

value = round(int(matched.group(1)) / 1000., 1)
value = int(value * 10)
data['w1sensor_temp_' + identifier] = value
except Exception as error:

This comment has been minimized.

@ilyam8

ilyam8 Jun 14, 2018

Member

please make exception more specific

This comment has been minimized.

@dspinellis

dspinellis Jun 14, 2018

Contributor

Done.

@ilyam8

This comment has been minimized.

Member

ilyam8 commented Jun 14, 2018

@dspinellis thanks for the contribution 👍

@dspinellis

This comment has been minimized.

Contributor

dspinellis commented Jun 14, 2018

Thanks! I pushed a commit addressing your comments. I can then squash the commits when the PR passes code review.

value = round(int(matched.group(1)) / 1000., 1)
value = int(value * 10)
data['w1sensor_temp_' + identifier] = value
except OSError as err:

This comment has been minimized.

@ilyam8

ilyam8 Jun 14, 2018

Member

add IOError here

This comment has been minimized.

@dspinellis

dspinellis Jun 14, 2018

Contributor

Right, done!

@ilyam8

ilyam8 approved these changes Jun 14, 2018

@dspinellis dspinellis force-pushed the dspinellis:w1sensor branch from 4c074a6 to d4e3318 Jun 14, 2018

@dspinellis

This comment has been minimized.

Contributor

dspinellis commented Jun 14, 2018

I squashed my commits following your approval of the changes.

# default module values (can be overridden per job in `config`)
update_every = 5
priority = 60000
retries = 60

This comment has been minimized.

@Ferroin

Ferroin Jun 14, 2018

Member

Unless I'm mistaken, you're using the same number of retries as the default, in which case this line can probably be removed.

This comment has been minimized.

@ilyam8

ilyam8 Jun 14, 2018

Member

Yes, retries and priority can be removed since it is current default

This comment has been minimized.

@dspinellis

dspinellis Jun 14, 2018

Contributor

Thank you; I removed them.

@Ferroin

Beyond the one codre comment I left (which isn't really critical), looks good to me.

@ilyam8

This comment has been minimized.

Member

ilyam8 commented Jun 14, 2018

@dspinellis please do a rebase

Add 1-Wire temperature sensor monitoring
Multiple 1-Wire temperature sensors are auto-detected and monitored.
Displayed sensor names are user-configurable.

@dspinellis dspinellis force-pushed the dspinellis:w1sensor branch from d4e3318 to 71a0d4d Jun 14, 2018

@dspinellis

This comment has been minimized.

Contributor

dspinellis commented Jun 14, 2018

I rebased and squashed the commit to remove the unneeded default values.

@ktsaou

This comment has been minimized.

Member

ktsaou commented Jun 15, 2018

Well done!
Thank you @dspinellis !

@ktsaou ktsaou merged commit 9598db2 into netdata:master Jun 15, 2018

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Ferroin Ferroin referenced this pull request Aug 27, 2018

Closed

Netdata release #4081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment