<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>M/Monit Reports | Host Uptime</title>
    <meta name="theme-color" content="#3D3E40">
    <meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-title" content="M/Monit" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
    <link rel="apple-touch-icon" href="../../img/apple-touch-icon.png"/>
    <link rel="manifest" href="../../img/manifest.webmanifest">
    <script src="../../lib/js/appearance.js"></script>
    <link rel="stylesheet" href="../../lib/css/styles.css?version=430">
    <link rel="stylesheet" href="../../assets/reports/uptime.css?version=430">
</head>
<body>
    <div id="wrap">
        <div id="fixed-header">
            <div id="fake-status-bar"></div>
            <div id="header">
                <div id="nav">
                    <a id="logo" target="webapp" href="../../"></a>
                    <a id="logout" title="Logout" target="webapp" href="../../login/logout.csp"></a>
                    <ul id="menu">
                        <li>
                            <a target="webapp" href="../../index.csp">Dashboard</a>
                        </li>
                        <li>
                            <a target="webapp" href="../../status/hosts/">Status</a>
                        </li>
                        <li class="active">
                            <a target="webapp" href="../../reports/analytics/">Reports</a>
                            <ul>
                                <li><a target="webapp" href="../../reports/analytics/">Analytics</a></li>
                                <li><a target="webapp" href="../../reports/uptime/">Uptime</a></li>
                                <li><a target="webapp" href="../../reports/events/">Events</a></li>
                            </ul>
                        </li>
                        <li>
                            <?cs if:#Request.Param.IsAdmin ?>
                            <a target="webapp" href="../../admin/general/">Admin</a>
                            <ul>
                                <li><a target="webapp" href="../../admin/general/">General</a></li>
                                <li><a target="webapp" href="../../admin/hosts/">Hosts</a></li>
                                <li><a target="webapp" href="../../admin/groups/">Groups</a></li>
                                <li><a target="webapp" href="../../admin/users/">Users</a></li>
                                <li><a target="webapp" href="../../admin/roles/">Roles</a></li>
                                <li><a target="webapp" href="../../admin/alerts/">Alerts</a></li>
                                <li><a target="webapp" href="../../admin/settings/">Settings</a></li>
                            </ul>
                            <?cs else ?>
                            <a target="webapp" href="../../admin/users/edit?id=<?cs var:Request.Param.RemoteUserId ?>"><span>Profile</span></a>
                            <?cs /if ?>
                        </li>
                        <li id="logout-phone"><a target="webapp" href="../../login/logout.csp">Logout</a></li>
                    </ul>
                </div> <!-- nav -->
            </div><!-- header -->
        </div><!-- fixed-header -->
        <div id="main">
            <div id="title">
                <a href="#" id="help" class="help-button" title="Help" data-help="#helpbox"></a>
                <h1>
                    Hosts uptime
                </h1>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <div class="pagination nav">
                        <span id="spinner" style="display:none;"></span>
                        <ul class="range cursor-pointer">
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 0)}" class="range0"><span>1D</span></li>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 4)}" class="range4"><span>1W</span></li>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 5)}" class="range5"><span>1M</span></li>
<?cs if:#RangeMax >= 6 ?>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 6)}" class="range6"><span>3M</span></li>
<?cs /if ?>
<?cs if:#RangeMax >= 7 ?>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 7)}" class="range7"><span>6M</span></li>
<?cs /if ?>
<?cs if:#RangeMax >= 8 ?>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 8)}" class="range8"><span>1Y</span></li>
<?cs /if ?>
                            <li data-bind="event: {vclick: $root.rangeUpdate.bind($data, 11)}" class="range11">
                                <span><i class="icon-cog"></i></span>
                                <div class="drop-down-box dateInputBox" data-bind="visible: shouldShowDateInput" style="display:none;">
                                    <div class="content tocenter">
                                        <h2>Select Date</h2>
                                        <div class="btn-group btn-block">
                                            <button class="btn btn-block" id="datefrom" data-date-format="yyyy-mm-dd" data-date="1970-01-01"><span class="caret"></span><span data-bind="text: datefromLabel"></span></button>
                                        </div>
                                        <div class="btn-group btn-block">
                                            <button class="btn btn-block" id="dateto" data-date-format="yyyy-mm-dd" data-date="1970-01-01"><span class="caret"></span><span data-bind="text: datetoLabel"></span></button>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <ul class="tableView">
                        <li>
                            <span>Range</span>
                            <span class="accessory" data-bind="text: range"></span>
                        </li>
                        <li>
                            <span>Hosts Uptime</span>
                            <span class="accessory" data-bind="text: uptime() + (uptime() !== 'N/A' ? '%' : '')"></span></li>
                        <li>
                            <span>Hosts Downtime</span>
                            <span class="accessory" data-bind="text: downtime"></span>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="row-fluid yui-skin-sam">
                <div class="span12">
                    <input class="searchfield toright" id="searchField" placeholder="Find host.." size="15" data-bind="visible: showSearch()">
                    <div id="mytable"></div>
                </div>
            </div>
        </div> <!-- main -->
    </div> <!-- wrap -->
    <div id="footer">
        <div class="toleft hidden-phone">Logged in as <?cs var:Request.RemoteUser ?></div>
        <div class="toright hidden-phone">
            <ul class="piped">
                <li>Copyright &copy; 2024 <a href="https://tildeslash.com/">Tildeslash</a>. All Rights Reserved.</li>
                <li><a href="https://mmonit.com/">M/Monit</a></li>
                <li><a href="https://mmonit.com/monit/">Monit</a></li>
                <li><a href="https://mmonit.com/wiki/">Wiki</a></li>
            </ul>
        </div>
        <div id="copy" class="visible-phone">Copyright &copy; 2024 <a href="https://tildeslash.com/">Tildeslash</a>. All Rights Reserved.</div>
    </div> <!-- footer -->
    <!-- Help -->
    <div id="helpbox">
        <div class="title">
            <h2>Uptime Help</h2>
        </div>
        <div class="content paragraphify">
            <p>
                This table show uptime and downtime of hosts that are monitored by M/Monit. Hosts with downtime include hosts that are actually down, the network
                from M/Monit to the host is down or hosts where Monit was not gracefully stopped.
            </p>
            <p>
                If Monit does not send a status message within 3 poll cycles (this can be changed in <a target="webapp" href="../../admin/hosts/">admin/hosts</a>
                as skew time) M/Monit will assume the host is down and raise a <i>status</i> <span class="red">failed</span> event. This event is associated with
                the "monit" service and can be seen in the events log and in the status page as "No report from Monit. Last report was..." When Monit start
                sending status messages again, M/Monit will raise a <i>status</i> <span class="green">succeed</span> event. This can be seen in the events log as
                "Monit status report received successfully". The uptime in the table below is based on both succeeded and failed <i>status</i> events. Resolution
                is in minutes and the combined downtime for a host must accumulate to at least one minute to appear as downtime for the host in the table.
            </p>
            <h3>Selecting a date range</h3>
            <p>
                Click a time range button [1D 1W 1M 3M 6M 1Y] to select a date range. The range’s from and to date can be seen in the range row. The from
                date is the first and today’s date the second. Choosing 1D sets the range from midnight today and until now. 1W sets the range from 7 days in the
                past and until now, 1M is one month with blast from the past and so on.
            </p>
            <h3>
                Average uptime and downtime
            </h3>
            <p>
                The average uptime and downtime of all hosts are displayed in the table as percent uptime and actual downtime. Inactive or ignored hosts are not
                included in the average unless they have downtime.
            </p>
            <h3>
                How uptime/downtime is calculated:
            </h3>
            <ol class="numbered-list">
                <li>
                    If a matching failed and succeeded event is found within the selected date range, the difference in time between the two events are
                    counted as downtime.
                </li>
                <li>
                    For open ended failed events, that is; failed events without a matching succeed event, the downtime is counted as the difference between
                    <em>now</em> and the failed event's timestamp.
                </li>
                <li>
                    If a host has not reported a status message within the selected range, the host is assumed to be down <em>if and only if the host is active and
                    its last updated timestamp is older than the selected range's to-date</em>. In this case the difference in time between now and the host's last
                    updated timestamp is added to the host's downtime.
                </li>
                <li>
                    Inactive and ignored hosts are not included in the total average numbers <em>unless</em> they have downtime. Their uptime/downtime is set
                    to zero if they have no downtime within the range. You can see inactive and ignored hosts in the table with a grey name.
                </li>
            </ol>
            <h3>
                Events
            </h3>
            <p>
                The Events column show number of status events for the host <i>within</i> the selected range. Clicking an
                event link brings up the events log with drill-down filters preset to only show status events for the
                host/monit and within the selected range. To see service events, click the host in the table below.
            </p>
            <h3>
                Host filter
            </h3>
            <p>
                If you monitor more than 15 hosts, a host search field is displayed at the top of the table. The search field can be used to focus on selected
                hosts and the table remains filtered even if the date range changes. To reset, remove all text in the search field.
            </p>
        </div>
    </div>
    <script src="../../lib/f/yui/2/utilities/utilities.js?version=430"></script>
    <script src="../../lib/f/jquery/jquery.js?version=430"></script>
    <script src="../../lib/f/jquery/jquery.mobile.vmouse.js?version=430"></script>
    <script src="../../lib/js/webapp.js?version=430"></script>
    <script src="../../lib/f/knockout/knockout.js?version=430"></script>
    <script src="../../lib/f/twbootstrap/js/bootstrap.js?version=430"></script>
    <script src="../../lib/f/datepicker/js/bootstrap-datepicker.js?version=430"></script>
    <script src="../../lib/f/strftime/strftime.js?version=430"></script>
    <script src="../../lib/js/error.js?version=430"></script>
    <script src="../../lib/js/math.js?version=430"></script>
    <script src="../../lib/js/ui.js?version=430"></script>
    <script src="../../lib/js/datatable.js?version=430"></script>
    <script src="../../lib/js/help.js?version=430"></script>
    <script src="../../assets/reports/uptime.js?version=430"></script>
    <script>
    var loader = new YAHOO.util.YUILoader({
        base: '../../lib/f/yui/2/',
        loadOptional: false,
        require: ['datasource','datatable','json'],
        onSuccess: function() {
            YAHOO.util.Event.onDOMReady(function() {
                var myReportConfig = {
                    columnLabel:   "Host",
                    homepath:      "../../",
                    monit:         "<?cs var:Monit_ServiceNameId ?>",
                    rowsclickable: true
                };
                Report.start(myReportConfig);
            }); // onDOMReady
        } // onSuccess
    });
    loader.insert();
    </script>
</body>
</html>
