<%doc>
############################################################################
###    (C)opyright 2003 - 2008 RIPE NCC
###    This file is part of DNSMon
###
###    DNSMon is free software: you can redistribute it and/or modify
###    it under the terms of the GNU General Public License as published by
###    the Free Software Foundation, either version 3 of the License, or
###    (at your option) any later version.
###
###    DNSMon is distributed in the hope that it will be useful,
###    but WITHOUT ANY WARRANTY; without even the implied warranty of
###    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
###    GNU General Public License for more details.
###
###    You should have received a copy of the GNU General Public License
###    along with DNSMon.  If not, see <http://www.gnu.org/licenses/>.
############################################################################
</%doc>
<%args>
	$day => '';
	$month => '';
	$year => '';
	$hour => '';
	$period => '24h';
	$probe => 'tt01.ripe.net';
	$shift =>'0h';
	$af => 'ipv4';
</%args>

<%perl>
	if ($day) {	# escape to a manual plot
		$m->comp('plot', %ARGS);
		return;
	}

	$ARGS{probe} = $probe;
	$ARGS{af} = $af;

	my $t2 = $m->comp('/lib/rrdplots:last_val_probe', probe=> $probe, af=>$af);
	my $t = $t2 - $DAY;
</%perl>

<&| /lib/fillform, subs => \%ARGS &>
	<div id="select_probe">
		<form name="Probes" action="/dns-servmon/probe/" method="get">
			<& /lib/rrdplots:select_probe, af=>$af &>
			<input type="hidden" name="af" value="<% $ARGS{af} %>" />
			<input type="submit" value="SHOW" name="show" />
		</form>
	</div>
</&>

<div id="probe_overview_head">
	Probe Overview for <b><% $probe %></b> (<% $af %>)
</div>
% $m->flush_buffer;

% if ($m->comp('/lib/rrdplots:known_probe', mon => $probe, af=>$af)) {

<table id="probe_overview_plots" summary="Overview of probe plots">
	<tr>
		<td>
			Last 24 Hours<br />
			<& /lib/rrdplots:plot_p_drops, fuzzy=>1, probe=>$probe, start=>$t, stop=>$t2-1, scale => '475', af=>$af &>
		</td>
		<td>
			Last 48 Hours<br />
			<& /lib/rrdplots:plot_p_drops, fuzzy=>1, probe=>$probe, start=>$t - $DAY, stop=>$t2-1, scale => '475', af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Previous 7 days<br />
			<& /lib/rrdplots:plot_p_drops, fuzzy=>1, probe=>$probe, start=>$t-$DAY*6-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', af=>$af &>
		</td>
		<td>
			Previous 14 days<br />
			<& /lib/rrdplots:plot_p_drops, fuzzy=>1, probe=>$probe, start=>$t-$DAY*13-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Last 24 Hours<br />
			<& /lib/rrdplots:plot_p_delay, fuzzy=>1, probe=>$probe, start=>$t, stop=>$t2-1, scale => '475', af=>$af &>
		</td>
		<td>
			Last 48 Hours<br />
			<& /lib/rrdplots:plot_p_delay, fuzzy=>1, probe=>$probe, start=>$t - $DAY, stop=>$t2-1, scale => '475', af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Previous 7 days<br />
			<& /lib/rrdplots:plot_p_delay, fuzzy=>1, probe=>$probe, start=>$t-$DAY*6-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', af=>$af &>
		</td>
		<td>
			Previous 14 days<br />
			<& /lib/rrdplots:plot_p_delay, fuzzy=>1, probe=>$probe, start=>$t-$DAY*13-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', af=>$af &>
		</td>
	</tr>
</table>
% } else {
<p><strong>This DNSMon probe does not cover <% $af %> measurements</strong></p>
% }

<%once>
	use Time::Piece;

	my $DAY = Time::Piece->ONE_DAY;
	my $WEEK = Time::Piece->ONE_WEEK;
</%once>
