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
Support getting information of remote host #336
Comments
From g.rodola on October 09, 2012 05:58:38
Status: WontFix |
I think this one actually doable and zero deploy can be used: the only requirement is for psutil to be installed on the remote machine. (and useful in lots of cases, my case is an embedded system which it's filesystem is read-only, and installing a package on the other end might take a while to get right ) |
Why would it ever make sense to bake this into psutil? If you need this functionality then write it into your application layer. |
Sounded like a common enough case. But you are right, that can be built into its own package, that depends on
|
I can understand there being potential use cases for this type of functionality. I just agree with @giampaolo that this makes no sense to be built into psutil. psutil is not intended to be a full stack monitoring solution. It is an amazingly awesome library that gives your application logic access to all the monitoring metrics. If someone needs to use the data from psutil remotely then its fairly basic stuff to write a layer in the application to handle this using existing communication protocols, RPC is an option but for remote systems with low power and low bandwidth availability something like MQTT, ZeroMQ, or even Websockets would work as well. |
Exactly: it just doesn't make sense to add any level of complexity in that sense, mainly because there's not a "blessed" protocol which can be chosen (SSH? HTTP? Whatever...?), and any solution you can think of will never be generic enough to satisfy all the possible use cases. All the types returned by psutil functions and methods are standard python types (int, list, dict, str, set, nameduple) which can be easily serialized (e.g. via JSON), transmitted over a certain protocol (e.g. HTTP) and recomposed on the remote endpoint and that is exactly what you're supposed to do if you want to get metrics from a remote host. How to transmit those metrics is entirely up to the user, not the library per se. To say one, Process.as_dict() was explicitly designed to be used in such a case (#282 and #408 comes to mind). In summary this is one of those cases where the KISS (keep it simple stupid) principle applies. =) |
Microsoft already builds this functionality into WMI. There's a WMI library for Python. I would recommend whoever needs this to actually build a remote monitoring solution using such. |
And what about poor us, which actually work with Linux ecosystems ?, but
|
On Linux it's a lot easier than on Windows which sucks for these kind of things. To say one, you can simply use SSH to send commands to the remote host which will have a python script collecting some metrics via psutil, serialize them by using JSON and print the serialized string to stdout. The stdout will be piped through, returned back to you, you deserialize it and you're done.
Replace |
From sebasma...@gmail.com on October 09, 2012 13:57:50
Original issue: http://code.google.com/p/psutil/issues/detail?id=336
The text was updated successfully, but these errors were encountered: