Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 4e30a7a500
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (19 sloc) 0.597 kb
import os.path
from porkchop.plugin import PorkchopPlugin
class LoadavgPlugin(PorkchopPlugin):
def get_data(self):
script = '/proc/loadavg'
if not os.path.exists('/proc/loadavg'):
return {}
with open(script, 'r') as f:
fields = f.read().strip().split()
procs = fields[3].split('/')
return {
'shortterm': fields[0],
'midterm': fields[1],
'longterm': fields[2],
'processes': {
'scheduled': procs[0],
'total': procs[1]
}
}
Jump to Line
Something went wrong with that request. Please try again.