* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-03 22:47 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-03 22:47 UTC (permalink / raw
To: gentoo-commits
commit: 1676f2fc64880251befdb18ad22f59dae0ae1f4e
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun May 3 22:45:07 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun May 3 22:45:07 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=1676f2fc
Generate html pages based on the mirmon data
A python script is used to generate html pages based
on the data produced by mirmon. The html pages visualize
the mirror stats using the gentoo tyrian theme.
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 178 ++++++++++++++++++++++++++++
html/help.jinja2 | 163 ++++++++++++++++++++++++++
html/stats.jinja2 | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 680 insertions(+)
diff --git a/html/generate.py b/html/generate.py
new file mode 100755
index 0000000..d6f21c0
--- /dev/null
+++ b/html/generate.py
@@ -0,0 +1,178 @@
+#!/usr/bin/python
+
+#
+# Generate html pages based on the Mirmon data
+#
+# This script will parse the json files that contain the mirmon
+# data and have been generated before. The json data is used to
+# generate html pages that visualize the mirmon data in a human
+# readable way.
+#
+#
+# Leaflet is used to visualize the mirrors on a world map. Further-
+# more Datatables are used to display the mirrors.
+#
+
+import datetime
+import socket
+import urllib.request, json
+import xml.etree.ElementTree as ET
+import jinja2
+
+html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/"
+cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json"
+
+
+mirrorstats = [ 'https://mirrorstats.gentoo.org/rsync/state.json',
+ 'https://mirrorstats.gentoo.org/distfiles/state.json',
+ 'https://mirrorstats.gentoo.org/snapshots/state.json',
+ 'https://mirrorstats.gentoo.org/releases/state.json',
+ 'https://mirrorstats.gentoo.org/experimental/state.json'
+ ]
+
+cache_data = {}
+
+
+#
+# Retrieve and parse the JSON at the given URL
+#
+def getJson(url):
+ req = urllib.request.Request(url)
+ r = urllib.request.urlopen(req).read()
+ return json.loads(r.decode('utf-8'))
+
+
+#
+# Retrieve and parse the XML at the given URL
+#
+def getXML(url):
+ req = urllib.request.Request(url)
+ r = urllib.request.urlopen(req).read()
+ return ET.loads(r.decode('utf-8')).getroot()
+
+
+#
+# Get the ip of the given host
+#
+def getIp(hostname):
+ try:
+ ip = socket.gethostbyname(hostname)
+ except:
+ ip = ""
+ return ip
+
+
+#
+# Render the stats template for a given page, i.e. all, rsync, distfiles...
+#
+def renderStatsTemplate(templateEnv, page):
+ if page == "all":
+ mirrorstatsList = mirrorstats
+ else:
+ mirrorstatsList = ['https://mirrorstats.gentoo.org/' + page + '/state.json']
+
+ lastUpdate, hostList = getHostList(mirrorstatsList)
+ template = templateEnv.get_template("stats.jinja2")
+ template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page + ".html")
+ return lastUpdate
+
+
+# read the cache
+with open(cache_path) as json_file:
+ cache_data = json.load(json_file)
+
+#
+# The all mirrors that are present in the given list
+#
+def getHostList(mirrorstatsList):
+ hosts = {}
+ lastUpdate = ""
+
+ # process all mirrors
+ for mirror_url in mirrorstatsList:
+
+ mirrorData = getJson(mirror_url)
+ lastUpdate = datetime.datetime.fromtimestamp(int(mirrorData['LastUpdate'])).strftime('%Y-%m-%d %H:%M:%S')
+
+ for mirror in mirrorData['Mirrors']:
+ if len(mirrorData['Mirrors'][mirror]) >= 0:
+ for mirrorHost in mirrorData['Mirrors'][mirror]:
+ hostname = mirrorHost['Host']
+ if hostname not in hosts:
+ hosts[hostname] = {}
+
+ hosts[hostname]['Hostname'] = hostname
+
+ if hostname in cache_data['hosts']:
+ ip = cache_data['hosts'][hostname]
+ else:
+ ip = getIp(hostname)
+ # populate cache with new value
+ cache_data['hosts'][hostname] = ip
+
+ if ip != "":
+ hosts[hostname]['Ip'] = ip
+
+ if 'Stats' not in hosts[hostname]:
+ hosts[hostname]['Stats'] = []
+
+ mirrorHost['Type'] = mirror_url.replace("https://mirrorstats.gentoo.org/", "").replace("/state.json", "")
+ hosts[hostname]['Stats'].append(mirrorHost)
+
+ # compute available protocols
+ for host in hosts:
+ protocols = []
+ for stat in hosts[host]['Stats']:
+ protocols.append(stat['Protocol'])
+
+ hosts[host]['Protocols'] = list(set(protocols))
+
+ # compute mirror locations
+ for host in hosts:
+ if 'Ip' not in hosts[host]:
+ continue
+
+ ip = hosts[host]['Ip']
+ if ip in cache_data['ips']:
+ hosts[host]['Location'] = cache_data['ips'][ip]
+ else:
+ mirrorGeoData = getJson("https://ipinfo.io/" + ip + "/json")
+ hosts[host]['Location'] = mirrorGeoData['loc']
+ # populate cache with new value
+ cache_data['ips'][ip] = mirrorGeoData['loc']
+
+ return lastUpdate, hosts
+
+
+#
+# render jinja2
+#
+templateLoader = jinja2.FileSystemLoader(searchpath="./")
+templateEnv = jinja2.Environment(loader=templateLoader)
+
+## stats
+lastUpdate = renderStatsTemplate(templateEnv, "all")
+renderStatsTemplate(templateEnv, "rsync")
+renderStatsTemplate(templateEnv, "distfiles")
+renderStatsTemplate(templateEnv, "snapshots")
+renderStatsTemplate(templateEnv, "releases")
+renderStatsTemplate(templateEnv, "experimental")
+
+## about
+template = templateEnv.get_template("help.jinja2")
+template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html")
+
+
+#
+# write the cache
+#
+with open(cache_path, 'w') as fp:
+ json.dump(cache_data, fp)
+
+
+#
+# finish
+#
+print("Finished.")
+
+
diff --git a/html/help.jinja2 b/html/help.jinja2
new file mode 100644
index 0000000..6e08363
--- /dev/null
+++ b/html/help.jinja2
@@ -0,0 +1,163 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Gentoo Mirrorstats</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="https://assets.gentoo.org/tyrian/v2/tyrian.min.css" rel="stylesheet" media="screen">
+ <link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
+ </head>
+
+ <body>
+
+ <header>
+ <div class="site-title">
+ <div class="container">
+ <div class="row justify-content-between">
+ <div class="logo">
+ <a href="/" title="Back to the homepage" class="site-logo">
+ <img src="https://assets.gentoo.org/tyrian/site-logo.png" alt="Gentoo" srcset="https://assets.gentoo.org/tyrian/v2/site-logo.svg">
+ </a>
+ <span class="site-label">Mirrorstats</span>
+ </div>
+ <div class="site-title-buttons">
+ <div class="btn-group btn-group-sm">
+ <a href="https://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-fw fa-download"></span> <strong>Get Gentoo!</strong></a>
+ <div class="btn-group btn-group-sm">
+ <a class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">
+ <span class="fa fa-fw fa-map-o"></span> <span class="d-none d-sm-inline">gentoo.org sites</span> <span class="caret"></span>
+ </a>
+ <div class="dropdown-menu dropdown-menu-right">
+ <a class="dropdown-item" href="https://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> gentoo.org</a>
+ <a class="dropdown-item" href="https://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text-o fa-fw"></span> Wiki</a>
+ <a class="dropdown-item" href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> Bugs</a>
+ <a class="dropdown-item" href="https://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> Forums</a>
+ <a class="dropdown-item" href="https://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> Packages</a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" href="https://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a>
+ <a class="dropdown-item" href="https://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> Archives</a>
+ <a class="dropdown-item" href="https://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> Sources</a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" href="https://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-server fa-fw"></span> Infra Status</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <nav class="tyrian-navbar navbar navbar-dark navbar-expand-lg bg-primary" role="navigation">
+ <div class="container">
+ <div class="navbar-header">
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-main-collapse" aria-controls="navbar-main-collapse" aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ </div>
+ <div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse">
+ <ul class="navbar-nav mr-auto">
+ <li class="nav-item"><a class="nav-link" href="all.html">Home</a></li>
+ <li class="nav-item"><a class="nav-link" href="rsync.html">Rsync</a></li>
+ <li class="nav-item"><a class="nav-link" href="distfiles.html">Distfiles</a></li>
+ <li class="nav-item"><a class="nav-link" href="snapshots.html">Snapshots</a></li>
+ <li class="nav-item"><a class="nav-link" href="releases.html">Releases</a></li>
+ <li class="nav-item"><a class="nav-link" href="experimental.html">Experimental</a></li>
+ <li class="nav-item active"><a class="nav-link" href="help.html">Help</a></li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+ </header>
+
+
+ <div class="container">
+ <div class="row">
+ <div class="col-md-12">
+ <h1 class="first-header">About Gentoo Mirrors</h1>
+ <div class="alert alert-info">
+ If you experience problems with this site (<tt>mirrorstats.gentoo.org</tt>), please file clearly marked bugs in
+ <a href="https://bugs.gentoo.org/enter_bug.cgi?assigned_to=infra-bugs%40gentoo.org&bug_file_loc=http%3A%2F%2F&bug_severity=normal&bug_status=CONFIRMED&cf_runtime_testing_required=---&comment=This%20page%20is%20NOT%20for%20problems%20with%20a%20specific%20mirror.%0D%0A%0D%0APlease%20include%20a%20summary%20of%20your%20problem%20with%20mirrorstats.gentoo.org%20here.%0D%0A%0D%0A&component=Other%20web%20server%20issues&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&defined_groups=1&flag_type-4=X&form_name=enter_bug&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Linux&priority=Normal&product=Gentoo%20Infrastructure&rep_platform=All&short_desc=mirrorstats.gentoo.org%3A%20PROBLEM%20SUMMARY&version=unspecified">Gentoo Bugzilla (product <i>Infrastructure</i>)</a>.
+ Please remember to include <tt>mirrorstats</tt> in the summary line.
+ </div>
+ <h2 id="moreInformation">Gentoo rsync mirrors</h2>
+ <p>Gentoo rsync mirrors tracked include both official mirrors run by the Gentoo Infrastructure team, as well as community-run mirrors.</p>
+ <ul>
+ <li><a href="https://www.gentoo.org/support/rsync-mirrors/">Listing of Gentoo rsync mirrors</a></li>
+ <li><a href="https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Rsync">How to contribute a new rsync mirror</a></li>
+ <li><a href="/rsync/">Status of Gentoo rsync mirrors</a></li>
+ </ul>
+ <h2>Gentoo source mirrors</h2>
+ <ul>
+ <li><a href="https://www.gentoo.org/downloads/mirrors/">Listing of Gentoo source mirrors</a></li>
+ <li><a href="https://wiki.gentoo.org/wiki/Project:Infrastructure/Mirrors/Source">How to contribute a new source mirror</a></li>
+ <li><a href="/distfiles/">Status of Gentoo source mirrors: <tt>/distfiles/</tt></a>
+ <li><a href="/experimental/">Status of Gentoo source mirrors: <tt>/experimental/</tt></a>
+ <li><a href="/releases/">Status of Gentoo source mirrors: <tt>/releases/</tt></a>
+ <li><a href="/snapshots/">Status of Gentoo source mirrors: <tt>/snapshots/</tt></a>
+ </ul>
+ <div class="alert alert-warning">
+ If you experience problems with a specific mirror, please file clearly marked bugs in <a href="https://bugs.gentoo.org/enter_bug.cgi?product=Mirrors">Gentoo Bugzilla (product <i>Mirrors</i>)</a>.</br>
+ Please include lots of details about the problem, as the Gentoo
+ mirror team will have to contact the administrator of individual
+ mirrors to work on problems.
+ <ul>
+ <li><b>Hostname</b> of the mirror (in the summary & description)</li>
+ <li><b>IP</b> of the mirror: many mirrors have multiple nodes behind a single DNS entry</li>
+ <li><b>Timestamp</b> of the problem</li>
+ <li><b>Logs</b> of the problem</li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <footer>
+ <div class="container">
+ <div class="row">
+ <div class="col-12 offset-md-2 col-md-7">
+ <h3 class="footerhead">Gentoo Mirrorstats</h3>
+ <div class="row">
+ <div class="col-xs-12 col-md-4">
+ <span class="kk-group-header">Mirror Data as current of</span><br>{{ lastUpdate }}
+ </div>
+ <div class="col-xs-12 col-md-4">
+ </div>
+ <div class="col-xs-12 col-md-4">
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-md-3">
+ <h3 class="footerhead">Questions or comments?</h3>
+ Please feel free to <a href="https://www.gentoo.org/inside-gentoo/contact/">contact us</a>.
+ <p class="mt-2"><a href="https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/">Gentoo Mirrorstats</a></p>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-2 col-sm-3 col-md-2">
+ <ul class="footerlinks three-icons">
+ <li><a href="https://twitter.com/gentoo" title="@Gentoo on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li>
+ <li><a href="https://www.facebook.com/gentoo.org" title="Gentoo on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li>
+ <li><a href="https://www.reddit.com/r/Gentoo/" title="Gentoo on Reddit"><span class="fa fa-reddit-alien fa-fw"></span></a></li>
+ </ul>
+ </div>
+ <div class="col-10 col-sm-9 col-md-10">
+ <strong>© 2001–2020 Gentoo Foundation, Inc.</strong><br>
+ <small>
+ Gentoo is a trademark of the Gentoo Foundation, Inc.
+ The contents of this document, unless otherwise expressly stated, are licensed under the
+ <a href="https://creativecommons.org/licenses/by-sa/4.0/" rel="license">CC-BY-SA-4.0</a> license.
+ The <a href="https://www.gentoo.org/inside-gentoo/foundation/name-logo-guidelines.html">Gentoo Name and Logo Usage Guidelines</a> apply.
+ </small>
+ </div>
+ </div>
+ </div>
+ </footer>
+
+
+ <script src="https://assets.gentoo.org/tyrian/v2/jquery-3.3.slim.js"></script>
+ <script src="https://assets.gentoo.org/tyrian/v2/popper.min.js"></script>
+ <script src="https://assets.gentoo.org/tyrian/v2/bootstrap.min.js"></script>
+
+
+ </body>
+</html>
diff --git a/html/stats.jinja2 b/html/stats.jinja2
new file mode 100644
index 0000000..e13cd45
--- /dev/null
+++ b/html/stats.jinja2
@@ -0,0 +1,339 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Gentoo Mirrorstats</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="https://assets.gentoo.org/tyrian/v2/tyrian.min.css" rel="stylesheet" media="screen">
+ <link href="https://www.gentoo.org/assets/css/leaflet.css" rel="stylesheet" media="screen">
+ <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.20/datatables.min.css"/>
+ <link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
+ </head>
+
+ <body>
+
+ <header>
+ <div class="site-title">
+ <div class="container">
+ <div class="row justify-content-between">
+ <div class="logo">
+ <a href="/" title="Back to the homepage" class="site-logo">
+ <img src="https://assets.gentoo.org/tyrian/site-logo.png" alt="Gentoo" srcset="https://assets.gentoo.org/tyrian/v2/site-logo.svg">
+ </a>
+ <span class="site-label">Mirrorstats</span>
+ </div>
+ <div class="site-title-buttons">
+ <div class="btn-group btn-group-sm">
+ <a href="https://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-fw fa-download"></span> <strong>Get Gentoo!</strong></a>
+ <div class="btn-group btn-group-sm">
+ <a class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">
+ <span class="fa fa-fw fa-map-o"></span> <span class="d-none d-sm-inline">gentoo.org sites</span> <span class="caret"></span>
+ </a>
+ <div class="dropdown-menu dropdown-menu-right">
+ <a class="dropdown-item" href="https://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> gentoo.org</a>
+ <a class="dropdown-item" href="https://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text-o fa-fw"></span> Wiki</a>
+ <a class="dropdown-item" href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> Bugs</a>
+ <a class="dropdown-item" href="https://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> Forums</a>
+ <a class="dropdown-item" href="https://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> Packages</a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" href="https://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a>
+ <a class="dropdown-item" href="https://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> Archives</a>
+ <a class="dropdown-item" href="https://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> Sources</a>
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item" href="https://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-server fa-fw"></span> Infra Status</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <nav class="tyrian-navbar navbar navbar-dark navbar-expand-lg bg-primary" role="navigation">
+ <div class="container">
+ <div class="navbar-header">
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-main-collapse" aria-controls="navbar-main-collapse" aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ </div>
+ <div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse">
+ <ul class="navbar-nav mr-auto">
+ <li class="nav-item {%if type == 'all'%}active{%endif%}"><a class="nav-link" href="all.html">Home</a></li>
+ <li class="nav-item {%if type == 'rsync'%}active{%endif%}"><a class="nav-link" href="rsync.html">Rsync</a></li>
+ <li class="nav-item {%if type == 'distfiles'%}active{%endif%}"><a class="nav-link" href="distfiles.html">Distfiles</a></li>
+ <li class="nav-item {%if type == 'snapshots'%}active{%endif%}"><a class="nav-link" href="snapshots.html">Snapshots</a></li>
+ <li class="nav-item {%if type == 'releases'%}active{%endif%}"><a class="nav-link" href="releases.html">Releases</a></li>
+ <li class="nav-item {%if type == 'experimental'%}active{%endif%}"><a class="nav-link" href="experimental.html">Experimental</a></li>
+ <li class="nav-item "><a class="nav-link" href="help.html">Help</a></li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+ </header>
+
+
+ <div class="container">
+ <div class="row">
+ <div class="col-md-12">
+ <h1 class="first-header">Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} Mirrors
+ {% if type != "all" %}
+ <small class="ml-2 mt-2 float-right" style="font-size: 60%;">
+ <a title="Json Data" class="mr-2 text-muted" href="/{{type}}/state.json"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path d="M5 3h2v2H5v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2a2 2 0 0 1-2-2V5h-2V3h2m-7 12a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1z" fill="#777777"/></svg></a>
+ <a title="Original Mirmon Page" class="text-muted" href="/{{type}}/"><i class="fa fa-bar-chart" aria-hidden="true"></i></a>
+ </small>
+ {% endif %}
+ </h1>
+
+
+ <p>
+ Welcome to the Gentoo Linux <tt>mirrorstats</tt> system. Below you can see an overview of all Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} mirrors.<br/>
+ For more information about Gentoo mirrors, how to contribute a mirror or any problems please have a look at the <a href="help.html">help page</a>.
+ </p>
+ <div id="mirrorLocations" style="height: 500px; margin-bottom: 1em;"></div>
+ </div>
+
+ <div class="col-md-12 my-4">
+ <table id="table_id" class="display table">
+ <thead>
+ <tr>
+ <th>Host</th>
+ {% if type == "all" %}<th>Type</th>{% endif %}
+ <th>Protocol</th>
+ <th class="statusHistory">Daily Stats</th>
+ <th class="statusHistory">Probe Stats</th>
+ <th style="text-align: right;">Last State</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ {% for mirror in mirrors %}
+ {% for stat in mirrors[mirror]['Stats'] %}
+ <tr>
+ <td>{{ mirror }}</td>
+ {% if type == "all" %}<td>{{ stat['Type'] }}</td>{% endif %}
+ <td>{{ stat['Protocol'] }}</td>
+ <td>{{ stat['StateHistory'] }}</td>
+ <td>{{ stat['ProbeHistory'] }}</td>
+ <td style="text-align: right;">
+ {% if stat['StatusLastProbe'] == "ok" %}
+ <span class="badge badge-success">OK</span>
+ {% elif stat['StatusLastProbe'] == "hangs" %}
+ <span class="badge badge-danger">Hangs</span>
+ {% elif stat['StatusLastProbe'] == "no_time" %}
+ <span class="badge badge-danger">No Time</span>
+ {% elif stat['StatusLastProbe'] == "site_not_found" %}
+ <span class="badge badge-danger">Site Not Found</span>
+ {% elif stat['StatusLastProbe'] == "'-1'" %}
+ <span class="badge badge-danger">-1</span>
+ {% else %}
+ <span class="badge badge-warning">{{ stat['StatusLastProbe'] }}</span>
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ {% endfor %}
+
+ </tbody>
+ </table>
+
+ </div>
+ </div>
+ </div>
+
+
+ <footer>
+ <div class="container">
+ <div class="row">
+ <div class="col-12 offset-md-2 col-md-7">
+ <h3 class="footerhead">Gentoo Mirrorstats</h3>
+ <div class="row">
+ <div class="col-xs-12 col-md-4">
+ <span class="kk-group-header">Mirror Data as current of</span><br>{{ lastUpdate }}
+ </div>
+ <div class="col-xs-12 col-md-4">
+ <span>Data powered by:</span><br><a href="http://www.staff.science.uu.nl/~penni101/mirmon/">Mirmon v2.11</a>
+ </div>
+ <div class="col-xs-12 col-md-4">
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-md-3">
+ <h3 class="footerhead">Questions or comments?</h3>
+ Please feel free to <a href="https://www.gentoo.org/inside-gentoo/contact/">contact us</a>.
+ <p class="mt-2"><a href="https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/">Gentoo Mirrorstats</a></p>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-2 col-sm-3 col-md-2">
+ <ul class="footerlinks three-icons">
+ <li><a href="https://twitter.com/gentoo" title="@Gentoo on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li>
+ <li><a href="https://www.facebook.com/gentoo.org" title="Gentoo on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li>
+ <li><a href="https://www.reddit.com/r/Gentoo/" title="Gentoo on Reddit"><span class="fa fa-reddit-alien fa-fw"></span></a></li>
+ </ul>
+ </div>
+ <div class="col-10 col-sm-9 col-md-10">
+ <strong>© 2001–2020 Gentoo Foundation, Inc.</strong><br>
+ <small>
+ Gentoo is a trademark of the Gentoo Foundation, Inc.
+ The contents of this document, unless otherwise expressly stated, are licensed under the
+ <a href="https://creativecommons.org/licenses/by-sa/4.0/" rel="license">CC-BY-SA-4.0</a> license.
+ The <a href="https://www.gentoo.org/inside-gentoo/foundation/name-logo-guidelines.html">Gentoo Name and Logo Usage Guidelines</a> apply.
+ </small>
+ </div>
+ </div>
+ </div>
+ </footer>
+
+ <script>
+ var mirrorLocations = {{locations}};
+ </script>
+
+
+ <script src="https://assets.gentoo.org/tyrian/v2/jquery-3.3.slim.js"></script>
+ <script src="https://assets.gentoo.org/tyrian/v2/popper.min.js"></script>
+ <script src="https://assets.gentoo.org/tyrian/v2/bootstrap.min.js"></script>
+
+ <script src="https://www.gentoo.org/assets/js/leaflet.js"></script>
+
+ <script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.20/rg-1.1.1/datatables.min.js"></script>
+
+ <script>
+
+ $(function() {
+ L.Icon.Default.imagePath = 'https://www.gentoo.org/assets/img/maps/';
+ var map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2);
+ var markers = {};
+
+ map.addLayer(new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors' }));
+
+
+ var greenIcon = new L.Icon({
+ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
+ shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ popupAnchor: [1, -34],
+ shadowSize: [41, 41]
+ });
+
+ var orangeIcon = new L.Icon({
+ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-gold.png',
+ shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ popupAnchor: [1, -34],
+ shadowSize: [41, 41]
+ });
+
+ var redIcon = new L.Icon({
+ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png',
+ shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ popupAnchor: [1, -34],
+ shadowSize: [41, 41]
+ });
+
+
+
+ $.each(mirrorLocations, function(index, mirror) {
+ if(mirror.Location){
+ lat = mirror.Location.split(",")[0];
+ long = mirror.Location.split(",")[1];
+
+ ok = 0;
+ for (let i = 0; i < mirror.Stats.length; i++){
+ if(mirror.Stats[i].StatusLastProbe == "ok"){
+ ok++;
+ }
+ }
+
+ if(ok == mirror.Stats.length){
+ marker = L.marker([lat, long], {icon: greenIcon}).addTo(map);
+ }else if(ok == 0){
+ marker = L.marker([lat, long], {icon: redIcon}).addTo(map);
+ }else{
+ marker = L.marker([lat, long], {icon: orangeIcon}).addTo(map);
+ }
+
+ popupText = "<h4 class='mt-2'> " + mirror.Hostname + "</h4>";
+
+ popupText += "<table class='table'><tr>{% if type == 'all' %}<th>Type</th>{% endif %}<th>Protocol</th><th>Probe History</th><th>Last Probe</th></tr>";
+ for (let i = 0; i < mirror.Stats.length; i++){
+ probeHistory = "";
+ for (let j = 0; j < mirror.Stats[i].ProbeHistory.length; j++) {
+ if(mirror.Stats[i].ProbeHistory[j] == "s"){
+ probeHistory += '<i class="fa fa-fw fa-check" style="color:#28a745;" aria-hidden="true"></i>';
+ }else{
+ probeHistory += '<i class="fa fa-fw fa-times" style="color:#dc3545;" aria-hidden="true"></i>';
+ }
+ }
+
+ lastProbeStatus = mirror.Stats[i].StatusLastProbe;
+
+ if(lastProbeStatus == "ok"){
+ lastProbeStatus = '<span class="badge badge-success">OK</span>';
+ } else if(lastProbeStatus == "hangs"){
+ lastProbeStatus = '<span class="badge badge-danger">Hangs</span>';
+ } else if(lastProbeStatus == "no_time"){
+ lastProbeStatus = '<span class="badge badge-danger">No Time</span>';
+ } else if(lastProbeStatus == "site_not_found"){
+ lastProbeStatus = '<span class="badge badge-danger">Site Not Found</span>';
+ } else if(lastProbeStatus == "'-1'"){
+ lastProbeStatus = '<span class="badge badge-danger">-1</span>';
+ } else {
+ lastProbeStatus = '<span class="badge badge-warning">' + lastProbeStatus + '</span>';
+ }
+
+ popupText += "<tr>{% if type == 'all' %}<td>" + mirror.Stats[i].Type + "</td>{% endif %}<td>" + mirror.Stats[i].Protocol + "</td><td>" + probeHistory + "</td><td>" + lastProbeStatus + "</td></tr>";
+ }
+ popupText += "</table>";
+
+
+ marker.bindPopup(popupText, {
+ minWidth : 500,
+ maxWidth : 600,
+ maxHeight : 260,
+ });
+
+ markers[index] = marker;
+ }
+ });
+ });
+ </script>
+
+ <script>
+
+ $(document).ready( function () {
+ $('#table_id').DataTable({
+ "autoWidth": true,
+ "iDisplayLength": 25,
+ // TODO Group by Region in future
+ // rowGroup: {
+ // dataSrc: 1
+ // }
+ "columnDefs": [
+ {
+ "render": function ( data, type, row ) {
+ state_str = data.split("-")[data.split("-").length-1];
+ result = "";
+
+ for (let i = 0; i < state_str.length; i++){
+ if(state_str[i] == 's'){
+ result += '<i class="fa fa-check" style="color:#28a745;width:1rem;text-align:center;" aria-hidden="true"></i>\n';
+ }else{
+ result += '<i class="fa fa-times" style="color:#dc3545;width:1rem;text-align:center;" aria-hidden="true"></i>\n';
+ }
+ }
+
+ return result;
+ },
+ "targets": "statusHistory"
+ },
+ ]
+ });
+ } );
+
+ </script>
+
+ </body>
+</html>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-03 22:54 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-03 22:54 UTC (permalink / raw
To: gentoo-commits
commit: 7f9568e9554cf7d174535eceff778a40aa499cd0
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun May 3 22:53:06 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun May 3 22:53:06 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=7f9568e9
Use absolute path for the html template folder
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/html/generate.py b/html/generate.py
index d6f21c0..33a3cd5 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -20,6 +20,7 @@ import xml.etree.ElementTree as ET
import jinja2
html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/"
+template_folder = "/var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/html/"
cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json"
@@ -147,7 +148,7 @@ def getHostList(mirrorstatsList):
#
# render jinja2
#
-templateLoader = jinja2.FileSystemLoader(searchpath="./")
+templateLoader = jinja2.FileSystemLoader(searchpath=template_folder)
templateEnv = jinja2.Environment(loader=templateLoader)
## stats
@@ -174,5 +175,3 @@ with open(cache_path, 'w') as fp:
# finish
#
print("Finished.")
-
-
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-03 22:54 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-03 22:54 UTC (permalink / raw
To: gentoo-commits
commit: e11cf4a53e7086c2afd51a55d287de45daba4951
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun May 3 22:53:55 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun May 3 22:53:55 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=e11cf4a5
Use separate folder for the html pages
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index 33a3cd5..abb7100 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -19,7 +19,7 @@ import urllib.request, json
import xml.etree.ElementTree as ET
import jinja2
-html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/"
+html_folder = "/var/www/mirrorstats.gentoo.org/htdocs/new/"
template_folder = "/var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/html/"
cache_path = "/var/www/mirrorstats.gentoo.org/var/html_data_cache.json"
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-03 23:08 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-03 23:08 UTC (permalink / raw
To: gentoo-commits
commit: 65aa6442fc6d8cc3d5688255911667bd133b97fc
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun May 3 23:07:46 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun May 3 23:07:46 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=65aa6442
Use index.html instead of all.html for the landing page
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 4 +++-
html/help.jinja2 | 2 +-
html/stats.jinja2 | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/html/generate.py b/html/generate.py
index abb7100..8ab5898 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -69,12 +69,14 @@ def getIp(hostname):
def renderStatsTemplate(templateEnv, page):
if page == "all":
mirrorstatsList = mirrorstats
+ page_name = "index"
else:
mirrorstatsList = ['https://mirrorstats.gentoo.org/' + page + '/state.json']
+ page_name = page
lastUpdate, hostList = getHostList(mirrorstatsList)
template = templateEnv.get_template("stats.jinja2")
- template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page + ".html")
+ template.stream(lastUpdate=lastUpdate, type=page, mirrors=hostList, locations=json.dumps(hostList)).dump(html_folder + page_name + ".html")
return lastUpdate
diff --git a/html/help.jinja2 b/html/help.jinja2
index 6e08363..678e649 100644
--- a/html/help.jinja2
+++ b/html/help.jinja2
@@ -55,7 +55,7 @@
</div>
<div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse">
<ul class="navbar-nav mr-auto">
- <li class="nav-item"><a class="nav-link" href="all.html">Home</a></li>
+ <li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="rsync.html">Rsync</a></li>
<li class="nav-item"><a class="nav-link" href="distfiles.html">Distfiles</a></li>
<li class="nav-item"><a class="nav-link" href="snapshots.html">Snapshots</a></li>
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index e13cd45..35f012a 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -57,7 +57,7 @@
</div>
<div class="collapse navbar-collapse navbar-main-collapse" id="navbar-main-collapse">
<ul class="navbar-nav mr-auto">
- <li class="nav-item {%if type == 'all'%}active{%endif%}"><a class="nav-link" href="all.html">Home</a></li>
+ <li class="nav-item {%if type == 'all'%}active{%endif%}"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item {%if type == 'rsync'%}active{%endif%}"><a class="nav-link" href="rsync.html">Rsync</a></li>
<li class="nav-item {%if type == 'distfiles'%}active{%endif%}"><a class="nav-link" href="distfiles.html">Distfiles</a></li>
<li class="nav-item {%if type == 'snapshots'%}active{%endif%}"><a class="nav-link" href="snapshots.html">Snapshots</a></li>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-06 23:46 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-06 23:46 UTC (permalink / raw
To: gentoo-commits
commit: 695894f1f677c29fc65a2e660beeefa669820e89
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Wed May 6 23:46:16 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Wed May 6 23:46:16 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=695894f1
Use https everywhere
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/stats.jinja2 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 35f012a..9596930 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -77,7 +77,7 @@
<h1 class="first-header">Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} Mirrors
{% if type != "all" %}
<small class="ml-2 mt-2 float-right" style="font-size: 60%;">
- <a title="Json Data" class="mr-2 text-muted" href="/{{type}}/state.json"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path d="M5 3h2v2H5v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2a2 2 0 0 1-2-2V5h-2V3h2m-7 12a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1z" fill="#777777"/></svg></a>
+ <a title="Json Data" class="mr-2 text-muted" href="/{{type}}/state.json"><svg xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path d="M5 3h2v2H5v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2a2 2 0 0 1-2-2V5h-2V3h2m-7 12a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1z" fill="#777777"/></svg></a>
<a title="Original Mirmon Page" class="text-muted" href="/{{type}}/"><i class="fa fa-bar-chart" aria-hidden="true"></i></a>
</small>
{% endif %}
@@ -150,7 +150,7 @@
<span class="kk-group-header">Mirror Data as current of</span><br>{{ lastUpdate }}
</div>
<div class="col-xs-12 col-md-4">
- <span>Data powered by:</span><br><a href="http://www.staff.science.uu.nl/~penni101/mirmon/">Mirmon v2.11</a>
+ <span>Data powered by:</span><br><a href="https://www.staff.science.uu.nl/~penni101/mirmon/">Mirmon v2.11</a>
</div>
<div class="col-xs-12 col-md-4">
</div>
@@ -203,7 +203,7 @@
var map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2);
var markers = {};
- map.addLayer(new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors' }));
+ map.addLayer(new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors' }));
var greenIcon = new L.Icon({
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-07 18:18 Robin H. Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Robin H. Johnson @ 2020-05-07 18:18 UTC (permalink / raw
To: gentoo-commits
commit: 71512aa7cfffd1430c7aeb3409551a10da2a693b
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu May 7 17:53:13 2020 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu May 7 17:53:13 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=71512aa7
html/generate.py: disable success print spam
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
html/generate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index 025004d..8eb7622 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -176,4 +176,4 @@ with open(cache_path, 'w') as fp:
#
# finish
#
-print("Finished.")
+#print("Finished.")
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-07 18:18 Robin H. Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Robin H. Johnson @ 2020-05-07 18:18 UTC (permalink / raw
To: gentoo-commits
commit: b29132aafc10f1a3758b5145a84e320502e6f7d4
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu May 7 17:53:39 2020 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu May 7 18:18:10 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=b29132aa
html/generate.py: improve cache file handling
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
html/generate.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/html/generate.py b/html/generate.py
index 8eb7622..8d79cbe 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -15,6 +15,8 @@
import datetime
import socket
+import os
+import tempfile
import urllib.request, json
import xml.etree.ElementTree as ET
import jinja2
@@ -81,8 +83,12 @@ def renderStatsTemplate(templateEnv, page):
# read the cache
-with open(cache_path) as json_file:
- cache_data = json.load(json_file)
+if os.path.exists(cache_path):
+ with open(cache_path, mode='rt') as json_file:
+ try:
+ cache_data = json.load(json_file)
+ except:
+ pass
#
# The all mirrors that are present in the given list
@@ -169,8 +175,10 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html")
#
# write the cache
#
-with open(cache_path, 'w') as fp:
- json.dump(cache_data, fp)
+with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout:
+ json.dump(cache_data, fout)
+ os.chmod(fout.name, '0644')
+ os.replace(fout.name, cache_path)
#
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-07 20:25 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-07 20:25 UTC (permalink / raw
To: gentoo-commits
commit: 6f7e496c82c0f3f0c194e78691af8ba2e3a65b8e
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Thu May 7 20:25:15 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Thu May 7 20:25:15 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=6f7e496c
Fix os.chmod by using an int instead of a string
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index 8d79cbe..3d7c458 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -177,7 +177,7 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html")
#
with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout:
json.dump(cache_data, fout)
- os.chmod(fout.name, '0644')
+ os.chmod(fout.name, 644)
os.replace(fout.name, cache_path)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-05-07 20:44 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-05-07 20:44 UTC (permalink / raw
To: gentoo-commits
commit: 30f11878cf9a37ba3ab5759db5d0546be4e6f0d5
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Thu May 7 20:44:12 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Thu May 7 20:44:12 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=30f11878
Fix the chmod by using the 0o prefix
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index 3d7c458..d88e030 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -177,7 +177,7 @@ template.stream(lastUpdate=lastUpdate).dump(html_folder + "help.html")
#
with tempfile.NamedTemporaryFile(dir=os.path.dirname(cache_path), delete=False, mode='wt') as fout:
json.dump(cache_data, fout)
- os.chmod(fout.name, 644)
+ os.chmod(fout.name, 0o644)
os.replace(fout.name, cache_path)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-06-07 19:54 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-06-07 19:54 UTC (permalink / raw
To: gentoo-commits
commit: d4c309a69808b12c6e70532b6b295bf0d1b4d5e4
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Thu May 7 21:00:14 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Thu May 7 21:00:14 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=d4c309a6
Add an option to show all entries in the datatable
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/stats.jinja2 | 1 +
1 file changed, 1 insertion(+)
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 9596930..22fb50d 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -307,6 +307,7 @@
$('#table_id').DataTable({
"autoWidth": true,
"iDisplayLength": 25,
+ "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
// TODO Group by Region in future
// rowGroup: {
// dataSrc: 1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-06-07 19:54 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-06-07 19:54 UTC (permalink / raw
To: gentoo-commits
commit: dfbd3fa53c78c389bf99940c6726a417e2d52cfb
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 7 19:53:36 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun Jun 7 19:53:36 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=dfbd3fa5
Check TLS version and display it in the table
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/generate.py | 31 +++++++++++++++++++++++++++++++
html/stats.jinja2 | 29 ++++++++++++++++++++++++-----
2 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/html/generate.py b/html/generate.py
index d88e030..a4b75e8 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -15,6 +15,7 @@
import datetime
import socket
+import ssl
import os
import tempfile
import urllib.request, json
@@ -64,6 +65,19 @@ def getIp(hostname):
ip = ""
return ip
+#
+# Get TLS version of the given host
+#
+def getTLSVersion(hostname):
+ socket.setdefaulttimeout(2)
+ try:
+ with socket.create_connection((hostname, 443)) as sock:
+ with ssl.create_default_context().wrap_socket(sock, server_hostname=hostname) as ssock:
+ return ssock.version().replace("TLSv", "", 1)
+ except:
+ print("err")
+ return ''
+
#
# Render the stats template for a given page, i.e. all, rsync, distfiles...
@@ -87,6 +101,12 @@ if os.path.exists(cache_path):
with open(cache_path, mode='rt') as json_file:
try:
cache_data = json.load(json_file)
+ if 'ips' not in cache_data:
+ cache_data['ips'] = {}
+ if 'hosts' not in cache_data:
+ cache_data['hosts'] = {}
+ if 'tls_version' not in cache_data:
+ cache_data['tls_version'] = {}
except:
pass
@@ -150,6 +170,17 @@ def getHostList(mirrorstatsList):
# populate cache with new value
cache_data['ips'][ip] = mirrorGeoData['loc']
+ for host in hosts:
+ if 'https' not in hosts[host]['Protocols']:
+ hosts[host]['TLSVersion'] = ''
+ continue
+ if host in cache_data['tls_version']:
+ hosts[host]['TLSVersion'] = cache_data['tls_version'][host]
+ else:
+ tlsVersion = getTLSVersion(host)
+ hosts[host]['TLSVersion'] = tlsVersion
+ cache_data['tls_version'][host] = tlsVersion
+
return lastUpdate, hosts
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 22fb50d..02b50ff 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://assets.gentoo.org/tyrian/v2/tyrian.min.css" rel="stylesheet" media="screen">
<link href="https://www.gentoo.org/assets/css/leaflet.css" rel="stylesheet" media="screen">
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.20/datatables.min.css"/>
+ <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/>
<link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
</head>
@@ -100,6 +100,7 @@
<th>Protocol</th>
<th class="statusHistory">Daily Stats</th>
<th class="statusHistory">Probe Stats</th>
+ <th class="hide">TLS</th>
<th style="text-align: right;">Last State</th>
</tr>
</thead>
@@ -113,6 +114,7 @@
<td>{{ stat['Protocol'] }}</td>
<td>{{ stat['StateHistory'] }}</td>
<td>{{ stat['ProbeHistory'] }}</td>
+ <td>{{ mirrors[mirror]['TLSVersion'] }}</td>
<td style="text-align: right;">
{% if stat['StatusLastProbe'] == "ok" %}
<span class="badge badge-success">OK</span>
@@ -194,7 +196,7 @@
<script src="https://www.gentoo.org/assets/js/leaflet.js"></script>
- <script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.20/rg-1.1.1/datatables.min.js"></script>
+ <script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.js"></script>
<script>
@@ -302,9 +304,9 @@
</script>
<script>
-
+ var table;
$(document).ready( function () {
- $('#table_id').DataTable({
+ table = $('#table_id').DataTable({
"autoWidth": true,
"iDisplayLength": 25,
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
@@ -330,7 +332,24 @@
},
"targets": "statusHistory"
},
- ]
+ {
+ "targets": 'hide',
+ "visible": false
+ }
+ ],
+ buttons: [
+ {
+ extend: 'colvis',
+ columns: ':not(.noVis)'
+ }
+ ],
+ "initComplete": function( settings, json ) {
+ setTimeout(function(){
+ table.buttons().container().prependTo($('#table_id_length'));
+ $('#table_id_length').prepend("<span class='mr-1'> Show </span>");
+ document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4";
+ }, 200);
+ }
});
} );
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-06-07 20:17 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-06-07 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 5e1952bf1d469fdfa23402ff60e9525c693a4194
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 7 20:17:32 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun Jun 7 20:17:32 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=5e1952bf
Show the tls version for https mirrors only
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/stats.jinja2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 02b50ff..98d8474 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -114,7 +114,7 @@
<td>{{ stat['Protocol'] }}</td>
<td>{{ stat['StateHistory'] }}</td>
<td>{{ stat['ProbeHistory'] }}</td>
- <td>{{ mirrors[mirror]['TLSVersion'] }}</td>
+ <td>{% if stat['Protocol'] == "https" %}{{ mirrors[mirror]['TLSVersion'] }}{% endif %}</td>
<td style="text-align: right;">
{% if stat['StatusLastProbe'] == "ok" %}
<span class="badge badge-success">OK</span>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-06-07 20:39 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-06-07 20:39 UTC (permalink / raw
To: gentoo-commits
commit: 0c18044a46251aeefb66a8145f75d964ccbe691c
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 7 20:39:47 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun Jun 7 20:39:47 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0c18044a
Add filters
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/stats.jinja2 | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 98d8474..482a2cf 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -8,6 +8,13 @@
<link href="https://www.gentoo.org/assets/css/leaflet.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/>
<link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
+ <style>
+ .filter-button, .filter-button:hover {
+ color: #495057;
+ background-color: #fff;
+ border: 1px solid #ced4da;
+ }
+ </style>
</head>
<body>
@@ -345,6 +352,7 @@
],
"initComplete": function( settings, json ) {
setTimeout(function(){
+ $('#table_id_length').prepend("<button onclick='addFilters();' class='btn btn-outline-secondary filter-button btn-sm mr-4'>Toggle Filters</button>");
table.buttons().container().prependTo($('#table_id_length'));
$('#table_id_length').prepend("<span class='mr-1'> Show </span>");
document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4";
@@ -353,6 +361,29 @@
});
} );
+ function addFilters(){
+
+ if($("#filterRow").length) {
+ $("#filterRow").remove();
+ }else{
+ $('#table_id thead tr').clone(true).appendTo('#table_id thead');
+ $('#table_id thead tr:eq(1)').attr("id", "filterRow");
+ $('#table_id thead tr:eq(1) th').each(function (i) {
+ var title = $(this).text();
+ $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+ $('input', this).on('keyup change', function () {
+ if (table.column(i).search() !== this.value) {
+ table
+ .column(i)
+ .search(this.value)
+ .draw();
+ }
+ });
+ });
+ }
+ }
+
</script>
</body>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2020-06-07 21:55 Max Magorsch
0 siblings, 0 replies; 16+ messages in thread
From: Max Magorsch @ 2020-06-07 21:55 UTC (permalink / raw
To: gentoo-commits
commit: a0bd86ca404ac92f7751c6407445cb51419c44d0
Author: Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 7 21:55:13 2020 +0000
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun Jun 7 21:55:13 2020 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=a0bd86ca
Enlarge the page when using the filters
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>
html/stats.jinja2 | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 482a2cf..9c04d5a 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -78,7 +78,7 @@
</header>
- <div class="container">
+ <div id="map_container" class="container">
<div class="row">
<div class="col-md-12">
<h1 class="first-header">Gentoo {% if type != "all" %}{{ type[0]|upper}}{{type[1:]}}{%endif%} Mirrors
@@ -98,6 +98,12 @@
<div id="mirrorLocations" style="height: 500px; margin-bottom: 1em;"></div>
</div>
+ </div>
+ </div>
+
+ <div id="table_container" class="container">
+ <div class="row">
+
<div class="col-md-12 my-4">
<table id="table_id" class="display table">
<thead>
@@ -207,9 +213,13 @@
<script>
- $(function() {
+ var map;
+ function drawMap() {
+ if(map){
+ map.remove();
+ }
L.Icon.Default.imagePath = 'https://www.gentoo.org/assets/img/maps/';
- var map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2);
+ map = L.map('mirrorLocations', { zoomAnimationThreshold: 9 } ).setView([30, 0], 2);
var markers = {};
map.addLayer(new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 2, maxZoom: 8, attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors' }));
@@ -307,7 +317,9 @@
markers[index] = marker;
}
});
- });
+ }
+
+ drawMap();
</script>
<script>
@@ -352,7 +364,7 @@
],
"initComplete": function( settings, json ) {
setTimeout(function(){
- $('#table_id_length').prepend("<button onclick='addFilters();' class='btn btn-outline-secondary filter-button btn-sm mr-4'>Toggle Filters</button>");
+ $('#table_id_length').prepend("<button onclick='addFilters();' class='btn btn-outline-secondary filter-button btn-sm mr-4'>Filters & Fullscreen</button>");
table.buttons().container().prependTo($('#table_id_length'));
$('#table_id_length').prepend("<span class='mr-1'> Show </span>");
document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4";
@@ -363,6 +375,25 @@
function addFilters(){
+ if(document.getElementById("table_container").classList == "container"){
+ document.getElementById("table_container").classList = "container-fluid"
+ }else{
+ document.getElementById("table_container").classList = "container";
+ }
+
+ if(document.getElementById("map_container").classList == "container"){
+ document.getElementById("map_container").classList = "container-fluid"
+ }else{
+ document.getElementById("map_container").classList = "container";
+ }
+
+ setTimeout(function() {
+ drawMap();
+ $("#table_id").width($("#table_container").width());
+ table.columns.adjust();
+ }, 200);
+
+
if($("#filterRow").length) {
$("#filterRow").remove();
}else{
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2024-09-14 21:49 Robin H. Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Robin H. Johnson @ 2024-09-14 21:49 UTC (permalink / raw
To: gentoo-commits
commit: 257405af5bed5716c4e1e89ae0d163b5baf0a663
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 14 21:48:53 2024 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Sep 14 21:48:53 2024 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=257405af
fix: handle mirror_url fetch errors
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
html/generate.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index a4b75e8..2d6ed2b 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -120,7 +120,13 @@ def getHostList(mirrorstatsList):
# process all mirrors
for mirror_url in mirrorstatsList:
- mirrorData = getJson(mirror_url)
+ mirrorData = None
+ try:
+ mirrorData = getJson(mirror_url)
+ except Exception as err:
+ print("Exception fetching "+mirror_url+": ", err)
+ continue
+
lastUpdate = datetime.datetime.fromtimestamp(int(mirrorData['LastUpdate'])).strftime('%Y-%m-%d %H:%M:%S')
for mirror in mirrorData['Mirrors']:
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
@ 2024-09-14 21:51 Robin H. Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Robin H. Johnson @ 2024-09-14 21:51 UTC (permalink / raw
To: gentoo-commits
commit: 7153c73288fc8302039877b95958408a968295c6
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 14 21:51:31 2024 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Sep 14 21:51:31 2024 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=7153c732
fix: improve exception output
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
html/generate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/generate.py b/html/generate.py
index 2d6ed2b..0ec4e4b 100755
--- a/html/generate.py
+++ b/html/generate.py
@@ -124,7 +124,7 @@ def getHostList(mirrorstatsList):
try:
mirrorData = getJson(mirror_url)
except Exception as err:
- print("Exception fetching "+mirror_url+": ", err)
+ print("Exception fetching "+mirror_url+": ", type(err).__name__, err)
continue
lastUpdate = datetime.datetime.fromtimestamp(int(mirrorData['LastUpdate'])).strftime('%Y-%m-%d %H:%M:%S')
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-09-14 21:51 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-03 22:47 [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/ Max Magorsch
-- strict thread matches above, loose matches on Subject: below --
2020-05-03 22:54 Max Magorsch
2020-05-03 22:54 Max Magorsch
2020-05-03 23:08 Max Magorsch
2020-05-06 23:46 Max Magorsch
2020-05-07 18:18 Robin H. Johnson
2020-05-07 18:18 Robin H. Johnson
2020-05-07 20:25 Max Magorsch
2020-05-07 20:44 Max Magorsch
2020-06-07 19:54 Max Magorsch
2020-06-07 19:54 Max Magorsch
2020-06-07 20:17 Max Magorsch
2020-06-07 20:39 Max Magorsch
2020-06-07 21:55 Max Magorsch
2024-09-14 21:49 Robin H. Johnson
2024-09-14 21:51 Robin H. Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox