Exemple #1
0
def add_bytes(time, address, nbytes, seconds):
    if 0 == nbytes:
        return  # no point saving an empty entry

    bandwidth = float(nbytes)/seconds
    message = 'internet.bandwidth.{} {} {}'.format(address, int(bandwidth), int(timestamp(time)))
    send(message)
Exemple #2
0
def log_write(x):
    mysql_log = open(conf.MYSQL_LOG_FILE, "a+")
    mysql_log.write("[%s] %s\n" % (misc.timestamp(), x))
    mysql_log.close()
Exemple #3
0
def log_write(x):
    mysql_log = open(conf.MYSQL_LOG_FILE, "a+")
    mysql_log.write("[%s] %s\n" % (misc.timestamp(), x))
    mysql_log.close()
Exemple #4
0
def cpu_time_stdoutln(line):
    if cpu_time_output_enabled:
        stdout("[%s] CPU_TIME %s\n" % (misc.timestamp(), line))
Exemple #5
0
def warning_stdoutln(line):
    stdout("[%s]     Warning: %s\n" % (misc.timestamp(), line))
Exemple #6
0
def debug_stdoutln(line):
    if debug_output_enabled:
        stdout("[%s] %s\n" % (misc.timestamp(), line))
Exemple #7
0
def stdoutln(line):
    stdout("[%s] %s\n" % (misc.timestamp(), line))
Exemple #8
0
def add_usage(time, user):
    message = 'internet.usage.{} 1 {}'.format(user, int(timestamp(time)))
    send(message)
Exemple #9
0
def add_counter(time, user, counter):
    message = 'internet.counter.{} {} {}'.format(user, counter, int(timestamp(time)))
    send(message)
Exemple #10
0
def cpu_time_stdoutln(line):
    if cpu_time_output_enabled:
        stdout("[%s] CPU_TIME %s\n" % (misc.timestamp(), line))
Exemple #11
0
def warning_stdoutln(line):
    stdout("[%s]     Warning: %s\n" % (misc.timestamp(), line))
Exemple #12
0
def debug_stdoutln(line):
    if debug_output_enabled:
        stdout("[%s] %s\n" % (misc.timestamp(), line))
Exemple #13
0
def stdoutln(line):
    stdout("[%s] %s\n" % (misc.timestamp(), line))
Exemple #14
0
def wait_for_next(period):
    ts = timestamp(datetime.datetime.utcnow())
    time.sleep(period - (ts % period))