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

Add new module for SMART monitoring #397

Closed
fonic opened this issue May 29, 2017 · 5 comments
Closed

Add new module for SMART monitoring #397

fonic opened this issue May 29, 2017 · 5 comments
Labels
enhancement Issue that suggests an enhancement Stale Issue that requires attention because it hasn't been updated for over a year

Comments

@fonic
Copy link
Contributor

fonic commented May 29, 2017

I'm thinking about creating a new module for SMART disk monitoring. As far as I can tell, there are three options to implement this:

  • calling smartctl (smartmontools)
  • interfacing libatasmart
  • interfacing udisks using DBUS communications

I'd prefer to use libatasmart as this would add native support with only a single additional dependency.

Does anyone know if it is possible to use libatasmart without root privileges?

@su8
Copy link
Collaborator

su8 commented Jun 23, 2017

libatasmart

#include <stdio.h>
#include <string.h>
#include <errno.h>

#include <atasmart.h>

int main(void) {
  uint64_t mkelvin = 0;
  const char *device = "/dev/sda";
  SkDisk *d = NULL;

  if (-1 == (sk_disk_open(device, &d))) {
    fprintf(stderr, "Failed to open disk %s: %s\n", device, strerror(errno));
    return 1;
  }

  if (-1 == (sk_disk_smart_read_data(d))) {
    fprintf(stderr, "Failed to read SMART data: %s\n", strerror(errno));
    goto finish;
  }

  if (-1 == (sk_disk_smart_get_temperature(d, &mkelvin))) {
    fprintf(stderr, "Failed to get temperature: %s\n", strerror(errno));
    goto finish;
  }

  printf("%llu\n", (unsigned long long)mkelvin);

finish:
  if (NULL != d) {
    sk_disk_free(d);
  }
  return 0;
}

smartmontools are cross-platform available and the *BSD flavours would benefit from it too.

Those like me that do not use init systemd will be forced to install additional dependencies.

@su8
Copy link
Collaborator

su8 commented Jun 23, 2017

Does anyone know if it is possible to use libatasmart without root privileges?

visudo

computer_name ALL=NOPASSWD:/usr/bin/program_name

@lasers lasers added the enhancement Issue that suggests an enhancement label Aug 5, 2018
@lasers
Copy link
Contributor

lasers commented Aug 31, 2018

@fonic OMFG. I can't wait to see this implemented. 😱

Copy link

github-actions bot commented Nov 8, 2023

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.

@github-actions github-actions bot added the Stale Issue that requires attention because it hasn't been updated for over a year label Nov 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

This issue was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue that suggests an enhancement Stale Issue that requires attention because it hasn't been updated for over a year
Projects
None yet
Development

No branches or pull requests

3 participants