Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#501 closed enhancement (wontfix)

make smartctl into a library

Reported by: Folkert van Heusden Owned by:
Priority: minor Milestone:
Component: all Version:
Keywords: library Cc:

Description

It would be great if smartctl was functionally split into a commandline tool and a library. That library could then be linked into third party applications.
This is assuming that smartctl has no easily parseable output.

Change History (5)

comment:1 Changed 5 years ago by Christian Franke

Keywords: library added
Priority: majorminor

I agree that a library would be desirable. Implementing this would be non-trivial (e.g. refactor code for a clean C++ library interface design, provide a C-wrapper, add libtool to build files, test builds and possible regressions on all supported platforms, etc. etc.). Due to limited time and/or lack of volunteers and lack of real-world use cases that has not been done yet.

Please describe your use case.

Note that some applications already parse smartctl output.

comment:2 Changed 5 years ago by Folkert van Heusden

My use case is as follows: I'm working on a monitoring solution that, besides the main topic, also looks at a couple of system parameters.
I am also considering parsing the smartctl output but I'm a bit scared that localization might "throw soot in the food" (Dutch saying meaning that it'll interfere).

comment:3 Changed 5 years ago by Christian Franke

Milestone: undecided

comment:4 Changed 4 years ago by Alex Samorukov

Milestone: undecided
Resolution: wontfix
Status: newclosed
Version: 6.3

Closing this ticket for now - nobody willing to work on that, no clear goal (e.g. API for such library), no practical usage. Feel free to reopen if you really willing to work on this and ready to provide patches in reasonable time.

comment:5 Changed 4 years ago by hi2u

Rather than completely rebuilding smartmontools to be a library, what about just adding an option to output JSON from smartctl?

More and more command line programs are starting to add this option. It makes it super easy for anybody to integrate another program or even simple scripts. Pretty much any programming/scripting language can read JSON very easily with only a few lines of code.

A good example of another program that does this is "exiftool". Adding "-json" to the command arguments will have it output all information in a big JSON string (with pretty print so its not just one long line).

I recommend this for any command line program that outputs any kind of information. In fact considering that JSON is quite human readable anyway, I'd even suggest making it the default output format for any new program before bothering to create your own custom ascii layout.

Note: See TracTickets for help on using tickets.