I'd like to write a python script to perform some very simple "agentless" monitoring of remote processes running on linux servers.
It would perform the following tasks, in psuedocode:
for each remoteIPAddress in listOfIPAddresses:
log into server@remoteIPAddress via ssh
execute the equivalent of a 'ps -ef' command
grep the result to make sure a particular process (by name) is still running
One way to do this is to have python call shell scripts in a subprocess and parse their output. That seems pretty inefficient. Is there a better way to do this via python libraries?
All I could find via research here and elsewhere was:
- psutil - looks like it doesn't do remote monitoring, so I'd have to run agents on the remote machines to report stats back via RPC.
- pymeter - I would have to write my own plugin for monitoring a specific remote service.
- stackoverflow #4546492 - Some helpful links but the poster was looking for a different solution.
Thanks, and please go easy on me, it's my first question :-)