开发者

Python and Server Load

开发者 https://www.devze.com 2023-01-24 07:35 出处:网络
Is there a way, using Python, to check the s开发者_JAVA百科erver load of a Linux machine periodically and inform me of it in some way?Python has a function to get the system\'s load average as part of

Is there a way, using Python, to check the s开发者_JAVA百科erver load of a Linux machine periodically and inform me of it in some way?


Python has a function to get the system's load average as part of the os module

>>> import os
>>> os.getloadavg()
(1.1200000000000001, 1.0600000000000001, 0.79000000000000004)

From there, you can do whatever checks you need, and then email you, or similar.


os.getloadavg()

0

精彩评论

暂无评论...
验证码 换一张
取 消