Hiyas
I've recently switched serving LAMP/samba/NFS/FTP from linux to FreeBSD 8.0 CURRENT on my home network and love it more and more every day but there's one thing I miss.. namely /proc/loadavg
One of the services I run on this server is SabNZBd, a automated usenet client/downloader. This Python script should display sysload status at the bottom of the page but as FreeBSD has very limited procfs support and from what I can gather, is working on removing it's support in entirely (wikipedia) I'm looking for an alternative source of load average I can inject into SabNZB.
Now. yes I know about 'sysctl vm.loadavg' but I don't know how I should go about getting that into SabNZB. besides.. executing a program every time a page is accessed has to be a bad practice
(ps: this page is accessible from the internet.)
So, I was thinking.
How about I make a cron job that executes sysctl 'vm.loadavg' once every minute and saves the output to a file, which then the SabNZB script can read?
and how can I make sysctl's output fit SabNZB, or vice versa?
I've recently switched serving LAMP/samba/NFS/FTP from linux to FreeBSD 8.0 CURRENT on my home network and love it more and more every day but there's one thing I miss.. namely /proc/loadavg
One of the services I run on this server is SabNZBd, a automated usenet client/downloader. This Python script should display sysload status at the bottom of the page but as FreeBSD has very limited procfs support and from what I can gather, is working on removing it's support in entirely (wikipedia) I'm looking for an alternative source of load average I can inject into SabNZB.
Now. yes I know about 'sysctl vm.loadavg' but I don't know how I should go about getting that into SabNZB. besides.. executing a program every time a page is accessed has to be a bad practice

(ps: this page is accessible from the internet.)
So, I was thinking.
How about I make a cron job that executes sysctl 'vm.loadavg' once every minute and saves the output to a file, which then the SabNZB script can read?
and how can I make sysctl's output fit SabNZB, or vice versa?
Code:
def loadavg():
""" Return 1, 5 and 15 minute load average of host or "" if not supported
"""
try:
loadavgstr = open('/proc/loadavg', 'r').readline().strip()
except:
return ""
data = loadavgstr.split()
try:
a1, a5, a15 = map(float, data[:3])
return "%.2f, %.2f, %.2f" % (a1, a5, a15)
except:
return ""