osquery/third-party-smartmontools is a C++ project with 4 stars. This repository contains the smartmontools submodule used to build third-party dependencies
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
The smartmontools toolset, although comprehensive, did not provide an interface
to programatically retrieving SMART information from devices. This project
exposes smartmontools with the ability to retrieve device information and vendor
attributes as a static library. At this time, only ATA devices are supported.
The libsmartctl::Client works much like the smartctl CLI tool. You can pass
empty device type information, or explicitly pass it a hardware controller.
The client itself is a singleton, which on initialization checks the config,
initializes the SMART interface, and initializes the drive database. Current
trunk is at Release 6.6 of upstream.
Example:
#include <smartmontools/libsmartctl.h>
#include <smartmontools/smartctl_errs.h>
int main() {
// Initialize the client...
libsmartctl::Client c;
// Collect autodetected info like so...
auto resp = c.getDevInfo(devname, "");
if (resp.err != NOERR) {
// Handle the error.
std::cerr << "There was an error retrieving drive information: "
<< libsmartctl::errStr(resp.err) << "\n";
return 1;
}
// The SMART information is in the "content" field of the response structure.
for (const auto& entry : resp.content) {
// The map key is the name of the datapoint, the map value is the value
// of the datapoint.
std::cout << entry.first << ": " << entry.second << "\n"
}
// Sometimes you may need to pass in an explict mass storage controller.
// For example, lets try a MegaRAID controller (see smartctl man page for
// different controller configurations)...
for (size_t i = 0; i <= 127; i++) {
std::string fullType = "megaraid," + std::to_string(i);
// First we must we must try to ID the device with this type...
auto cantId = c.cantIdDev(devname, fullType);
if (cantId.err != NOERR) {
std::cerr << "Error while trying to identify device: "
<< libsmartctl::errStr(cantId.err) << "\n";
continue;
}
// If device is not identifiable, the type is invalid, so skip.
// NOTE: The interface gaurantees that if true, the device is not
// identifiable. If the returns False, it does not gaurantee that the
// device is identifiable.
if (cantId.content) {
continue;
}
// Now let's try to get the SMART information..
resp = c.getDevInfo(devname, fullType);
if (resp.err != NOERR) {
std::cerr << "There was an error retrieving drive information with "
"hardware driver: "
<< libsmartctl::errStr(resp.err) << "\n";
return 1;
}
// Now you can do whatever you want with the information...
...
}
To build:
$ git clone [email protected]:allanliu/smartmontools.git
$ ...
$ cd smartmontools
$ ./autogen.sh
$ ...
$ ./configure
$ ...
$ make
$ ...
$ sudo make install
$ ...
$ # Build into your project.
$ # NOTE: requires c++ 11 or higher...
$ g++ --std=c++0x -o some_bin.out test.cpp
Contents of original README
$Id$
== HOME ==
The home for smartmontools is located at:
http://www.smartmontools.org/
Please see this web site for updates, documentation, and for submitting
patches and bug reports.
You will find a mailing list for support and other questions at:
== COPYING ==
Copyright (C) 2002-9 Bruce Allen
Copyright (C) 2004-15 Christian Franke
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
You should have received a copy of the GNU General Public License (for
example COPYING). If not, see http://www.gnu.org/licenses/.
== CREDITS ==
See AUTHORS file.
== OVERVIEW ==
smartmontools contains utilities that control and monitor storage
devices using the Self-Monitoring, Analysis and Reporting Technology
(SMART) system build into ATA/SATA and SCSI/SAS hard drives and
solid-state drives. This is used to check the reliability of the
drive and to predict drive failures.
== CONTENTS ==
The suite contains two utilities:
smartctl is a command line utility designed to perform S.M.A.R.T. tasks
such as disk self-checks, and to report the S.M.A.R.T. status of
the disk.
smartd is a daemon that periodically monitors S.M.A.R.T. status and
reports errors and changes in S.M.A.R.T. attributes to syslog.
svn co http://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools smartmontools
This will create a subdirectory called smartmontools containing the code.
To instead get the 5.38 release:
svn co http://svn.code.sf.net/p/smartmontools/code/tags/RELEASE_5_38/sm5 smartmontools
You can see what the different tags are by looking at
http://sourceforge.net/p/smartmontools/code/HEAD/tree/tags/
== BUILDING/INSTALLING SMARTMONTOOLS ==
Refer to the "INSTALL" file for detailed installation instructions.
== GETTING STARTED ==
To examine SMART data from a disk, try:
smartctl -a /dev/sda
See the manual page 'man smartctl' for more information.
To start automatic monitoring of your disks with the smartd daemon,
try:
smartd -d
to start the daemon in foreground (debug) mode, or
smartd
to start the daemon in background mode. This will log messages to
SYSLOG. If you would like to get email warning messages, please set
up the configuration file smartd.conf with the '-m' mail warning
Directive. See the manual page 'man smartd' for more information.
How active is development on osquery/third-party-smartmontools?
The most recent commit recorded on osquery/third-party-smartmontools was 5.6 years ago, based on the GitHub push timestamp. The repository has 1 forks — one of the better signals of community interest.
How many stars does osquery/third-party-smartmontools have?
osquery/third-party-smartmontools has 4 GitHub stars — refresh the page for the live number, or check github.com/osquery/third-party-smartmontools. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is osquery/third-party-smartmontools open source?
Yes — osquery/third-party-smartmontools ships under the GPL-2.0 license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/osquery/third-party-smartmontools.
What is osquery/third-party-smartmontools?
osquery/third-party-smartmontools (osquery/third-party-smartmontools) is a C++ project on GitHub. From the project's own README: This repository contains the smartmontools submodule used to build third-party dependencies
Where do I read more about osquery/third-party-smartmontools?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/osquery/third-party-smartmontools is the definitive source.
Read full README in the tab above.
Want a second opinion on third-party-smartmontools?
Ask an AI that can read this page — one click and you get its take on third-party-smartmontools.