def run():
    print "Starting..."
    vd = vultr_dict()
    usage = usage_portion(vd)
    t = time_portion()
    msg = (
        "used %s out of %s allowed traffic quota (%.2f%%)" %
        (vd['current_bandwidth_gb'], vd['allowed_bandwidth_gb'], usage * 100))
    if usage > retire_threshold:
        print "Retiring because I", msg
        util.split_server(msg, retire=True)
    elif t > significant_time and usage > significant_usage and usage > t:
        msg += " in %.2f%% of the current month" % (t * 100)
        print "Splitting because I", msg
        util.split_server(msg, retire=False)
    else:
        print "Usage portion: %s; time portion: %s; not splitting." % (usage,
                                                                       t)
    print "Done."
def run():
    print "Starting..."
    vd = vultr_dict()
    usage = usage_portion(vd)
    t = time_portion()
    msg = ("used %s out of %s allowed traffic quota (%.2f%%)"
           % (vd['current_bandwidth_gb'],
              vd['allowed_bandwidth_gb'],
              usage * 100))
    if usage > retire_threshold:
        print "Retiring because I", msg
        util.split_server(msg, retire=True)
    elif t > significant_time and usage > significant_usage and usage > t:
        msg += " in %.2f%% of the current month" % (t * 100)
        print "Splitting because I", msg
        util.split_server(msg, retire=False)
    else:
        print "Usage portion: %s; time portion: %s; not splitting." % (usage,
                                                                       t)
    print "Done."
Beispiel #3
0
#!/usr/bin/env python

import os

import util


report_threshold = 1.3
split_threshold = 0.9


_, _, la15m = os.getloadavg()

print "starting..."

if la15m > report_threshold:
    print "report threshold surpassed; notifying..."
    util.send_alarm("Chained fallback high load", "load average %s" % la15m)

if la15m > split_threshold:
    util.split_server("reached load average %s" % la15m)

print "... done."
Beispiel #4
0
#!/usr/bin/env python

import os

import util

report_threshold = 1.3
split_threshold = 0.9

_, _, la15m = os.getloadavg()

print "starting..."

if la15m > report_threshold:
    print "report threshold surpassed; notifying..."
    util.send_alarm('Chained fallback high load', "load average %s" % la15m)

if la15m > split_threshold:
    util.split_server("reached load average %s" % la15m)

print "... done."