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

    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" width="33%">
          [% PROCESS _infobox.tt %]
          <table border="1" cellpadding="0" cellspacing="0" class='linkBox'>
            <tr>
              <td class='linkBox'>
                <a href='avail.cgi?host=all&amp;t1=[% start %]&amp;t2=[% end %]&amp;backtrack=[% backtrack %]&amp;assumestateretention=[% assumestateretention %]&amp;assumeinitialstates=[% assumeinitialstates %]&amp;assumestatesduringnotrunning=[% assumestatesduringnotrunning %]&amp;initialassumedhoststate=[% initialassumedhoststate %]&amp;initialassumedservicestate=[% initialassumedservicestate %]&amp;[% IF show_log_entries %]show_log_entries[% END %]&amp;showscheduleddowntime=[% showscheduleddowntime %]&amp;rpttimeperiod=[% rpttimeperiod %]'>View Availability Report For All Hosts</a><br>
                [% IF use_feature_trends %]<a href='trends.cgi?host=[% host | uri %]&amp;t1=[% start %]&amp;t2=[% end %]&amp;assumestateretention=[% assumestateretention %]&amp;assumeinitialstates=[% assumeinitialstates %]&amp;includesoftstates=[% includesoftstates %]&amp;assumestatesduringnotrunning=[% assumestatesduringnotrunning %]&amp;initialassumedhoststate=[% initialassumedhoststate %]&amp;backtrack=[% backtrack %]&amp;rpttimeperiod=[% rpttimeperiod %]'>View Trends For This Host</a><br>[% END %]
                [% IF use_feature_histogram %]<a href='histogram.cgi?host=[% host | uri %]&amp;t1=[% start %]&amp;t2=[% end %]&amp;assumestateretention=yes'>View Alert Histogram For This Host</a><br>[% END %]
                <a href='status.cgi?host=[% host | uri %]'>View Status Detail For This Host</a><br>
                <a href='history.cgi?host=[% host | uri %]'>View Alert History For This Host</a><br>
                <a href='notifications.cgi?host=[% host | uri %]'>View Notifications For This Host</a><br>
              </td>
            </tr>
          </table>
        </td>
        <td align="center" valign="top" width="33%">
          <div align="center" class='dataTitle'>
            Host '[% host %]'
          </div><br>

          <img src='[% url_prefix %]thruk/themes/[% theme %]/images/trends.gif' border="0" alt='Availability Report' title='Availability Report' width="20" height="20"><br clear="all">
          <div align="center" class='reportRange'>
            [% format_date(start, datetime_format) %] to [% format_date(end, datetime_format) %]
          </div>
          <div align="center" class='reportDuration'>
            Duration: [% SET dur = end - start %][% duration(dur) %]
          </div>
        </td>
        <td align="right" valign="bottom" width="33%">
          [% PROCESS avail_report_form_box.tt %]
          [% PROCESS _help.tt topic = "avail" %]
        </td>
      </tr>
    </table>

    <div align="center" class='reportTime'>[ Availability report completed in [% duration(time_token, 2) %] ]</div><br>
    <br>
    <div align="center" class='dataTitle'>Host State Breakdowns:</div>
    [% IF use_feature_trends %]
    <p align='center'>
      <a href='trends.cgi?host=[% host | uri %]&amp;t1=[% start %]&amp;t2=[% end %]&amp;includesoftstates=[% includesoftstates %]&amp;assumestateretention=[% assumestateretention %]&amp;assumeinitialstates=[% assumeinitialstates %]&amp;assumestatesduringnotrunning=[% assumestatesduringnotrunning %]&amp;initialassumedhoststate=[% initialassumedhoststate %]&amp;backtrack=[% backtrack %]&amp;rpttimeperiod=[% rpttimeperiod %]'><img src='trends.cgi?createimage&amp;smallimage&amp;host=[% host %]&amp;t1=[% start %]&amp;t2=[% end %]&amp;includesoftstates=[% includesoftstates %]&amp;assumestateretention=[% assumestateretention %]&amp;assumeinitialstates=[% assumeinitialstates %]&amp;assumestatesduringnotrunning=[% assumestatesduringnotrunning %]&amp;initialassumedhoststate=[% initialassumedhoststate %]&amp;backtrack=[% backtrack %]&amp;rpttimeperiod=[% rpttimeperiod %]' border="1" alt='Host State Trends' title='Host State Trends' width='500' height='20'></a><br>
    </p>
    [% END %]
    <div align="center">

    [% SET
        total_time_unknown =
              avail_data.hosts.$host.time_indeterminate_nodata
            + avail_data.hosts.$host.time_indeterminate_notrunning
            + avail_data.hosts.$host.time_indeterminate_outside_timeperiod
    %]
    [% SET
        total_time =
               avail_data.hosts.$host.time_up
            + avail_data.hosts.$host.time_down
            + avail_data.hosts.$host.time_unreachable
            + avail_data.hosts.$host.time_indeterminate_nodata
            + avail_data.hosts.$host.time_indeterminate_notrunning
            + avail_data.hosts.$host.time_indeterminate_outside_timeperiod
    %]
    [% SET
        total_time_known = total_time - total_time_unknown
    %]
      <table border="1" class='data'>
        <tr>
          <th class='data'>State</th>
          <th class='data'>Type / Reason</th>
          <th class='data'>Time</th>
          <th class='data'>% Total Time</th>
          <th class='data'>% Known Time</th>
        </tr>
        <tr class='dataEven'>
          <td class='hostUP' rowspan="3">UP</td>
          <td class='dataEven'>Unscheduled</td>
          <td class='dataEven'>[% duration(avail_data.hosts.$host.time_up - avail_data.hosts.$host.scheduled_time_up) %]</td>
          <td class='dataEven'>[% IF total_time > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_up - avail_data.hosts.$host.scheduled_time_up) / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataEven'>[% IF total_time_known > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_up - avail_data.hosts.$host.scheduled_time_up) / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataEven'>
          <td class='dataEven'>Scheduled</td>
          <td class='dataEven'>[% duration(avail_data.hosts.$host.scheduled_time_up) %]</td>
          <td class='dataEven'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_up / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataEven'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_up / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='hostUP'>
          <td class='hostUP'>Total</td>
          <td class='hostUP'>[% duration(avail_data.hosts.$host.time_up) %]</td>
          <td class='hostUP'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_up / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='hostUP'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_up / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataOdd'>
          <td class='hostDOWN' rowspan="3">DOWN</td>
          <td class='dataOdd'>Unscheduled</td>
          <td class='dataOdd'>[% duration(avail_data.hosts.$host.time_down - avail_data.hosts.$host.scheduled_time_down) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_down - avail_data.hosts.$host.scheduled_time_down) / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'>[% IF total_time_known > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_down - avail_data.hosts.$host.scheduled_time_down) / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataOdd'>
          <td class='dataOdd'>Scheduled</td>
          <td class='dataOdd'>[% duration(avail_data.hosts.$host.scheduled_time_down) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_down / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_down / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='hostDOWN'>
          <td class='hostDOWN'>Total</td>
          <td class='hostDOWN'>[% duration(avail_data.hosts.$host.time_down) %]</td>
          <td class='hostDOWN'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_down / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='hostDOWN'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_down / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataEven'>
          <td class='hostUNREACHABLE' rowspan="3">UNREACHABLE</td>
          <td class='dataEven'>Unscheduled</td>
          <td class='dataEven'>[% duration(avail_data.hosts.$host.time_unreachable - avail_data.hosts.$host.scheduled_time_unreachable ) %]</td>
          <td class='dataEven'>[% IF total_time > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_unreachable - avail_data.hosts.$host.scheduled_time_unreachable) / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataEven'>[% IF total_time_known > 0 %][% sprintf('%2.3f',(avail_data.hosts.$host.time_unreachable - avail_data.hosts.$host.scheduled_time_unreachable) / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataEven'>
          <td class='dataEven'>Scheduled</td>
          <td class='dataEven'>[% duration(avail_data.hosts.$host.scheduled_time_unreachable) %]</td>
          <td class='dataEven'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_unreachable / total_time * 100 ) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataEven'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.scheduled_time_unreachable / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='hostUNREACHABLE'>
          <td class='hostUNREACHABLE'>Total</td>
          <td class='hostUNREACHABLE'>[% duration(avail_data.hosts.$host.time_unreachable) %]</td>
          <td class='hostUNREACHABLE'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_unreachable / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='hostUNREACHABLE'>[% IF total_time_known > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_unreachable / total_time_known * 100) %]%[% ELSE %]0.000%[% END %]</td>
        </tr>
        <tr class='dataOdd'>
          <td class='dataOdd' rowspan="4">Undetermined</td>
          <td class='dataOdd'>Monitoring Not Running</td>
          <td class='dataOdd'>[% duration(avail_data.hosts.$host.time_indeterminate_notrunning) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_indeterminate_notrunning / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'></td>
        </tr>
        <tr class='dataOdd'>
          <td class='dataOdd'>Insufficient Data</td>
          <td class='dataOdd'>[% duration(avail_data.hosts.$host.time_indeterminate_nodata) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_indeterminate_nodata / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'></td>
        </tr>
        <tr class='dataOdd'>
          <td class='dataOdd'>Outside Timeperiod</td>
          <td class='dataOdd'>[% duration(avail_data.hosts.$host.time_indeterminate_outside_timeperiod) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',avail_data.hosts.$host.time_indeterminate_outside_timeperiod / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'></td>
        </tr>
        <tr class='dataOdd'>
          <td class='dataOdd'>Total</td>
          <td class='dataOdd'>[% duration(total_time_unknown) %]</td>
          <td class='dataOdd'>[% IF total_time > 0 %][% sprintf('%2.3f',total_time_unknown / total_time * 100) %]%[% ELSE %]0.000%[% END %]</td>
          <td class='dataOdd'></td>
        </tr>
        <tr class='dataEven'>
          <td class='dataEven'>All</td>
          <td class='dataEven'>Total</td>
          <td class='dataEven'>[% duration(total_time) %]</td>
          <td class='dataEven'>100.000%</td>
          <td class='dataEven'>100.000%</td>
        </tr>
      </table>
    </div>
    <br>
    <br>


    [% PROCESS avail_report_services_part.tt %]


[% IF show_log_entries or full_log_entries %]
    [% PROCESS avail_report_log_entries.tt %]
[% END %]

[% PROCESS _footer.tt %]
