hiyas
I've been running Sab 0.5 on a opensuse machine, and I have recently migrated to FreeBSD8.0 and upgraded sabnzbs to 0.5.2 at the same time.
Now, I don't know if it because of FreeBSD, or the fact that I copied the .sabnzb folder (to keep the history) from opensuse and put it in the appropriate user's folder which runs sabnzb, but after the migration I have lost the sysload (system averages) that where located at the lower right corner, next to weekly /monthly average data transfer.
I kinda miss that.. anyone know if I can get that back?
migrated and upgraded to 0.5.2, lost system averages.
Forum rules
Help us help you:
Help us help you:
- Are you using the latest stable version of SABnzbd? Downloads page.
- Tell us what system you run SABnzbd on.
- Adhere to the forum rules.
- Do you experience problems during downloading?
Check your connection in Status and Interface settings window.
Use Test Server in Config > Servers.
We will probably ask you to do a test using only basic settings. - Do you experience problems during repair or unpacking?
Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Re: migrated and upgraded to 0.5.2, lost system averages.
The most likely cause is that FreeBSD doesn't provide sysload in the way
SABnzbd expects it.
It expects the pseudo-file /proc/loadavg to contains the numbers.
This is the piece of code that does the work:
SABnzbd expects it.
It expects the pseudo-file /proc/loadavg to contains the numbers.
This is the piece of code that does the work:
Code: Select all
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 ""
Re: migrated and upgraded to 0.5.2, lost system averages.
That turned out to be exactly the case.
Thank you for pointing me in the correct direction Shypike
Turns out that FreeBSD and the other BSD's have a very limited procfs that doesn't support loadavg. heck, the BSD people say it is such a big security risk they have turned it off, and FreeBSD is working on removing it in its entirety.
Anyways, I asked the clever heads a FreeBSD forum for a solution and they came up with this piece of code, which I put inside misc.py, replacing the old code.
As you can see, it works perfectly. this is during a forkbomb. hehehe
Thank you for pointing me in the correct direction Shypike
Turns out that FreeBSD and the other BSD's have a very limited procfs that doesn't support loadavg. heck, the BSD people say it is such a big security risk they have turned it off, and FreeBSD is working on removing it in its entirety.
Anyways, I asked the clever heads a FreeBSD forum for a solution and they came up with this piece of code, which I put inside misc.py, replacing the old code.
Code: Select all
def loadavg():
command = ['sysctl', 'vm.loadavg']
try:
pipe = subprocess.Popen(command, stdout=subprocess.PIPE)
a1, a5, a15 = map(float, pipe.stdout.read().split(' ')[2:5])
return "%.2f, %.2f, %.2f" % (a1, a5, a15)
except:
return ""
Re: migrated and upgraded to 0.5.2, lost system averages.
It may work, but running an external process each time is a bit costly...
Re: migrated and upgraded to 0.5.2, lost system averages.
hey fellas, just thought it was worth mentioning here what was pointed out to me at the freebsd forums when i came up with that fix:
... the existence of os.getloadavg() ... which is a much better solution
... the existence of os.getloadavg() ... which is a much better solution
Code: Select all
import os
def loadavg():
return '%.2f, %.2f, %.2f' % os.getloadavg()
Re: migrated and upgraded to 0.5.2, lost system averages.
Thanks for the tip!
It's great when programming languages have rich libraries, it's still hard to find the function that you need.
Who would have thought this even existed...
It's great when programming languages have rich libraries, it's still hard to find the function that you need.
Who would have thought this even existed...
Re: migrated and upgraded to 0.5.2, lost system averages.
I didn't know, thats for sure! lol
I've replaced the entire loadavg section with just this
and it works like a charm!
Grump, you git! you came here from the FreeBSD forum to steal my grand finale! lol!!
I've replaced the entire loadavg section with just this
Code: Select all
def loadavg():
return "%.2f, %.2f, %.2f" % os.getloadavg()
Grump, you git! you came here from the FreeBSD forum to steal my grand finale! lol!!