summaryrefslogtreecommitdiff
blob: 22fb50d1f77734be4be4c61e6f82d3c501dae0c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!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="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>
            <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="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 %}
        </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="https://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('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({
        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,
        "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
        // 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>