<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>M/Monit Reports | Service 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">
            <ul class="breadcrumb">
                <li><a href="../">Uptime</a> <span class="divider">/</span></li>
                <li class="active"><?cs var:html_escape(Host.name) ?></li>
            </ul>
            <div id="title">
                <a href="#" id="help" class="help-button" title="Help" data-help="#helpbox"></a>
                <h1>
                    <span id="servicename">Services uptime <?cs var:html_escape(Host.name) ?></span>
                </h1>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <div class="pagination">
                        <div id="spinner" class="toleft"></div>
                        <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>Range<span class="accessory" data-bind="text: range"></span></li>
                        <li><span>Services Uptime</span><span class="accessory" data-bind="text: uptime() + (uptime() !== 'N/A' ? '%' : '')"></span></li>
                        <li><span>Services 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 service.." 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 -->
    <div id="helpbox">
        <div class="title">
            <h2>Uptime Help</h2>
        </div>
        <div class="content paragraphify">
            <p>
                This table show uptime/downtime of services monitored by Monit on the host <?cs var:html_escape(Host.name) ?>. The uptime in the table is based on both
                succeeded and failed events. Resolution is in minutes and the combined downtime for a service must accumulate to at least one minute to appear as
                downtime for the service in the table.
            </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 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>
            </ol>
            <p></p>
            <p class="dropcap">
                &beta;This report work around the fact that Monit does not maintain services (failed) state over a Monit restart/reload nor during service un-monitoring. If
                the host stops sending status to M/Monit, the downtime is added to the Monit service only and not to all services, as it's not clear whether it is the Monit
                application itself that is down (crashed), if the host is completely down or if the network connection to M/Monit is down. This may add some
                inaccuracy to the computed downtime, though in practice it should work well. However, because of these exceptions this report is a beta and the numbers
                should be seen as more informative than authoritative.
            </p>
            <h3>
                Grayed out entries:
            </h3>
            <ul>
                <li>
                    If the host is inactive or ignored, all services in the table are grey.
                </li>
                <li>
                    Services that are in an unmonitored state are marked as grey. Their uptime/downtime is set to zero unless they have actual downtime within
                    the selected date range. Unmonitored services are not included in the total average numbers <em>unless</em> they have downtime.
                </li>
                <li>
                    Services that once existed in your Monit control file (.monitrc) and since has been removed may show up if the selected range is wide enough.
                </li>
            </ul>
            <p>
                The Events column show number of events for the service <i>within</i> the selected range. Clicking the event link brings up the events log with
                drill-down filters preset to only show events for the service and within the selected range.
            </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:   "Service",
                    homepath:      "../../../",
                    host:          "<?cs var:html_escape(Host.name) ?>",
                    hostid:        "<?cs var:Host.id ?>",
                    rowsclickable: false
                };
                Report.start(myReportConfig);
            }); // onDOMReady
        } // onSuccess
    });
    loader.insert();
    </script>
</body>
</html>
