<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>M/Monit Admin | Hosts</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/admin/admin_hosts.css?version=430">
</head>
<body>
    <?cs include:"img/icons.svg" ?>
    <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"><span>Dashboard</span></a>
                        </li>
                        <li>
                            <a target="webapp" href="../../status/hosts/"><span>Status</span></a>
                        </li>
                        <li>
                            <a target="webapp" href="../../reports/analytics/"><span>Reports</span></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 class="active">
                            <?cs if:#Request.Param.IsAdmin ?>
                            <a target="webapp" href="../../admin/general/"><span>Admin</span></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">
<?cs if:#Request.Param.IsAdmin ?>
            <div id="title">
                <a href="#" id="help" class="help-button" title="Help" data-help="#helpbox"></a>
                <h1>
                    Hosts
                </h1>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    Hosts with Monit agents. Click on a row to change the settings for the host. <a href="#"
                    id="more">More...</a>
                    <span id="moretext">
                        Monit will automatically create a new Host entry the first time it reports in to M/Monit. To make Monit
                        report to M/Monit, please use the <code>set mmonit</code> statement in your <code>.monitrc</code> file.
                        After Monit has registered itself in M/Monit you can edit the Host in the table below. See also the <a
                        href="https://mmonit.com/documentation/">M/Monit manual</a> for more details.
                    </span>
                </div> <!-- span12 -->
            </div> <!-- row-fluid -->
            <div class="row-fluid yui-skin-sam">
                <div>
                    <div class="toright nowrap">
                        <div class="btn-group dropdown" id="purgeInactiveHostsButton" style="display: none;">
                            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
                                Delete inactive<span class="hidden-phone"> Hosts older than</span>?
                            </button>
                            <ul class="dropdown-menu" role="menu" data-bind="foreach: inactiveMenu">
                                <li data-bind="event: {vclick:$root.confirmDeleteInactive}, css:{disabled: id == 0}">
                                    <a tabindex="-1" href="" data-bind="html: name"></a>
                                </li>
                            </ul>
                        </div>
                        <button class="btn btn-danger btn-small" id="purgeHostsButton" style="display: none;">
                            Delete<span class="hidden-phone"> Hosts</span>?
                        </button>
                        <div class="btn-group">
                            <button id="search-reset" title="reset search" class="close">&times;</button>
                            <input class="searchfield" id="searchfield" placeholder="Find host.." size="15">
                        </div>
                    </div>
                    <div class="toleft numHosts">Number of Hosts: <span id="numHosts">0</span></div>
                </div>
                <div id="hostTable" class="span12"></div>
            </div> <!-- row-fluid -->
<?cs /if ?>
        </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 -->
    <!-- Confirm Delete Dialog -->
    <div id="confirmDelete" class="modal hide">
        <div class="modal-body">
            <h2>Delete <span class="text-error"></span>?</h2>
            <p>Are you sure you want to remove this host from the system? All events for the host will be removed as well. There is no undo.</p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">Cancel</button>
            <button class="btn btn-danger" data-dismiss="modal" id="deletebtn">Delete</button>
        </div>
    </div>
    <div id="confirmPurgeHosts" class="modal hide">
        <div class="modal-body">
            <h2>
                <span class="text-error">Warning:</span> Delete <span class="deletenumberofhosts"></span> hosts?
            </h2>
            <p>
                Are you sure you want to remove these hosts from the system? All events for the hosts will be removed as well. There is no undo.
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">Cancel</button>
            <button class="btn btn-danger" data-dismiss="modal" id="performPurgeHosts">Confirm</button>
        </div>
    </div>
    <div id="confirmDeleteInactive" class="modal hide">
        <div class="modal-body">
            <h2>
                Delete inactive hosts older than <span data-bind="text:selectedInactiveInterval().name"></span>?
            </h2>
            <p>
                If you press [Confirm], hosts which have been inactive for more than <span data-bind="text:selectedInactiveInterval().name"></span>
                will be deleted from the database. Are you sure?  There is no undo.
            </p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal">Cancel</button>
            <button class="btn btn-danger" data-dismiss="modal" data-bind="click: $root.performDeleteInactive">Confirm</button>
        </div>
    </div>
    <div id="helpbox">
        <div class="title"><h2>Hosts</h2></div>
        <div class="content paragraphify">
            <p>
                This page list all hosts with Monit agents registered in the system. Click on a row to change the settings for the host.
                Monit will automatically create a new Host entry the first time it reports in to M/Monit.
                To make Monit report to M/Monit, use the <code>set mmonit</code> statement in your <code>.monitrc</code> file.
                After Monit has registered itself in M/Monit you can edit the Host in the table below.
            </p>
            <p>
                The “Find host..” search field above the Host table can be used to quickly filter the table on host name.
            </p>
            <h3>
                Remove Hosts
            </h3>

            <p>
                You can use the <em>search field</em> to find hosts you want to delete. If search produce a result, a
                [<em>Delete Hosts?</em>] button appear. Click this button to delete all hosts present in the search
                result. You will be asked to confirm that you really want to delete the hosts first.
                There is no undo, so use with caution. Please note that if Monit continue to run on a host
                it will register itself again in M/Monit.
            </p>
            <h3>
                Remove inactive Hosts
            </h3>
            <p>
                Inactive hosts are hosts where Monit has been gracefully
                shutdown or hosts that have been turned-off and now reports a heart-beat failure to M/Monit (because Monit was not gracefully stopped).
                Such hosts are typical virtual host which you spin-up in the cloud with Monit installed and then take down later.
            </p>
            <p>
                A [<em>Delete inactive Hosts older than?</em>] button will appear above the Hosts table if inactive hosts exist in the system.
                Click the button and select between different intervals for how long ago Monit last reported in to M/Monit. Let's say you select
                1 hour. Then, all Hosts that <em>last</em> reported into M/Monit more than an hour ago will be removed.
                Be careful though, if you temporary have stopped Monit on a host and plan to start it up again later. By using this function
                you might inadverently delete such hosts and loose all its history.
            </p>
            <h3>
                Host LED & Host Status
            </h3>
            <p>
                The LED icon represents the Host's Error State as reported by Monit. The Host Status is associated, but specifically represents
                the Host's reporting state. The Host LED incorporates both the reporting state and any additional error states where:
                <ul class="led">
                    <li class="red">
                        Error - Either the host did not report in or all services are down
                    </li>
                    <li class="orange">
                        Warning - At least one service is down or in unmonitored mode.
                    </li>
                    <li class="green">
                        OK - All services are up and running
                    </li>
                    <li class="grey">
                        Host is in Ignored or in Inactive state.
                    </li>
                </ul>
            </p>
            <p>
                <i class="icon-info-sign"></i>
                <em>This page does not auto-refresh as it lists all hosts registered in the system. Loading the table can be resource-intensive, so manual
                refresh is required to see updates.</em>
            </p>
        </div> <!-- content -->
    </div> <!-- helpbox -->
    <script src="../../lib/f/knockout/knockout.js?version=430"></script>
    <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/twbootstrap/js/bootstrap.js?version=430"></script>
    <script src="../../lib/js/error.js?version=430"></script>
    <script src="../../lib/js/datatable.js?version=430"></script>
    <script src="../../lib/js/help.js?version=430"></script>
    <script src="../../lib/js/csrf.js?version=430"></script>
    <script src="../../assets/admin/admin_hosts.js?version=430"></script>
</body>
</html>
