commit: 92e5c14c71eb10d67d6880be56e8aab860f97092 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Tue Apr 28 07:42:33 2020 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Tue Apr 28 07:43:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=92e5c14c
mirrorstats: track experimental & releases seperately Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> experimental_mirrors/get-mirror-list-distfiles.rb | 18 ++++++++++++++++++ experimental_mirrors/mirmon.conf | 23 +++++++++++++++++++++++ mirmon-experimental.sh | 18 ++++++++++++++++++ mirmon-releases.sh | 18 ++++++++++++++++++ releases_mirrors/get-mirror-list-distfiles.rb | 18 ++++++++++++++++++ releases_mirrors/mirmon.conf | 23 +++++++++++++++++++++++ 6 files changed, 118 insertions(+) diff --git a/experimental_mirrors/get-mirror-list-distfiles.rb b/experimental_mirrors/get-mirror-list-distfiles.rb new file mode 100755 index 0000000..0794df3 --- /dev/null +++ b/experimental_mirrors/get-mirror-list-distfiles.rb @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml" + +%w[ rexml/document open-uri ].each {|lib| require lib } + +m = URI.parse(MIRROR_DATA).read +x = REXML::Document.new(m) + +REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| + country = el.attributes['country'] + + el.each_element('mirror/uri/') do |mirror| + puts "#{country.downcase} #{mirror[0].to_s}" + end + +} + diff --git a/experimental_mirrors/mirmon.conf b/experimental_mirrors/mirmon.conf new file mode 100644 index 0000000..b27bea0 --- /dev/null +++ b/experimental_mirrors/mirmon.conf @@ -0,0 +1,23 @@ +project_name Gentoo Linux (experimental) +web_page /var/www/mirrorstats.gentoo.org/htdocs/experimental/index-wip.html +icons ../icons +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list +mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/g.mirrors +state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%experimental/.timestamp-experimental.x +project_url http://www.gentoo.org/ +project_logo http://www.gentoo.org/images/gentoo-new.gif + + +# Fresh: 0 - 8h +# Oldish: 8 - 24h +# Old: 24h - inf +# Bad: No reachable, no state saved + +max_poll 4h +min_sync 4h +max_sync 20h + +put_histo top +timeout 30 + diff --git a/mirmon-experimental.sh b/mirmon-experimental.sh new file mode 100644 index 0000000..f76a3d3 --- /dev/null +++ b/mirmon-experimental.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors +# Grab mirrors from the web +[[ -d ./var ]] || mkdir ./var +./get-mirror-list-experimental.rb > ./var/g.mirrors +# fatal if the state file is NOT present. +[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +# run mirmon +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +# Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/experimental ]] || mkdir ../../htdocs/experimental +sed \ + -e 's#mirrors</H2>#<a href="http://www.gentoo.org/main/en/mirrors2.xml">mirrors</a></H2>#' \ + >../../htdocs/experimental/index.html <../../htdocs/experimental/index-wip.html +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/experimental_mirrors/var/mirmon.state \ + > ../../htdocs/experimental/state.json diff --git a/mirmon-releases.sh b/mirmon-releases.sh new file mode 100644 index 0000000..a6bf5fd --- /dev/null +++ b/mirmon-releases.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors +# Grab mirrors from the web +[[ -d ./var ]] || mkdir ./var +./get-mirror-list-releases.rb > ./var/g.mirrors +# fatal if the state file is NOT present. +[[ -e ./var/mirmon.state ]] || touch ./var/mirmon.state +# run mirmon +/usr/bin/perl ../../mirmon/mirmon -c ./mirmon.conf -q -get update +# Set up a nice link to our mirror page directly: +[[ -d ../../htdocs/releases ]] || mkdir ../../htdocs/releases +sed \ + -e 's#mirrors</H2>#<a href="http://www.gentoo.org/main/en/mirrors2.xml">mirrors</a></H2>#' \ + >../../htdocs/releases/index.html <../../htdocs/releases/index-wip.html +# Generate a json file containing the state of each mirror +../json/generate-json.py /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/mirmon.state \ + > ../../htdocs/releases/state.json diff --git a/releases_mirrors/get-mirror-list-distfiles.rb b/releases_mirrors/get-mirror-list-distfiles.rb new file mode 100755 index 0000000..0794df3 --- /dev/null +++ b/releases_mirrors/get-mirror-list-distfiles.rb @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +MIRROR_DATA="https://api.gentoo.org/mirrors/distfiles.xml" + +%w[ rexml/document open-uri ].each {|lib| require lib } + +m = URI.parse(MIRROR_DATA).read +x = REXML::Document.new(m) + +REXML::XPath.each(x, '//*/mirrorgroup[@country]') {|el| + country = el.attributes['country'] + + el.each_element('mirror/uri/') do |mirror| + puts "#{country.downcase} #{mirror[0].to_s}" + end + +} + diff --git a/releases_mirrors/mirmon.conf b/releases_mirrors/mirmon.conf new file mode 100644 index 0000000..45b55e0 --- /dev/null +++ b/releases_mirrors/mirmon.conf @@ -0,0 +1,23 @@ +project_name Gentoo Linux (releases) +web_page /var/www/mirrorstats.gentoo.org/htdocs/releases/index-wip.html +icons ../icons +countries /var/www/mirrorstats.gentoo.org/mirmon/countries.list +mirror_list /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/g.mirrors +state /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/releases_mirrors/var/mirmon.state +probe /var/www/mirrorstats.gentoo.org/gentoo-mirrorstats/probe-mirmon %TIMEOUT% %URL%releases/.timestamp-releases.x +project_url http://www.gentoo.org/ +project_logo http://www.gentoo.org/images/gentoo-new.gif + + +# Fresh: 0 - 8h +# Oldish: 8 - 24h +# Old: 24h - inf +# Bad: No reachable, no state saved + +max_poll 4h +min_sync 4h +max_sync 20h + +put_histo top +timeout 30 +