Bandwidth counter / disable after reach limit


#1

Any plan to add a bandwidth counter?

I use Leaseweb so i faced a problem with bandwitdh, i “only” have 100TB (in/out)

my server will be splited to 6 friends (including me), so each one will have like 15TB and the rest will be to download files.

So a way to block the user after reach his bandwidth is mandatory since most of us uses autodl and we dont want to use more bandwidth than we can.


#2

there is a total counter.


#3

Indeed, there is already a total bandwidth counter and the master user can keep track of the total usage.

Monitoring bandwidth usage on a per-user basis is a whole other ordeal entirely and I do not know if it will be included.

It seems like one of the best solutions would be to use iptables to monitor the processes of individual users. However, the overhead of this logging could get quite intensive on a high-performance server.

Also:


#4

a plugin in rutorrent already does it. so just pulling that info would work.


#5

With deluge now as an option, this would only catch half of the data or so.

This also doesn’t take into account s/ftp transfer, plex and any other traffic a user might rack up.


#6

Ok i’ll see what i can do.

Liara, do you have any IM so i can talk to you about an offer?


#7

there is a PM system in place.


#8

i noticed the bw counter actually isnt working for additional users?

Inst opening / expanding


#9

By default, it is assumed that only the master user of the server would be able to access this information.

In the file /srv/rutorrent/home/index.php the lines:
<?php if ($username == "$master"){ echo "<div class=\"row\"><div id=\"bw_tables\" style=\"padding:0;margin:0;\"></div></div>"; } ?>

Control this behavior. To allow all users to see this data, simply remove the if statement:
<?php echo "<div class=\"row\"><div id=\"bw_tables\" style=\"padding:0;margin:0;\"></div></div>"; ?>

This work around will be re-written after every update, however.


#10

ok

and i can add if ($username == “$master”){
to hide cpu usage for other users ?


#11

Yes – you can restrict any module to only be viewable by the master user with that statement. If you apply that fix to another file other than index.php and you find it not working, ensure that the file you are changing includes a file that sets the variables $username and $master or set the variables manually at the header of the file.

Also mind the closing bracket on that statement
if ($username == "$master"){ }

As for IMs, as was stated the PM system is what that is designed for


#12

Yes, you can hide the entire widget if you prefer by just wrapping the whole div in an if statement such as:

            <?php if ($username == "$master") { ?>
            <div class="col-sm-12">
              <div class="panel panel-inverse">
                <ul class="panel-options">
                  <li><a class="panel-minimize"><i class="fa fa-chevron-down"></i></a></li>
                  <li><a class="panel-remove"><i class="fa fa-close text-danger"></i></a></li>
                </ul>
                <div class="panel-heading">
                  <h4 class="panel-title">CPU Status</h4>
                </div>
                <div class="panel-body">
                  <div id="metercpu"></div>
                  <hr />
                  <span class="nomargin" style="font-size:14px">
                    <?php echo $sysInfo['cpu']['model'];?><br/>
                    [<span style="color:#111;font-weight:600">x<?php echo $sysInfo['cpu']['num']; ?></span> core]
                  </span>
                </div>
              </div>
            </div><!-- CPU WIDGET -->
            } ?>

#13

@liara got there first.

You’ll need to also keep in mind that on updates this will overwrite changes. So making backups would be of importance… or cherry picking the updates directly form the local repo.


#14

Something is broken with this code, but ill try to figure it out.

About the updates are important to keep updated? Or something may broken?


#15

Small typo there @JMSolo – you closed the php statement before we even started :wink:

       <?php if ($username == "$master") {
        <div class="col-sm-12">
          <div class="panel panel-inverse">
            <ul class="panel-options">
              <li><a class="panel-minimize"><i class="fa fa-chevron-down"></i></a></li>
              <li><a class="panel-remove"><i class="fa fa-close text-danger"></i></a></li>
            </ul>
            <div class="panel-heading">
              <h4 class="panel-title">CPU Status</h4>
            </div>
            <div class="panel-body">
              <div id="metercpu"></div>
              <hr />
              <span class="nomargin" style="font-size:14px">
                <?php echo $sysInfo['cpu']['model'];?><br/>
                [<span style="color:#111;font-weight:600">x<?php echo $sysInfo['cpu']['num']; ?></span> core]
              </span>
            </div>
          </div>
        </div><!-- CPU WIDGET -->
        } ?>

Try the untypo’d version perhaps?

Updates will be both features and bug fixes. If you aren’t having specific issues or wanting to upgrade to a feature in the changelog, it’s likely that you could hold off on upgrading until something important comes up


#16

No, I didn’t end the php if statement… my bad… here is the proper revision

            <?php if ($username == "$master") { ?>
            <div class="col-sm-12">
              <div class="panel panel-inverse">
                <ul class="panel-options">
                  <li><a class="panel-minimize"><i class="fa fa-chevron-down"></i></a></li>
                  <li><a class="panel-remove"><i class="fa fa-close text-danger"></i></a></li>
                </ul>
                <div class="panel-heading">
                  <h4 class="panel-title">CPU Status</h4>
                </div>
                <div class="panel-body">
                  <div id="metercpu"></div>
                  <hr />
                  <span class="nomargin" style="font-size:14px">
                    <?php echo $sysInfo['cpu']['model'];?><br/>
                    [<span style="color:#111;font-weight:600">x<?php echo $sysInfo['cpu']['num']; ?></span> core]
                  </span>
                </div>
              </div>
            </div><!-- CPU WIDGET -->
            <?php } ?>

Notice the <?php } ?> at the end… I foobar’d it before by only doing } ?> So it didn’t know where it began or where it should end.

This method wraps the code without having to mark everything in the block to be readable in php format… otherwise you would have to do echo "<div class=\"col-sm-12\">"; etc etc for every line.


#17

Ah crap, that would be rather annoying – your PHP is much much stronger than mine. So I’ll just nod in agreement :grin:


#18

That’s why you’re the Linux Sorceress. :stuck_out_tongue_winking_eye: