问题
I am investigating a way to access remotely statistics about a linux server, the kind of information that conky would display.
Is there a way to interface with conky and obtain the statistics it displays? If not, can you recommend a good way to obtain this kind of statistics? (C/Cpp lib, or maybe python)?
回答1:
You could have conky write to stdout (the out_to_console
option) and redirect that to a file. Of course you'd still need to gain external access to the file.
Conky gets most of its data from the files in sysfs
and procfs
. You could write a program that gathers the information you need from there and puts it on a webpage that you can read remotely (assuming the server runs a webserver).
Edit: According to this the file format in sysfs
files is really simple; there is only one floating point value (as text) per file.
来源:https://stackoverflow.com/questions/15691761/conky-interface