server load on bottom of page

Want something added? Ask for it here.
steve51184

server load on bottom of page

Post 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
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: server load on bottom of page

Post by shypike »

What's the "server load"?
steve51184

Re: server load on bottom of page

Post 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
Last edited by steve51184 on October 2nd, 2008, 12:29 pm, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: server load on bottom of page

Post 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.
Last edited by shypike on October 2nd, 2008, 4:44 pm, edited 1 time in total.
steve51184

Re: server load on bottom of page

Post 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
steve51184

Re: server load on bottom of page

Post by steve51184 »

many many programs tell you this and one of them is torrentflux:

Image

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
Last edited by steve51184 on October 2nd, 2008, 6:33 pm, edited 1 time in total.
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: server load on bottom of page

Post 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.
Image

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:     

Code: Select all

 "uptimesys" : upsys(),
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
steve51184

Re: server load on bottom of page

Post by steve51184 »

PERFECT thank you VERY much :) :-*
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: server load on bottom of page

Post by sander »

@xxhds: can you post the altered files here in this thread?

Thanks.

Sander
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
steve51184

Re: server load on bottom of page

Post by steve51184 »

here's the edit for the default theme:

http://rapidshare.com/files/153259246/s ... d_edit.rar
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: server load on bottom of page

Post 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.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: server load on bottom of page

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: server load on bottom of page

Post 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...
steve51184

Re: server load on bottom of page

Post 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
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: server load on bottom of page

Post by shypike »

A bit of research in our Wiki would have gotten you there.

http://trac2.assembla.com/SABnzbd/report/3
Post Reply