Opened 10 years ago

Closed 9 years ago

Last modified 9 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 by Christian Franke, 10 years ago

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 by Folkert van Heusden, 10 years ago

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 by Christian Franke, 10 years ago

Milestone: undecided

comment:4 by Alex Samorukov, 9 years ago

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 by hi2u, 9 years ago

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.