Exemple #1
0
def uptimes():
    ago = timefunc.hours_ago(config.active_age)
    ahead = timefunc.hours_ahead(config.active_future)
    uptimes = avg_uptime()
    #logger.debug("Writing Uptime HTML file %s", config.uptime_report_name)
    filename = "%s/%s" % (config.reportdir, config.uptime_report_name)
    uptimefile = open(filename, 'w')
    uptimefile.write("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css2" />
<meta name="keywords" content="Mixmaster,Remailer,Banana,Bananasplit">
<title>Bananasplit Website - Failing Remailers</title>
<link rel="StyleSheet" href="stats.css" type="text/css">
</head>

<body>
<h1>Remailer Uptimes</h1>
<p>This report provides an overview of the average uptime for each remailer
based on the results from all currently responding pingers.  Consider that this
report doesn't define a scope for acceptable ping results; all are considered
good.  This means a single pinger can skew the average.</p>
<table border="0" bgcolor="#000000">
<tr bgcolor="#F08080">
<th>Remailer Name</th>
<th>Average Uptime</th>
<th>Average Latency</th>
<th>Pingers Reporting</th></tr>\n""")
    rotate_color = 0
    for uptime in uptimes:
        # Rotate background colours for rows
        if rotate_color:
            bgcolor = "#ADD8E6"
        else:
            bgcolor = "#E0FFFF"
        rotate_color = not rotate_color

        name = uptime[0]
        up = uptime[1]
        count = uptime[3]
        lathrs,latmin = timefunc.hours_mins(uptime[2])
        uptimefile.write('<tr bgcolor="%s">' % bgcolor)
        uptimefile.write('<th class="tableleft">%s</th>' % name)
        uptimefile.write('<td>%3.2f</td>' % up)
        uptimefile.write('<td>%d:%02d</td>' % (lathrs, latmin))
        uptimefile.write('<td>%d</td></tr>\n' % (count, ))

    uptimefile.write('</table>\n')
    uptimefile.write('<br>Last update: %s (UTC)<br>\n' % timefunc.utcnow())
    uptimefile.write('<br><a href="index.html">Index</a>\n')
    uptimefile.write('</body></html>')
    uptimefile.close()
Exemple #2
0
def writekeystats():
    global now, ago, ahead
    now = timefunc.utcnow()
    ago = timefunc.hours_ago(config.active_age)
    ahead = timefunc.hours_ahead(config.active_future)
    write_stats()
Exemple #3
0
        # remailer_active_pings: Based on the vitals generated above, we now
        # extract stats lines for pingers considered active.  The up_hist
        # part is used by the fail_recover routine.
        remailer_active_pings = db.remailer_active_pings(remailer_vitals)
        # If a remailers is perceived to be dead, timestamp it in the
        # genealogy table.  Likewise, if it's not dead, unstamp it.
        fail_recover(name, addy, remailer_active_pings)

        # Write the remailer text file that contains pinger stats and averages
        logger.debug("Writing stats file for %s %s", name, addy)
        write_remailer_stats(name, addy, remailer_vitals)

        # Rotate the colour used in index generation.
        rotate_color = not rotate_color

    db.gene_find_new()
    index()
    genealogy()
    uptimes()
    chainstats()
    writekeystats()
    logger.info("Processing cycle completed at %s (UTC)", timefunc.utcnow())


# Call main function.
now = timefunc.utcnow()
ago = timefunc.hours_ago(config.active_age)
ahead = timefunc.hours_ahead(config.active_future)
if __name__ == "__main__":
    main()