toh*_*ter 5 python linux monitoring
我想编写一个python脚本来对linux服务器上运行的远程进程执行一些非常简单的"无代理"监视.
它将在伪代码中执行以下任务:
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
Run Code Online (Sandbox Code Playgroud)
一种方法是在子进程中使用python调用shell脚本并解析它们的输出.这似乎效率很低.有没有更好的方法通过python库来做到这一点?
通过这里和其他地方的研究我能找到的是:
谢谢,请放轻松我,这是我的第一个问题:-)