MIRMON(1) | User Contributed Perl Documentation | MIRMON(1) |
mirmon - monitor the state of mirrors
mirmon [-v] [-q] [-t timeout] [-c conf] [-get all⎪update⎪url url]
./mirmon.conf $HOME/.mirmon.conf /etc/mirmon.conf
The program is intended to be run by cron every hour.
42 * * * * perl /path/to/mirmon -get update
It quietly probes a subset of the sites in a given list, writes the results in the 'state' file and generates a web page with the results. The subset contains the sites that are new, bad and/or not probed for a specified time.
When no 'get' option is specified, the program just generates a new web page from the last known state.
The program checks the mirrors by running a (user specified) program on a pipe. A (user specified) number of probes is run in parallel using nonblocking IO. When something can be read from the pipe, it switches the pipe to blocking IO and reads one line from the pipe. Then it flushes and closes the pipe. No attempt is made to kill the probe.
The probe should return something that looks like
1043625600 ...
that is, a line of text starting with a timestamp. The exit status of the probe is ignored.
location
A config file can be specified with the -c option. If -c is not used, the program looks for a config file in
syntax
A config file looks like this :
+-------------------------------------------------- ⎪# lines that start with '#' are comment ⎪# blank lines are ignored too ⎪# tabs are replaced by a space ⎪ ⎪# the config entries are 'key' and 'value' pairs ⎪# a 'key' begins in column 1 ⎪# the 'value' is the rest of the line ⎪somekey A_val B_val ... ⎪otherkey X_val Y_val ... ⎪ ⎪# indented lines are glued ⎪# the next three lines mean 'somekey part1 part2 part3' ⎪somekey part1 ⎪ part2 ⎪ part3 ⎪ ⎪# lines starting with a '+' are concatenated ⎪# the next three lines mean 'somekey part1part2part3' ⎪somekey part1 ⎪+ part2 ⎪+ part3 ⎪ ⎪# lines starting with a '.' are glued too ⎪# don't use a '.' on a line by itself ⎪# 'somekey' gets the value "part1\n part2\n part3" ⎪somekey part1 ⎪. part2 ⎪. part3 +--------------------------------------------------
required entries
project_name Apache project_name CTAN
project_url http://www.apache.org/
mirror_list /path/to/mirror-list
If your mirror list is generated by a program, use
mirror_list /path/to/program arg1 ... ⎪
Two formats are supported :
us http://www.tux.org/ [email] ... nl http://apache.cs.uu.nl/dist/ [email] ... nl rsync://archive.cs.uu.nl/apache-dist/ [email] ...
ftp us ftp://ftp.tux.org/pub/net/apache/dist/ user@tux.org ... http nl http://apache.cs.uu.nl/dist/ user@cs.uu.nl ...
Note that in style 'plain' the third item is reserved for an optional email address : the site's contact address.
Specify the required format with option "list_style" (see below). The default style is 'plain'.
If/when the web_page lives in directory ".../mirmon/" and the icons live in directory ".../mirmon/icons/", specify
icons icons
If/when the icons live in "/path/to/DOCUMENTROOT/icons/mirmon/", specify
icons /icons/mirmon
probe /usr/bin/wget -q -O - -T %TIMEOUT% -t 1 %URL%TIME.txt
Before the program is started, %TIMEOUT% and %URL% are substituted with the proper timeout and url values.
Here it is assumed that each hour the root server writes a timestamp in /path/to/archive/TIME.txt, for instance with a crontab entry like
42 * * * * perl -e 'print time, "\n"' > /path/to/archive/TIME.txt
Mirmon reads one line of output from the probe and interprets the first word on that line as a timestamp ; for example :
1043625600 1043625600 Mon Jan 27 00:00:00 2003 1043625600 www.apache.org Mon Jan 27 00:00:00 2003
Mirmon is distributed with a program "probe" that handles ftp, http and rsync urls.
The program reads this file on startup and writes the file when mirrors are probed (-get is specified).
us - United States nl - Netherlands
The mirmon package contains a recent ISO list.
Fake domains like Backup, Master are
allowed, and are listed first in the report ; lowercase-first fake
domains (like backup) are listed last.
optional entries
After the last probe is started, the program waits for <timeout> + 10 seconds, cleans up and exits.
project_logo /icons/apache.gif project_logo http://www.apache.org/icons/...
htm_head <link REL=StyleSheet HREF="/style.css" TYPE="text/css">
htm_top testing 1, 2, 3
htm_foot <HR> <A HREF="..."><IMG SRC="..." BORDER=0></A> <HR>
Sites are not probed if the last probe was less than 'min_poll' ago. So, if you specify
min_poll 4h max_poll 12h
the 'reachable' sites are probed twice daily and the 'unreachable' sites are probed at most six times a day.
The default 'min_poll' is '1h' (1 hour). The default 'max_poll' is '4h' (4 hours).
The default 'min_sync' is '1d' (1 day).
Sites exceeding the limit will be considered 'old'. The default 'max_sync' is '2d' (2 days).
always_get Master Tier1
This is intended for fake regions like Master etc.
If you don't want this behaviour, use no_randomize.
If you don't want this behaviour, use no_add_slash.
See the description of 'mirror_list' above. The default list_style is 'plain'.
When access to a site is restricted (in Australia, for instance), another (sometimes secret) url can be used to probe the site. The <site> of an url is the part between '://' and the first '/'.
The specified file is processed 'in situ'. After the specified file is read and processed, config processing is resumed in the file where the "include" was encountered. The include depth is unlimited. However, it is a fatal error to include a file twice under the same name.
The state file consists of lines; one line per site. Each line consists of white space separated fields. The seven fields are :
general
https://svn.science.uu.nl/repos/project.mirmon/trunk/
http://www.staff.science.uu.nl/~penni101/mirmon/mirmon.tar.gz
installation suggestions
To install and configure mirmon, take the following steps :
cd DOCUMENTROOT mkdir mirmon
For DOCUMENTROOT, substitute the full pathname of the document root of your webserver.
cd /usr/local/src svn checkout REPO mirmon
where
REPO = https://svn.science.uu.nl/repos/project.mirmon/trunk/
or download the package and unpack it.
cd mirmon
touch state.txt
mkdir DOCUMENTROOT/mirmon/icons cp icons/* DOCUMENTROOT/mirmon/icons
nl http://archive.cs.uu.nl/your-project/ contact@cs.uu.nl uk http://mirrors.this.org/your-project/ mirrors@this.org us http://mirrors.that.org/your-project/ mirrors@that.org
The email addresses are optional.
# lines must start in the first column ; no leading white space project_name .... project_url .... mirror_list mirror_list state state.txt countries countries.list web_page DOCUMENTROOT/mirmon/index.html icons /mirmon/icons probe /usr/bin/wget -q -O - -T %TIMEOUT% -t 1 %URL%TIME.txt
This assumes the project's timestamp is in file "TIME.txt".
probe perl /usr/local/src/mirmon/probe -t %TIMEOUT% %URL%TIME.txt
perl mirmon -v -get all
The mirmon report should now be in 'DOCUMENTROOT/mirmon/index.html'
http://www.your.project.org/mirmon/
cd /usr/local/src/mirmon svn status -u svn up
(c) 2003-2016 Henk P. Penning Faculty of Science, Utrecht University http://www.staff.science.uu.nl/~penni101/ -- penning@uu.nl mirmon-2.11 - Sat Jul 23 09:12:31 2016 ; henkp
2016-07-23 | perl v5.8.8 |