Page 1 of 2
server load on bottom of page
Posted: October 2nd, 2008, 10:12 am
by steve51184
i think having the server load at the bottom of the page would be a good feature
from:
Download Dir: 0 GB - Complete Dir: 0 GB - Download speed: 0 KB/s - Queued: 0.00/0.00 MB
0 articles buffered in 0 bytes
to:
Download Dir: 0 GB - Complete Dir: 0 GB - Download speed: 0 KB/s - Queued: 0.00/0.00 MB - Server Load: 0.00
0 articles buffered in 0 bytes
Re: server load on bottom of page
Posted: October 2nd, 2008, 12:05 pm
by shypike
What's the "server load"?
Re: server load on bottom of page
Posted: October 2nd, 2008, 12:13 pm
by steve51184
server load is the load of the server.. how do you not know what this is? :\
for more info go here:
http://en.wikipedia.org/wiki/Load_(computing)
server load in php:
Code: Select all
<?php
$loadresult = @exec('uptime');
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$loadresult,$avgs);
$data .= "Server Load: $avgs[1], $avgs[2], $avgs[3]\n";
echo $data;
?>
server load in python:
Code: Select all
import commands
a = commands.getoutput("uptime")
print a
Re: server load on bottom of page
Posted: October 2nd, 2008, 4:42 pm
by shypike
Depends on what you think the server is.
SABnzbd's webserver, the server hosting SABnzbd, the Usenet server connected, whatever.
I see what you mean. Somehow it's a bit of a limited audience that would want it (also Linux-only).
I'm not sure about the usefulness of this, I'll discuss it with the team.
Also, launching an external program (uptime) every few seconds it an expensive process, adding to
the load of the server.
Re: server load on bottom of page
Posted: October 2nd, 2008, 4:46 pm
by steve51184
shypike wrote:
Depends on what you think the server is.
SABnzbd's webserver, the server hosting SABnzbd, the Usenet server connected, whatever.
I see what you mean. Somehow it's a bit of a limited audience that would want it (also Linux-only).
I'm not sure about the usefulness of this, I'll discuss it with the team.
the server hosting SABnzbd is what i am talking about and i don't think it's a limited audience and even if it is it's only a very small modification
also it'll be very useful to know if SABnzbd is hogging the server resources especially if the server is also a webserver with live websites
Re: server load on bottom of page
Posted: October 2nd, 2008, 6:27 pm
by steve51184
many many programs tell you this and one of them is torrentflux:
as you can see from the random image i found on google torrentflux it almost overloading the server ^
yes there are other ways like opening putty connection to the server and running top but adding this bit of info to sabnzbd will be a huge time saver.. also it's this the same process as checking the free disk space as there are many other ways of finding this out yet you include it
also unrar and par2 can be very intensive like you said and a few simple lines of code can let you know what the server load is
Re: server load on bottom of page
Posted: October 11th, 2008, 8:38 pm
by xxhds
I just saw this posted and wanted to add it to my server so I did. I have no python experience, but adding it was a snap. It currently does not auto-refresh because I didn't dig into the templates and scripts enough to see how that worked, but it gets the job done for me and is very informative. Took me about 30 minutes to figure out. I also removed some other stuff from the template I didn't want. Here's what mine looks like:
Oh and this is for linux only. I'm running an ubuntu server with 2 4x500gb raid 5 partitions. Should work with any linux distribution though.
Two files to modify. interface.py and your main.tmpl in whatever template folder you are using.
In interface.py located in /sabnzbd .4.4/sabnzbd
search for:
Code: Select all
PROVIDER = DictAuthProvider({})
USERNAME = None
PASSWORD = None
#------------------------------------------------------------------------------
after add:
Code: Select all
def upsys():
"""Returns uptime and cpu load"""
import commands
a = commands.getoutput("uptime")
return a
search for:
Code: Select all
header['diskspacetotal2'] = "%.2f" % disktotal(sabnzbd.COMPLETE_DIR)
after add:
Code: Select all
header['uptimesys'] = "%s" % upsys()
search for:
Code: Select all
"diskspace2" : diskfree(sabnzbd.COMPLETE_DIR),
after add:
search for and add the same thing again. There are two places where the above string is found.
Then in main.tmpl in the folder /sabnzbd .4.4/interfaces/smpl/templates
I use the smpl template. I just quick looked at the default main.tmpl and I wasn't sure where to put it, but this is just the code to output the results, so you can put it anywhere you want in any template.
scroll all the way to the bottom and add ${uptimesys}
I put it right before "sabnzbd version: $version"
I don't think a restart is even required, but it might be. Just refresh the page and you should see your uptime and load statistics. Let me know if you have an questions.
-xxhds
Re: server load on bottom of page
Posted: October 12th, 2008, 12:11 am
by steve51184
PERFECT thank you VERY much
Re: server load on bottom of page
Posted: October 12th, 2008, 4:36 am
by sander
@xxhds: can you post the altered files here in this thread?
Thanks.
Sander
Re: server load on bottom of page
Posted: October 12th, 2008, 7:08 am
by steve51184
Re: server load on bottom of page
Posted: October 12th, 2008, 7:58 am
by sander
Cool, after a "unrar x ..." in the SABnzbd-directory it works in the 'default' interface (and indeed not in the Plush interface). At the bottom, I now get:
Download Dir: 14.42 GB - Complete Dir: 14.42 GB - Download speed: 0.00 KB/s - Queued: 0.00/0.00 MB
14:45:56 up 3:22, 3 users, load average: 0.52, 0.42, 0.37
BTW: with the refresh time interval set to something else than 0 (for example 5 seconds), the uptime-statistics update themselves in the queue-overview (
http://localhost:8080/sabnzbd/m/queue/ on my system).
This hack shows you can easily put more information into the (default) interface of SAB. Great.
Re: server load on bottom of page
Posted: October 12th, 2008, 2:04 pm
by xxhds
sander wrote:
BTW: with the refresh time interval set to something else than 0 (for example 5 seconds), the uptime-statistics update themselves in the queue-overview (
http://localhost:8080/sabnzbd/m/queue/ on my system).
This hack shows you can easily put more information into the (default) interface of SAB. Great.
Yea I think the smpl interface uses frames and it only updates the actual queue part when it refreshes because it doesnt update my server load. I have to use smpl though because I'm addicted to graphs. And now I'm addicted to looking at the sabnzbd code for things to modify. Not sure what to do next. Maybe add the speed graph to the default theme. Or maybe make a cpu graph. Because seeing spikes on a cpu graph might be very helpful. (yes i know the sabnzbd developers might think this is useless and to just use something else, but I run a server just for downloading and file storage and having an web interface integrated with everything would be awesome.) Oh and I need a restart button.
Re: server load on bottom of page
Posted: October 14th, 2008, 4:19 am
by shypike
I have added the server-load display to the todo list, but it will take a while.
The list is already so long...
Re: server load on bottom of page
Posted: October 14th, 2008, 5:11 am
by steve51184
shypike wrote:
I have added the server-load display to the todo list, but it will take a while.
The list is already so long...
can we see this to do list? :-D
Re: server load on bottom of page
Posted: October 14th, 2008, 5:26 am
by shypike
A bit of research in our Wiki would have gotten you there.
http://trac2.assembla.com/SABnzbd/report/3