mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Added Performance menu to System and add pollers page
This commit is contained in:
		@@ -446,6 +446,13 @@ if ($_SESSION['userlevel'] >= '10')
 | 
			
		||||
           <li><a href="edituser/"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li>
 | 
			
		||||
           <li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>
 | 
			
		||||
           <li role="presentation" class="divider"></li>
 | 
			
		||||
           <li class="dropdown-submenu">
 | 
			
		||||
               <a href="#"><img src="images/16/clock.png" alt="Performance" width="16" height="16" /> Performance</a>
 | 
			
		||||
               <ul class="dropdown-menu scrollable-menu">
 | 
			
		||||
                    <li><a href="/performance/tab=pollers/"><img src="images/16/clock_link.png" alt="Pollers" width="16" height="16" /> Pollers</a></li>
 | 
			
		||||
               </ul>
 | 
			
		||||
           </li>
 | 
			
		||||
           <li role="presentation" class="divider"></li>
 | 
			
		||||
           <li class="dropdown-submenu">
 | 
			
		||||
           <a href="#"><img src="images/16/building.png" border="0" align="absmiddle" /> API</a>
 | 
			
		||||
           <ul class="dropdown-menu scrollable-menu">
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								html/pages/performance.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								html/pages/performance.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * LibreNMS
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify it
 | 
			
		||||
 * under the terms of the GNU General Public License as published by the
 | 
			
		||||
 * Free Software Foundation, either version 3 of the License, or (at your
 | 
			
		||||
 * option) any later version.  Please see LICENSE.txt at the top level of
 | 
			
		||||
 * the source code distribution for details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
echo('<ul class="nav nav-tabs">');
 | 
			
		||||
 | 
			
		||||
$perf_tabs = array(array("name" => 'Pollers', 'icon' => 'clock_link'));
 | 
			
		||||
 | 
			
		||||
foreach ($perf_tabs as $tab) {
 | 
			
		||||
    echo('
 | 
			
		||||
            <li>
 | 
			
		||||
                <a href="/performance/'. lcfirst($tab["name"]) .'">
 | 
			
		||||
                   <img src="images/16/'. $tab["icon"] .'.png" align="absmiddle" border="0"> ' . $tab["name"] . '
 | 
			
		||||
                </a>
 | 
			
		||||
            </li>');
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo ('</ul>');
 | 
			
		||||
 | 
			
		||||
if (isset($vars['tab'])) {
 | 
			
		||||
    require_once "pages/performance/".mres($vars['tab']).".inc.php";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										52
									
								
								html/pages/performance/pollers.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								html/pages/performance/pollers.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * LibreNMS
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify it
 | 
			
		||||
 * under the terms of the GNU General Public License as published by the
 | 
			
		||||
 * Free Software Foundation, either version 3 of the License, or (at your
 | 
			
		||||
 * option) any later version.  Please see LICENSE.txt at the top level of
 | 
			
		||||
 * the source code distribution for details.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
<br />
 | 
			
		||||
<div class="table-responsive">
 | 
			
		||||
    <table class="table table-striped table-bordered table-hover table-condensed">
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>Poller Name</th>
 | 
			
		||||
            <th>Devices Polled</th>
 | 
			
		||||
            <th>Total Poll Time</th>
 | 
			
		||||
            <th>Last Ran</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
$query = "SELECT *,UNIX_TIMESTAMP(NOW()) AS `now`, UNIX_TIMESTAMP(`last_polled`) AS `then` FROM `pollers`";
 | 
			
		||||
 | 
			
		||||
foreach (dbFetchRows($query) as $poller) {
 | 
			
		||||
    $old = $poller['now'] - $poller['then'];
 | 
			
		||||
    if ($old > 600) {
 | 
			
		||||
        $row_class = 'danger';
 | 
			
		||||
    } elseif ($old >= 280 && $old <= 300) {
 | 
			
		||||
        $row_class = 'warning';
 | 
			
		||||
    } else {
 | 
			
		||||
        $row_class = 'success';
 | 
			
		||||
    }
 | 
			
		||||
    echo('
 | 
			
		||||
        <tr class="'.$row_class.'">
 | 
			
		||||
            <td>'.$poller['poller_name'].'</td>
 | 
			
		||||
            <td>'.$poller['devices'].'</td>
 | 
			
		||||
            <td>'.$poller['time_taken'].' Seconds</td>
 | 
			
		||||
            <td>'.$poller['last_polled'].'</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
    </table>
 | 
			
		||||
</div>
 | 
			
		||||
		Reference in New Issue
	
	Block a user