[% USE date %]
[% PROCESS _header.tt %]
[% PROCESS _message.tt %]

[% WRAPPER _avail_report_header.tt %]
  [% IF servicegroup == 'all' %]
  All Servicegroups
  [% ELSE %]
  Servicegroup '[% servicegroup %]'
  [% END %]
[% END %]

[% FOR groupname IN groups.keys.sort %]
  [% SET g = groups.$groupname        %]
  [% SET servicegroupname = groupname %]
  [%# set hosts to the keys of services #%]
  [% SET hosts    = g.services %]
  [% SET services = g.services %]
  [% PROCESS avail_report_hosts_part.tt %]
  [% PROCESS avail_report_services_part.tt %]
[% END %]

[% PROCESS _footer.tt %]
