<%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';
	$server => 'k.root-servers.net';
	$shift =>'0h';
	$af => 'ipv4';
</%args>

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

	$ARGS{server} = $server;
	$ARGS{af} = $af;

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

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


<div id="server_overview_head"> Server Overview for <b><% $server %></b> (<% $af %>) [ serving:
% my %myARGS = map { $_ => $ARGS{$_}} grep {/^(af)$/} keys %ARGS;
% foreach my $domain ($m->comp('/lib/rrdplots:server_domains',srv => $server, af => $af)) {
<a href="<& /lib/url, path => '/dns-servmon/domain/', query => { %myARGS, domain => ${domain} } &> "><% $domain %></a> 
% }
]
</div>

% $m->flush_buffer;

% if ($m->comp('/lib/rrdplots:known_server', srv => $server, af=>$af)) {

<table id="server_overview_plots" summary="Overview of server plots" >
	<tr>
		<td>
			Last 24 Hours<br />
			<& /lib/rrdplots:plot_s_drops, srv=>$server, start=>$t, stop=>$t2-1, scale=> '475', fuzzy=>1, af=>$af &>
		</td>
		<td>
			Last 48 Hours<br />
			<& /lib/rrdplots:plot_s_drops, srv=>$server, start=>$t - $DAY, stop=>$t2-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Previous 7 days<br />
			<& /lib/rrdplots:plot_s_drops, srv=>$server, start=>$t-$DAY*6-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
		<td>
			Previous 14 days<br />
			<& /lib/rrdplots:plot_s_drops, srv=>$server, start=>$t-$DAY*13-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Last 24 Hours<br />
			<& /lib/rrdplots:plot_s_delay, srv=>$server, start=>$t, stop=>$t2-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
		<td>
			Last 48 Hours<br />
			<& /lib/rrdplots:plot_s_delay, srv=>$server, start=>$t - $DAY, stop=>$t2-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
	</tr><tr>
% $m->flush_buffer;
		<td>
			Previous 7 days<br />
			<& /lib/rrdplots:plot_s_delay, srv=>$server, start=>$t-$DAY*6-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
		<td>
			Previous 14 days<br />
			<& /lib/rrdplots:plot_s_delay, srv=>$server, start=>$t-$DAY*13-($t->epoch%$DAY), stop=>$t2-($t2->epoch%$DAY)-1, scale => '475', fuzzy=>1, af=>$af &>
		</td>
	</tr>
</table>
% } else {
<p><strong>This server has no <% $af %> coverage by DNSMon</strong></p>
% }

<%once>
	use Time::Piece;

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