mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Convert overview page to laravel (#10757)
* Convert overview page to laravel * Convert more pages * More fixes
This commit is contained in:
@@ -49,11 +49,10 @@ class LegacyController extends Controller
|
||||
$vars['page'] = basename($vars['page'] ?? '');
|
||||
if ($vars['page'] && is_file("includes/html/pages/" . $vars['page'] . ".inc.php")) {
|
||||
require "includes/html/pages/" . $vars['page'] . ".inc.php";
|
||||
} elseif (Config::has('front_page') && is_file('includes/html/' . Config::get('front_page'))) {
|
||||
require 'includes/html/' . Config::get('front_page');
|
||||
} else {
|
||||
require 'includes/html/pages/front/default.php';
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
$html = ob_get_clean();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Models\BgpPeer;
|
||||
use App\Models\Dashboard;
|
||||
use App\Models\Device;
|
||||
use App\Models\Port;
|
||||
use App\Models\Service;
|
||||
use App\Models\Syslog;
|
||||
use App\Models\UserPref;
|
||||
use App\Models\UserWidget;
|
||||
use App\Models\Widget;
|
||||
use Auth;
|
||||
use LibreNMS\Config;
|
||||
use Toastr;
|
||||
|
||||
class OverviewController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$view = Config::get('front_page');
|
||||
|
||||
if (view()->exists("overview.custom.$view")) {
|
||||
return view("overview.custom.$view");
|
||||
} elseif (method_exists($this, $view)) {
|
||||
return $this->{$view}($request);
|
||||
}
|
||||
|
||||
return $this->default($request);
|
||||
}
|
||||
|
||||
public function default(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$dashboards = Dashboard::allAvailable($user)->with('user:user_id,username')->get()->keyBy('dashboard_id');
|
||||
|
||||
// Split dashboards into user owned or shared
|
||||
list($user_dashboards, $shared_dashboards) = $dashboards->partition(function ($dashboard) use ($user) {
|
||||
return $dashboard->user_id == $user->user_id;
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (!empty($request->dashboard) && isset($dashboards[$request->dashboard])) {
|
||||
// specific dashboard
|
||||
$dashboard = $dashboards[$request->dashboard];
|
||||
} else {
|
||||
$user_default_dash = (int)UserPref::getPref($user, 'dashboard');
|
||||
$global_default = (int)Config::get('webui.default_dashboard_id');
|
||||
|
||||
// load user default
|
||||
if (isset($dashboards[$user_default_dash])) {
|
||||
$dashboard = $dashboards[$user_default_dash];
|
||||
// load global default
|
||||
} elseif (isset($dashboards[$global_default])) {
|
||||
$dashboard = $dashboards[$global_default];
|
||||
// load users first dashboard
|
||||
} elseif (!empty($user_dashboards)) {
|
||||
$dashboard = $user_dashboards->first();
|
||||
}
|
||||
|
||||
// specific dashboard was requested, but doesn't exist
|
||||
if (isset($dashboard) && !empty($request->dashboard)) {
|
||||
Toastr::error(
|
||||
"Dashboard <code>#$request->dashboard</code> does not exist! Loaded <code>
|
||||
".htmlentities($dashboard->dashboard_name)."</code> instead.",
|
||||
"Requested Dashboard Not Found!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($dashboard)) {
|
||||
$dashboard = Dashboard::create([
|
||||
'dashboard_name' => 'Default',
|
||||
'user_id' => $user->user_id,
|
||||
]);
|
||||
}
|
||||
|
||||
$data = $dashboard
|
||||
->widgets()
|
||||
->select(['user_widget_id','users_widgets.widget_id','title','widget','col','row','size_x','size_y','refresh'])
|
||||
->join('widgets', 'widgets.widget_id', '=', 'users_widgets.widget_id')
|
||||
->get();
|
||||
|
||||
if ($data->isEmpty()) {
|
||||
$data[] = array('user_widget_id'=>'0',
|
||||
'widget_id'=>1,
|
||||
'title'=>'Add a widget',
|
||||
'widget'=>'placeholder',
|
||||
'col'=>1,
|
||||
'row'=>1,
|
||||
'size_x'=>6,
|
||||
'size_y'=>2,
|
||||
'refresh'=>60
|
||||
);
|
||||
}
|
||||
|
||||
$bare = $request->bare;
|
||||
$data = serialize(json_encode($data));
|
||||
$dash_config = unserialize(stripslashes($data));
|
||||
$widgets = Widget::select('widget_id', 'widget_title')->orderBy('widget_title')->get();
|
||||
|
||||
return view('overview.default', compact('bare', 'dash_config', 'dashboard', 'user_dashboards', 'shared_dashboards', 'widgets'));
|
||||
}
|
||||
|
||||
public function simple(Request $request)
|
||||
{
|
||||
//TODO: All below missing D.ignore = '0' check
|
||||
$ports_down = [];
|
||||
$bgp_down = [];
|
||||
$devices_uptime = [];
|
||||
$syslog = [];
|
||||
|
||||
$devices_down = Device::hasAccess(Auth::user())
|
||||
->isDown()
|
||||
->limit(Config::get('front_page_down_box_limit'))
|
||||
->get();
|
||||
|
||||
if (Config::get('warn.ifdown')) {
|
||||
$ports_down = Port::hasAccess(Auth::user())
|
||||
->isDown()
|
||||
->limit(Config::get('front_page_down_box_limit'))
|
||||
->with('device')
|
||||
->get();
|
||||
}
|
||||
|
||||
$services_down = Service::hasAccess(Auth::user())
|
||||
->isCritical()
|
||||
->limit(Config::get('front_page_down_box_limit'))
|
||||
->with('device')
|
||||
->get();
|
||||
|
||||
|
||||
// TODO: is inAlarm() equal to: bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' ?
|
||||
if (Config::get('enable_bgp')) {
|
||||
$bgp_down = BgpPeer::hasAccess(Auth::user())
|
||||
->inAlarm()
|
||||
->limit(Config::get('front_page_down_box_limit'))
|
||||
->with('device')
|
||||
->get();
|
||||
}
|
||||
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false
|
||||
&& Config::get('uptime_warning') > 0
|
||||
) {
|
||||
$devices_uptime = Device::hasAccess(Auth::user())
|
||||
->isUp()
|
||||
->whereUptime(Config::get('uptime_warning'))
|
||||
->limit(Config::get('front_page_down_box_limit'))
|
||||
->get();
|
||||
|
||||
$devices_uptime = $devices_uptime->reject(function ($device) {
|
||||
$device->loadOs(); // TODO: needed?
|
||||
return Config::get("os.{$device->os}.bad_uptime") == true;
|
||||
});
|
||||
}
|
||||
|
||||
if (Config::get('enable_syslog')) {
|
||||
$syslog = Syslog::hasAccess(Auth::user())
|
||||
->orderBy('timestamp', 'desc')
|
||||
->limit(20)
|
||||
->with('device')
|
||||
->get();
|
||||
}
|
||||
|
||||
return view('overview.simple', compact('devices_down', 'ports_down', 'services_down', 'bgp_down', 'devices_uptime', 'syslog'));
|
||||
}
|
||||
}
|
||||
@@ -542,6 +542,14 @@ class Device extends BaseModel
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWhereUptime($query, $uptime, $modifier = '<')
|
||||
{
|
||||
return $query->where([
|
||||
['uptime', '>', 0],
|
||||
['uptime', $modifier, $uptime]
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeCanPing(Builder $query)
|
||||
{
|
||||
return $query->where('disabled', 0)
|
||||
|
||||
@@ -229,19 +229,12 @@ Set how often pages are refreshed in seconds. The default is every 5
|
||||
minutes. Some pages don't refresh at all by design.
|
||||
|
||||
```php
|
||||
$config['front_page'] = "pages/front/default.php";
|
||||
$config['front_page_settings']['top']['ports'] = 10;
|
||||
$config['front_page_settings']['top']['devices'] = 10;
|
||||
$config['front_page_down_box_limit'] = 10;
|
||||
$config['vertical_summary'] = 0; // Enable to use vertical summary on front page instead of horizontal
|
||||
$config['top_ports'] = 1; // This enables the top X ports box
|
||||
$config['top_devices'] = 1; // This enables the top X devices box
|
||||
$config['front_page'] = "default";
|
||||
```
|
||||
|
||||
A number of home pages are provided within the install and can be
|
||||
found in html/pages/front/. You can change the default by setting
|
||||
`front_page`. The other options are used to alter the look of those
|
||||
pages that support it (default.php supports these options).
|
||||
You can create your own front page by adding a blade file in `resources/views/overview/custom/`
|
||||
and setting `front_page` to it's name.
|
||||
For example, if you create `resources/views/overview/custom/foobar.blade.php`, set `front_page` to `foobar`.
|
||||
|
||||
```php
|
||||
// This option exists in the web UI, edit it under Global Settings -> webui
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,10 @@
|
||||
"/css/app.css": "/css/app.css?id=5da3bf931f2f95a17884",
|
||||
"/js/manifest.js": "/js/manifest.js?id=3c768977c2574a34506e",
|
||||
"/js/vendor.js": "/js/vendor.js?id=29212a758157c575d7f8",
|
||||
"/js/lang/de.js": "/js/lang/de.js?id=18b0b0e06813d1afed92",
|
||||
"/js/lang/en.js": "/js/lang/en.js?id=41955f4356f6511b76b6",
|
||||
"/js/lang/fr.js": "/js/lang/fr.js?id=4f329163511445d92a17",
|
||||
"/js/lang/ru.js": "/js/lang/ru.js?id=e10e85f321f1395378b6",
|
||||
"/js/lang/uk.js": "/js/lang/uk.js?id=c8d4937e3ca47b60b7ac",
|
||||
"/js/lang/zh-TW.js": "/js/lang/zh-TW.js?id=8020327e80ac10c0c615"
|
||||
"/js/lang/de.js": "/js/lang/de.js?id=8c1c390a5f45ac01d54b",
|
||||
"/js/lang/en.js": "/js/lang/en.js?id=14d93644610d1daa14af",
|
||||
"/js/lang/fr.js": "/js/lang/fr.js?id=21b66f3f48a3f67ba443",
|
||||
"/js/lang/ru.js": "/js/lang/ru.js?id=1a4435677a27aa615af1",
|
||||
"/js/lang/uk.js": "/js/lang/uk.js?id=6ce358a9e9387947ee03",
|
||||
"/js/lang/zh-TW.js": "/js/lang/zh-TW.js?id=3ad4a3e6a5a59165e806"
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ if (defined('SHOW_SETTINGS')) {
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4">
|
||||
<label for="tile_size" class="control-label availability-map-widget-header">Tile size</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" name="tile_size" value="'.$compact_tile.'">
|
||||
</div>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
require_once 'includes/html/object-cache.inc.php';
|
||||
|
||||
$temp_output = '
|
||||
<div class="panel panel-default panel-condensed table-responsive">
|
||||
<table class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><span class="grey">Total</span></th>
|
||||
<th><span class="green">Up</span></th>
|
||||
<th><span class="red">Down</span></th>
|
||||
<th><span class="grey">Ignored</span></th>
|
||||
<th><span class="black">Disabled</span></th>
|
||||
' . (\LibreNMS\Config::get('summary_errors') ? '<th>Errored</th>' : '') . '
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="devices/">Devices</a></td>
|
||||
<td><a href="devices/"><span>'.$devices['count'].'</span></a></td>
|
||||
<td><a href="devices/state=up/format=list_detail/"><span class="green"> '.$devices['up'].'</span></a></td>
|
||||
<td><a href="devices/state=down/format=list_detail/"><span class="red"> '.$devices['down'].'</span></a></td>
|
||||
<td><a href="devices/ignore=1/format=list_detail/"><span class="grey"> '.$devices['ignored'].'</span></a></td>
|
||||
<td><a href="devices/disabled=1/format=list_detail/"><span class="black"> '.$devices['disabled'].'</span></a></td>
|
||||
' . (\LibreNMS\Config::get('summary_errors') ? '<td>-</td>' : '') . '
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="ports/">Ports</a></td>
|
||||
<td><a href="ports/"><span>'.$ports['count'].'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=up/"><span class="green"> '.$ports['up'].'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=down/"><span class="red"> '.$ports['down'].'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/ignore=1/"><span class="grey"> '.$ports['ignored'].'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=admindown/"><span class="black"> '.$ports['shutdown'].'</span></a></td>
|
||||
' . (\LibreNMS\Config::get('summary_errors') ? '<td><a href="ports/format=list_detail/errors=1/"><span class="black"> ' . $ports['errored'] . '</span></a></td>' : '') . '
|
||||
</tr>';
|
||||
if (\LibreNMS\Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<tr>
|
||||
<td><a href="services/">Services</a></td>
|
||||
<td><a href="services/"><span>'.$services['count'].'</span></a></td>
|
||||
<td><a href="services/state=ok/view=details/"><span class="green">'.$services['up'].'</span></a></td>
|
||||
<td><a href="services/state=critical/view=details/"><span class="red"> '.$services['down'].'</span></a></td>
|
||||
<td><a href="services/ignore=1/view=details/"><span class="grey"> '.$services['ignored'].'</span></a></td>
|
||||
<td><a href="services/disabled=1/view=details/"><span class="black"> '.$services['disabled'].'</span></a></td>
|
||||
' . (\LibreNMS\Config::get('summary_errors') ? '<td>-</td>' : '') . '
|
||||
</tr>';
|
||||
}
|
||||
$temp_output .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
';
|
||||
|
||||
unset($common_output);
|
||||
$common_output[] = $temp_output;
|
||||
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
require_once 'includes/html/object-cache.inc.php';
|
||||
|
||||
$temp_output = '
|
||||
<div class="panel panel-default panel-condensed table-responsive">
|
||||
<table class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Summary</th>
|
||||
<th><a href="devices/">Devices</a></th>
|
||||
<th><a href="ports/">Ports</a></th>
|
||||
';
|
||||
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<th><a href="services/">Services</a></th>
|
||||
';
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="green">Up</span></th>
|
||||
<td><a href="devices/format=list_detail/state=up/"><span class="green">'. $devices['up'] .'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=up/"><span class="green">'. $ports['up'] .'</span></a></td>
|
||||
';
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td><a href="services/view=details/state=ok/"><span class="green">'. $services['up'] .'</span></a></td>
|
||||
';
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="red">Down</span></th>
|
||||
<td><a href="devices/format=list_detail/state=down/"><span class="red">'. $devices['down'] .'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=down/"><span class="red">'. $ports['down'] .'</span></a></td>
|
||||
';
|
||||
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td><a href="services/view=details/state=critical/"><span class="red">'. $services['down'] .'</span></a></td>
|
||||
';
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="grey">Ignored</span></th>
|
||||
<td><a href="devices/format=list_detail/ignore=1/"><span class="grey">'. $devices['ignored'] .'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/ignore=1/"><span class="grey">'. $ports['ignored'] .'</span></a></td>
|
||||
';
|
||||
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td><a href="services/view=details/ignore=1/"><span class="grey">'. $services['ignored'] .'</span></a></td>
|
||||
';
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="black">Disabled/Shutdown</span></th>
|
||||
<td><a href="devices/format=list_detail/disabled=1/"><span class="black">'. $devices['disabled'] .'</span></a></td>
|
||||
<td><a href="ports/format=list_detail/state=admindown/"><span class="black">'. $ports['shutdown'] .'</span></a></td>
|
||||
';
|
||||
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td><a href="services/view=details/disabled=1/"><span class="black">'. $services['disabled'] .'</span></a></td>
|
||||
';
|
||||
}
|
||||
|
||||
if (Config::get('summary_errors')) {
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="black">Errored</span></th>
|
||||
<td>-</td>
|
||||
<td><a href="ports/format=list_detail/errors=1/"><span class="black"> '.$ports['errored'].'</span></a></td>
|
||||
';
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td>-</td>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="grey">Total</span></th>
|
||||
<td><a href="devices/"><span>'. $devices['count'] .'</span></a></td>
|
||||
<td><a href="ports/"><span>'. $ports['count'] .'</span></a></td>
|
||||
';
|
||||
|
||||
if (Config::get('show_services')) {
|
||||
$temp_output .= '
|
||||
<td><a href="services/"><span>'. $services['count'] .'</span></a></td>
|
||||
';
|
||||
}
|
||||
|
||||
$temp_output .= '
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
';
|
||||
|
||||
unset($common_output);
|
||||
$common_output[] = $temp_output;
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Daniel Preussker <[email protected]>
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Custom Frontpage
|
||||
* @author f0o <[email protected]>
|
||||
* @copyright 2014 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Frontpage
|
||||
*/
|
||||
|
||||
$temp_output .= "
|
||||
<script type='text/javascript'>
|
||||
google.load('visualization', '1', {'packages': ['geochart'], callback: function() {
|
||||
|
||||
drawRegionsMap();
|
||||
function drawRegionsMap() {
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('string', 'Site');
|
||||
data.addColumn('number', 'Status');
|
||||
data.addColumn('number', 'Size');
|
||||
data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});
|
||||
data.addRows([
|
||||
";
|
||||
|
||||
$locations = array();
|
||||
foreach (getlocations() as $location_row) {
|
||||
$location = $location_row['location'];
|
||||
$location_id = $location_row['id'];
|
||||
$devices = array();
|
||||
$devices_down = array();
|
||||
$devices_up = array();
|
||||
$count = 0;
|
||||
$down = 0;
|
||||
foreach (dbFetchRows("SELECT `device_id`, `hostname`, `status` FROM `devices` WHERE `location_id` = ? && `disabled` = 0 && `ignore` = 0 GROUP BY `hostname`", [$location_id]) as $device) {
|
||||
if (\LibreNMS\Config::get('frontpage_globe.markers') == 'devices' || empty(\LibreNMS\Config::get('frontpage_globe.markers'))) {
|
||||
$devices[] = $device['hostname'];
|
||||
$count++;
|
||||
if ($device['status'] == "0") {
|
||||
$down++;
|
||||
$devices_down[] = $device['hostname']." DOWN";
|
||||
} else {
|
||||
$devices_up[] = $device;
|
||||
}
|
||||
} elseif (\LibreNMS\Config::get('frontpage_globe.markers') == 'ports') {
|
||||
foreach (dbFetchRows("SELECT ifName,ifOperStatus,ifAdminStatus FROM ports WHERE ports.device_id = ? && ports.ignore = 0 && ports.disabled = 0 && ports.deleted = 0", array($device['device_id'])) as $port) {
|
||||
$count++;
|
||||
if ($port['ifOperStatus'] != 'up' && $port['ifAdminStatus'] == 'up') {
|
||||
$down++;
|
||||
$devices_down[] = $device['hostname']."/".$port['ifName']." DOWN";
|
||||
} else {
|
||||
$devices_up[] = $port;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$pdown = $count ? ($down / $count)*100 : 0;
|
||||
if (\LibreNMS\Config::get('frontpage_globe.markers') == 'devices' || empty(\LibreNMS\Config::get('frontpage_globe.markers'))) {
|
||||
$devices_down = array_merge(array(count($devices_up). " Devices OK"), $devices_down);
|
||||
} elseif (\LibreNMS\Config::get('frontpage_globe.markers') == 'ports') {
|
||||
$devices_down = array_merge(array(count($devices_up). " Ports OK"), $devices_down);
|
||||
}
|
||||
$locations[] = " ['".$location."', ".$pdown.", ".$count.", '".implode(",<br/> ", $devices_down)."']";
|
||||
}
|
||||
$temp_output .= implode(",\n", $locations);
|
||||
|
||||
$map_world = \LibreNMS\Config::get('frontpage_globe.region', 'world');
|
||||
$map_countries = \LibreNMS\Config::get('frontpage_globe.resolution', 'countries');
|
||||
|
||||
$temp_output .= "
|
||||
]);
|
||||
var options = {
|
||||
region: '". $map_world ."',
|
||||
resolution: '". $map_countries ."',
|
||||
displayMode: 'markers',
|
||||
keepAspectRatio: 1,
|
||||
magnifyingGlass: {enable: true, zoomFactor: 100},
|
||||
colorAxis: {minValue: 0, maxValue: 100, colors: ['green', 'yellow', 'red']},
|
||||
markerOpacity: 0.90,
|
||||
tooltip: {isHtml: true},
|
||||
};
|
||||
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
|
||||
chart.draw(data, options);
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div id='chart_div'></div>
|
||||
";
|
||||
|
||||
unset($common_output);
|
||||
$common_output[] = $temp_output;
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS front page graphs
|
||||
*
|
||||
* Author: Paul Gear
|
||||
* Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
|
||||
*
|
||||
* 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 '
|
||||
<div class="cycle-slideshow"
|
||||
data-cycle-fx="fade"
|
||||
data-cycle-timeout="10000"
|
||||
data-cycle-slides="> div"
|
||||
style="clear: both">
|
||||
';
|
||||
|
||||
foreach (get_matching_files(\LibreNMS\Config::get('html_dir') . '/includes/front/', '/^top_.*\.php$/') as $file) {
|
||||
if (($file == 'top_ports.inc.php' && \LibreNMS\Config::get('top_ports') == 0) || ($file == 'top_device_bits.inc.php' && \LibreNMS\Config::get('top_devices') == 0)) {
|
||||
} else {
|
||||
echo "<div class=box>\n";
|
||||
include_once $file;
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</div>\n";
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS front page top devices graph
|
||||
* - Find most utilised devices that have been polled in the last N minutes
|
||||
*
|
||||
* Author: Paul Gear
|
||||
* Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$minutes = 15;
|
||||
$seconds = ($minutes * 60);
|
||||
$top = \LibreNMS\Config::get('front_page_settings.top.devices');
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$query = "
|
||||
SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total
|
||||
FROM ports as p, devices as d
|
||||
WHERE d.device_id = p.device_id
|
||||
AND unix_timestamp() - p.poll_time < $seconds
|
||||
AND ( p.ifInOctets_rate > 0
|
||||
OR p.ifOutOctets_rate > 0 )
|
||||
GROUP BY d.device_id
|
||||
ORDER BY total desc
|
||||
LIMIT $top
|
||||
";
|
||||
} else {
|
||||
$query = "
|
||||
SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total
|
||||
FROM ports as p, devices as d, `devices_perms` AS `P`
|
||||
WHERE `P`.`user_id` = ? AND `P`.`device_id` = `d`.`device_id` AND
|
||||
d.device_id = p.device_id
|
||||
AND unix_timestamp() - p.poll_time < $seconds
|
||||
AND ( p.ifInOctets_rate > 0
|
||||
OR p.ifOutOctets_rate > 0 )
|
||||
GROUP BY d.device_id
|
||||
ORDER BY total desc
|
||||
LIMIT $top
|
||||
";
|
||||
$param[] = array(Auth::id());
|
||||
}//end if
|
||||
|
||||
echo "<strong>Top $top devices (last $minutes minutes)</strong>\n";
|
||||
echo "<table class='simple'>\n";
|
||||
foreach (dbFetchRows($query, $param) as $result) {
|
||||
echo '<tr class=top10>'.'<td class=top10>'.generate_device_link($result, shorthost($result['hostname'])).'</td>'.'<td class=top10>'.generate_device_link($result, generate_minigraph_image($result, \LibreNMS\Config::get('time.day'), \LibreNMS\Config::get('time.now'), 'device_bits', 'no', 150, 21, '&', 'top10'), array(), 0, 0, 0).'</td>'."</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS front page top ports graph
|
||||
* - Find most utilised ports that have been polled in the last N minutes
|
||||
*
|
||||
* Author: Paul Gear
|
||||
* Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$minutes = 15;
|
||||
$seconds = ($minutes * 60);
|
||||
$top = \LibreNMS\Config::get('front_page_settings.top.ports');
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$query = "
|
||||
SELECT *, p.ifInOctets_rate + p.ifOutOctets_rate as total
|
||||
FROM ports as p, devices as d
|
||||
WHERE d.device_id = p.device_id
|
||||
AND unix_timestamp() - p.poll_time < $seconds
|
||||
AND ( p.ifInOctets_rate > 0
|
||||
OR p.ifOutOctets_rate > 0 )
|
||||
ORDER BY total desc
|
||||
LIMIT $top
|
||||
";
|
||||
} else {
|
||||
$query = "
|
||||
SELECT *, I.ifInOctets_rate + I.ifOutOctets_rate as total
|
||||
FROM ports as I, devices as d,
|
||||
`devices_perms` AS `P`, `ports_perms` AS `PP`
|
||||
WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `d`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `d`.`device_id`)) AND
|
||||
d.device_id = I.device_id
|
||||
AND unix_timestamp() - I.poll_time < $seconds
|
||||
AND ( I.ifInOctets_rate > 0
|
||||
OR I.ifOutOctets_rate > 0 )
|
||||
ORDER BY total desc
|
||||
LIMIT $top
|
||||
";
|
||||
$param[] = array(
|
||||
Auth::id(),
|
||||
Auth::id(),
|
||||
);
|
||||
}//end if
|
||||
|
||||
echo "<strong>Top $top ports (last $minutes minutes)</strong>\n";
|
||||
echo "<table class='simple'>\n";
|
||||
foreach (dbFetchRows($query, $param) as $result) {
|
||||
$result = cleanPort($result);
|
||||
echo '<tr class=top10>'.'<td class=top10>'.generate_device_link($result, shorthost($result['hostname'])).'</td>'.'<td class=top10>'.generate_port_link($result).'</td>'.'<td class=top10>'.generate_port_link($result, generate_port_thumbnail($result)).'</td>'."</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
@@ -1,258 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
require_once 'includes/html/object-cache.inc.php';
|
||||
|
||||
|
||||
function generate_front_box($frontbox_class, $content)
|
||||
{
|
||||
echo "<div class=\"front-box $frontbox_class\">
|
||||
$content
|
||||
</div>";
|
||||
}//end generate_front_box()
|
||||
|
||||
|
||||
echo '
|
||||
<div class="row">
|
||||
';
|
||||
if (Config::get('vertical_summary')) {
|
||||
echo ' <div class="col-md-9">';
|
||||
} else {
|
||||
echo ' <div class="col-md-8">';
|
||||
}
|
||||
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
';
|
||||
|
||||
echo '<div class=front-page>';
|
||||
|
||||
echo '<div class="status-boxes">';
|
||||
|
||||
$count_boxes = 0;
|
||||
|
||||
// Device down boxes
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
} else {
|
||||
$sql = "SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . Auth::id() . "' AND D.status = '0' AND D.ignore = '0' LIMIT" . Config::get('front_page_down_box_limit');
|
||||
}
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
generate_front_box(
|
||||
'device-down',
|
||||
generate_device_link($device, shorthost($device['hostname'])) . '<br />
|
||||
<span class=list-device-down>Device Down</span> <br />
|
||||
<span class=body-date-1>' . truncate($device['location'], 20) . '</span>'
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
} else {
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . Auth::id() . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
}
|
||||
|
||||
// These things need to become more generic, and more manageable across different frontpages... rewrite inc :>
|
||||
// Port down boxes
|
||||
if (Config::get('warn.ifdown')) {
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
if (!$interface['deleted']) {
|
||||
$interface = cleanPort($interface);
|
||||
generate_front_box(
|
||||
'alert alert-danger',
|
||||
generate_device_link($interface, shorthost($interface['hostname'])) . "<br />
|
||||
<span class=\"interface-updown\">Port Down</span><br />
|
||||
<!-- <img src='graph.php?type=bits&if=" . $interface['port_id'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=100&height=32' /> -->
|
||||
" . generate_port_link($interface, substr(makeshortif($interface['label']), 0, 13)) . ' <br />
|
||||
' . ($interface['ifAlias'] ? '<span class="body-date-1">' . substr($interface['ifAlias'], 0, 20) . '</span>' : '')
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
FIXME service permissions? seem nonexisting now.. */
|
||||
// Service down boxes
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = '2' AND D.ignore = '0' AND S.service_ignore = '0' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
$param[] = '';
|
||||
} else {
|
||||
$sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '2' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
$param[] = Auth::id();
|
||||
}
|
||||
|
||||
foreach (dbFetchRows($sql, $param) as $service) {
|
||||
generate_front_box(
|
||||
'service-down',
|
||||
generate_device_link($service, shorthost($service['hostname'])) . '<br />
|
||||
<span class=service-down>Service Down</span>
|
||||
' . $service['service_type'] . '<br />
|
||||
<span class=body-date-1>' . truncate($interface['ifAlias'], 20) . '</span>'
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
|
||||
// BGP neighbour down boxes
|
||||
if (Config::get('enable_bgp')) {
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
} else {
|
||||
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . Auth::id() . "' AND bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT " . Config::get('front_page_down_box_limit');
|
||||
}
|
||||
|
||||
foreach (dbFetchRows($sql) as $peer) {
|
||||
generate_front_box(
|
||||
'bgp-down',
|
||||
generate_device_link($peer, shorthost($peer['hostname'])) . "<br />
|
||||
<span class=bgp-down>BGP Down</span>
|
||||
<span class='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'front-page-bgp-small' : 'front-page-bgp-normal') . "'>" . $peer['bgpPeerIdentifier'] . '</span><br />
|
||||
<span class=body-date-1>AS' . substr($peer['bgpPeerRemoteAs'] . ' ' . $peer['astext'], 0, 14) . '</span>'
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
}
|
||||
|
||||
// Device rebooted boxes
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && Config::get('uptime_warning') > 0 && !Config::get("os.{$device['os']}.bad_uptime")) {
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . Config::get('uptime_warning') . "' AND D.ignore = 0 LIMIT " . Config::get('front_page_down_box_limit');
|
||||
} else {
|
||||
$sql = "SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . Auth::id() . "' AND D.status = '1' AND D.uptime > 0 AND D.uptime < '" . Config::get('uptime_warning') . "' AND D.ignore = 0 LIMIT " . Config::get('front_page_down_box_limit');
|
||||
}
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
generate_front_box(
|
||||
'device-rebooted',
|
||||
generate_device_link($device, shorthost($device['hostname'])) . '<br />
|
||||
<span class=device-rebooted>Device Rebooted</span><br />
|
||||
<span class=body-date-1>' . formatUptime($device['uptime'], 'short') . '</span>'
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_boxes == 0) {
|
||||
echo "<h5>Nothing here yet</h5><p class=welcome>This is where status notifications about devices and services would normally go. You might have none
|
||||
because you run such a great network, or perhaps you've just started using " . Config::get('project_name') . ". If you're new to " . Config::get('project_name') . ', you might
|
||||
want to start by adding one or more devices in the Devices menu.</p>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
if (Config::get('vertical_summary')) {
|
||||
echo ' <div class="col-md-3">';
|
||||
include_once 'includes/html/device-summary-vert.inc.php';
|
||||
echo implode('', $common_output);
|
||||
} else {
|
||||
echo ' <div class="col-md-4">';
|
||||
include_once 'includes/html/common/device-summary-horiz.inc.php';
|
||||
echo implode('', $common_output);
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
';
|
||||
|
||||
if (Config::get('enable_syslog')) {
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . Config::get('dateformat.mysql.compact') . "') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
|
||||
|
||||
echo '<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Syslog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
|
||||
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
} else {
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
$alertquery = 'SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15';
|
||||
} else {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . Auth::id() . ' ORDER BY `datetime` DESC LIMIT 0,15';
|
||||
$alertquery = 'SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = ' . Auth::id() . ' ORDER BY `time_logged` DESC LIMIT 0,15';
|
||||
}
|
||||
|
||||
echo '<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 column">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Alertlog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
|
||||
foreach (dbFetchRows($alertquery) as $alert_entry) {
|
||||
include 'includes/html/print-alerts.inc.php';
|
||||
}
|
||||
|
||||
echo '</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 column">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Eventlog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
|
||||
foreach (dbFetchRows($query) as $entry) {
|
||||
include 'includes/html/print-event.inc.php';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}//end if
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,177 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<table border=0 cellpadding=10 cellspacing=10 width=100%>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
|
||||
<?php
|
||||
|
||||
echo '<table><tr>';
|
||||
|
||||
$dev_list = array(
|
||||
'6' => 'Central Fileserver',
|
||||
'7' => 'NE61 Fileserver',
|
||||
'34' => 'DE56 Fileserver',
|
||||
);
|
||||
|
||||
foreach ($dev_list as $device_id => $descr) {
|
||||
echo '<td>';
|
||||
echo "<div style='font-size: 16px; font-weight: bold; color: #555555;'>".$descr.'</div>';
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '310';
|
||||
$graph_array['to'] = \LibreNMS\Config::get('time.now');
|
||||
$graph_array['device'] = $device_id;
|
||||
$graph_array['type'] = 'device_bits';
|
||||
$graph_array['from'] = \LibreNMS\Config::get('time.day');
|
||||
$graph_array['legend'] = 'no';
|
||||
$graph_array['popup_title'] = $descr;
|
||||
// $graph_array['link'] = generate_device_link($device_id);
|
||||
print_graph_popup($graph_array);
|
||||
|
||||
$graph_array['height'] = '50';
|
||||
$graph_array['width'] = '180';
|
||||
|
||||
echo "<div style='margin: 1px; float: left; padding: 5px; background-color: #e5e5e5;'>";
|
||||
$graph_array['type'] = 'device_ucd_memory';
|
||||
print_graph_popup($graph_array);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='margin: 1px; float: left; padding: 5px; background-color: #e5e5e5;'>";
|
||||
$graph_array['type'] = 'device_processor';
|
||||
print_graph_popup($graph_array);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='margin: 1px; float: left; padding: 5px; background-color: #e5e5e5;'>";
|
||||
$graph_array['type'] = 'device_storage';
|
||||
print_graph_popup($graph_array);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='margin: 1px; float: left; padding: 5px; background-color: #e5e5e5;'>";
|
||||
$graph_array['type'] = 'device_diskio';
|
||||
print_graph_popup($graph_array);
|
||||
echo '</div>';
|
||||
|
||||
echo '</td>';
|
||||
}//end foreach
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=#e5e5e5 valign=top>
|
||||
<?php
|
||||
$nodes = array();
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'";
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
unset($already);
|
||||
$i = 0;
|
||||
while ($i <= count($nodes)) {
|
||||
$thisnode = $device['device_id'];
|
||||
if ($nodes[$i] == $thisnode) {
|
||||
$already = 'yes';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$already) {
|
||||
$nodes[] = $device['device_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span><br />
|
||||
<span class=body-date-1>".truncate($device['location'], 35).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (\LibreNMS\Config::get('warn.ifdown')) {
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
if (port_permitted($interface['port_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
|
||||
<strong>".generate_port_link($interface, makeshortif($interface['ifDescr'])).'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $service) {
|
||||
if (device_permitted($service['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />
|
||||
<strong>".$service['service_type'].'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id";
|
||||
foreach (dbFetchRows($sql) as $peer) {
|
||||
if (device_permitted($peer['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />
|
||||
<strong>".$peer['bgpPeerIdentifier'].'</strong><br />
|
||||
<span class=body-date-1>AS'.$peer['bgpPeerRemoteAs'].' '.truncate($peer['astext'], 10).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (filter_var(\LibreNMS\Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && \LibreNMS\Config::get('uptime_warning') > 0) {
|
||||
$sql = "SELECT * FROM devices_attribs AS A, `devices` AS D WHERE
|
||||
A.attrib_value < '" . \LibreNMS\Config::get('uptime_warning') . "' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
if (device_permitted($device['device_id']) && $device['attrib_value'] < \LibreNMS\Config::get('uptime_warning') && $device['attrib_type'] == 'uptime') {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
|
||||
<span class=body-date-1>".formatUptime($device['attrib_value']).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
<div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'>
|
||||
|
||||
<h3>Recent Syslog Messages</h3>
|
||||
";
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') AS date from `syslog` ORDER BY seq DESC LIMIT 20";
|
||||
echo '<table cellspacing=0 cellpadding=2 width=100%>';
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
|
||||
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
</tr></table>
|
||||
@@ -1,155 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<table border=0 cellpadding=10 cellspacing=10 width=100%>
|
||||
<tr>
|
||||
<td bgcolor=#e5e5e5 valign=top>
|
||||
<?php
|
||||
|
||||
// <table width=100% border=0><tr><td><div style="margin-bottom: 5px; font-size: 18px; font-weight: bold;">Devices with Alerts</div></td><td width=35 align=center><div class=tablehead>Host</div></td><td align=center width=35><div class=tablehead>Int</div></td><td align=center width=35><div class=tablehead>Srv</div></tr>
|
||||
?>
|
||||
<?php
|
||||
|
||||
$nodes = array();
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'";
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
unset($already);
|
||||
$i = 0;
|
||||
while ($i <= count($nodes)) {
|
||||
$thisnode = $device['device_id'];
|
||||
if ($nodes[$i] == $thisnode) {
|
||||
$already = 'yes';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$already) {
|
||||
$nodes[] = $device['device_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>
|
||||
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span>
|
||||
<span class=body-date-1>".truncate($device['location'], 20).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
|
||||
<center><strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span>
|
||||
<strong>".generate_port_link($interface, makeshortif($interface['ifDescr'])).'</strong> <br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 20).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $service) {
|
||||
echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
|
||||
<center><strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span>
|
||||
<strong>".$service['service_type'].'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 20).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id";
|
||||
foreach (dbFetchRows($sql) as $peer) {
|
||||
echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
|
||||
<center><strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span>
|
||||
<strong>".$peer['bgpPeerIdentifier'].'</strong> <br />
|
||||
<span class=body-date-1>AS'.$peer['bgpPeerRemoteAs'].' '.truncate($peer['astext'], 10).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
|
||||
if (filter_var(\LibreNMS\Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && \LibreNMS\Config::get('uptime_warning') > 0) {
|
||||
$sql = "SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '" . \LibreNMS\Config::get('uptime_warning') . "'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>
|
||||
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
|
||||
<span class=body-date-1>".formatUptime($device['attrib_value']).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
<div style='clear: both;'>$errorboxes</div> <div style='margin: 4px; clear: both;'>
|
||||
|
||||
<h3>Recent Syslog Messages</h3>
|
||||
|
||||
";
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
|
||||
echo '<table cellspacing=0 cellpadding=2 width=100%>';
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</div>
|
||||
|
||||
</td>
|
||||
<td bgcolor=#e5e5e5 width=275 valign=top>';
|
||||
|
||||
// this stuff can be customised to show whatever you want....
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||
$sql .= \LibreNMS\Config::get('mydomain') . "' ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['l2tp'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||
$sql .= \LibreNMS\Config::get('mydomain') . "' ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['transit'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||
$sql .= \LibreNMS\Config::get('mydomain') . "' ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['voip'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
if ($ports['transit']) {
|
||||
echo "<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=" . $ports['transit'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>" . "<img src='graph.php?type=multi_bits&ports=" . $ports['transit'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=200&height=100'></a>";
|
||||
}
|
||||
|
||||
if ($ports['l2tp']) {
|
||||
echo "<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=" . $ports['l2tp'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>" . "<img src='graph.php?type=multi_bits&ports=" . $ports['l2tp'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=200&height=100'></a>";
|
||||
}
|
||||
|
||||
if ($ports['voip']) {
|
||||
echo "<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=" . $ports['voip'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>" . "<img src='graph.php?type=multi_bits&ports=" . $ports['voip'] . '&from=' . \LibreNMS\Config::get('time.day') . '&to=' . \LibreNMS\Config::get('time.now') . "&width=200&height=100'></a>";
|
||||
}
|
||||
}//end if
|
||||
|
||||
// END VOSTRON
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
</tr></table>
|
||||
@@ -1,134 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/* Copyright (C) 2014 Daniel Preussker <[email protected]>
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Custom Frontpage
|
||||
* @author f0o <[email protected]>
|
||||
* @copyright 2014 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Frontpage
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<script src='https://www.google.com/jsapi'></script>
|
||||
|
||||
<?php
|
||||
|
||||
include_once 'includes/html/object-cache.inc.php';
|
||||
echo '<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
';
|
||||
|
||||
include_once 'includes/html/common/globe.inc.php';
|
||||
echo implode(',', $common_output);
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-4">';
|
||||
include_once("includes/html/device-summary-vert.inc.php");
|
||||
echo ' </div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">';
|
||||
include_once("includes/html/front/boxes.inc.php");
|
||||
echo ' </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
$device['device_id'] = '-1';
|
||||
require_once('includes/html/common/alerts.inc.php');
|
||||
echo implode('', $common_output);
|
||||
unset($device['device_id']);
|
||||
echo ' </div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
//From default.php - This code is not part of above license.
|
||||
if (\LibreNMS\Config::get('enable_syslog')) {
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') AS date from syslog ORDER BY seq DESC LIMIT 20";
|
||||
echo('<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Syslog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">');
|
||||
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
|
||||
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
} else {
|
||||
if (Auth::user()->hasGlobalAdmin()) {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
} else {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
|
||||
P.device_id AND P.user_id = " . Auth::id() . " ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
}
|
||||
|
||||
echo('<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Eventlog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">');
|
||||
|
||||
foreach (dbFetchRows($query) as $entry) {
|
||||
include 'includes/html/print-event.inc.php';
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<table border=0 cellpadding=10 cellspacing=10 width=100%>
|
||||
<tr>
|
||||
<td bgcolor=#e5e5e5 valign=top>
|
||||
<?php
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
$nodes = array();
|
||||
|
||||
$uptimesql = '';
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && Config::get('uptime_warning') > 0) {
|
||||
$uptimesql = " AND A.attrib_value < '" . Config::get('uptime_warning') . "'";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' ".$uptimesql;
|
||||
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
unset($already);
|
||||
$i = 0;
|
||||
while ($i <= count($nodes)) {
|
||||
$thisnode = $device['device_id'];
|
||||
if ($nodes[$i] == $thisnode) {
|
||||
$already = 'yes';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$already) {
|
||||
$nodes[] = $device['device_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span><br />
|
||||
<span class=body-date-1>".truncate($device['location'], 35).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::get('warn.ifdown')) {
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
if (port_permitted($interface['port_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
|
||||
<strong>".generate_port_link($interface, makeshortif($interface['ifDescr'])).'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
|
||||
foreach (dbFetchRows($sql) as $service) {
|
||||
if (device_permitted($service['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />
|
||||
<strong>".$service['service_type'].'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id";
|
||||
foreach (dbFetchRows($sql) as $peer) {
|
||||
if (device_permitted($peer['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />
|
||||
<strong>".$peer['bgpPeerIdentifier'].'</strong><br />
|
||||
<span class=body-date-1>AS'.$peer['bgpPeerRemoteAs'].' '.truncate($peer['astext'], 10).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && Config::get('uptime_warning') > 0) {
|
||||
$sql = "SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '" . Config::get('uptime_warning') . "' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'";
|
||||
foreach (dbFetchRows($sql) as $device) {
|
||||
if (device_permitted($device['device_id']) && $device['attrib_value'] < Config::get('uptime_warning') && $device['attrib_type'] == 'uptime') {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
|
||||
<span class=body-date-1>".formatUptime($device['attrib_value']).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
<div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'>
|
||||
|
||||
<h3>Recent Syslog Messages</h3>
|
||||
|
||||
";
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . Config::get('dateformat.mysql.compact') . "') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
|
||||
echo '<table cellspacing=0 cellpadding=2 width=100%>';
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</div>
|
||||
|
||||
</td>
|
||||
<td bgcolor=#e5e5e5 width=470 valign=top>';
|
||||
|
||||
// this stuff can be customised to show whatever you want....
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['transit'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['peering'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$ports['broadband'] = '3294,3295,688,3534';
|
||||
$ports['wave_broadband'] = '827';
|
||||
|
||||
$ports['new_broadband'] = '3659,4149,4121,4108,3676,4135';
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['peering'] && $ports['transit']) {
|
||||
echo "<div style='width: 235px; '>
|
||||
<a href='internet/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Aggregate Internet Traffic</div>" . "<img src='graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=385&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['transit']) {
|
||||
echo "<div style='width: 235px; float: left;'>
|
||||
<a href='iftype/transit/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Transit</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
if ($ports['peering']) {
|
||||
echo "<div style='width: 235px; float: right;'>
|
||||
<a href='iftype/peering/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Peering</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) {
|
||||
echo "<div style='width: 466px; '>
|
||||
<a href='broadband/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits_trio&id=" . $ports['broadband'] . '&idb=' . $ports['new_broadband'] . '&idc=' . $ports['wave_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=c\'>\
|
||||
<img src=\'graph.php?type=multiport_bits_trio&id=" . $ports['broadband'] . '&idb=' . $ports['new_broadband'] . '&idc=' . $ports['wave_broadband'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=c\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Aggregate Broadband Traffic</div>" . "<img src='graph.php?type=multiport_bits_trio&id=" . $ports['broadband'] . '&idb=' . $ports['new_broadband'] . '&idc=' . $ports['wave_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=385&height=100&legend=no&inverse=c'></a></div>";
|
||||
}
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['broadband']) {
|
||||
echo "<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['broadband'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Jersey Broadband ATM</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['new_broadband']) {
|
||||
echo "<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['new_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=0\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['new_broadband'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=0\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Jersey Broadband NGN</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['new_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&inverse=0&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
if ($ports['wave_broadband']) {
|
||||
echo "<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=port_bits&id=" . $ports['wave_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=1&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&id=" . $ports['wave_broadband'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150&inverse=1&legend=1\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"."
|
||||
<div style='font-size: 16px; font-weight: bold; color: #555555;'>Wave Broadband</div>" . "<img src='graph.php?type=port_bits&id=" . $ports['wave_broadband'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&inverse=1&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}//end if
|
||||
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
</tr></table>
|
||||
@@ -1,218 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/* Copyright (C) 2014 Daniel Preussker <[email protected]>
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* Custom Frontpage
|
||||
* @author f0o <[email protected]>
|
||||
* @copyright 2014 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Frontpage
|
||||
*/
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
if (Config::get('map.engine') == 'leaflet') {
|
||||
require_once 'includes/html/common/worldmap.inc.php';
|
||||
echo implode('', $common_output);
|
||||
} else {
|
||||
if (Config::has('mapael.default_map') && is_file(Config::get('html_dir') . '/js/' . Config::get('mapael.default_map'))) {
|
||||
$default_map = Config::get('mapael.default_map');
|
||||
} else {
|
||||
$default_map = 'maps/world_countries.js';
|
||||
}
|
||||
$map_tmp = preg_split("/\//", $default_map);
|
||||
$map_name = $map_tmp[count($map_tmp)-1];
|
||||
$map_name = str_replace('.js', '', $map_name);
|
||||
|
||||
$map_width = (int)Config::get('mapael.map_width', 800);
|
||||
$default_zoom = Config::get('mapael.default_zoom', 0);
|
||||
|
||||
|
||||
if (Config::has('mapael.default_lat') && Config::has('mapael.default_lng')) {
|
||||
$init_zoom = "init: {
|
||||
latitude: " . Config::has('mapael.default_lat') . ",
|
||||
longitude: " . Config::has('mapael.default_lng') . ",
|
||||
level: $default_zoom
|
||||
}\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script>
|
||||
</script>
|
||||
<script src='js/raphael-min.js'></script>
|
||||
<script src='js/jquery.mapael.js'></script>
|
||||
<script src='js/<?php echo $default_map; ?>'></script>
|
||||
<script src='js/jquery.mousewheel.min.js'></script>
|
||||
<?php
|
||||
$x=0;
|
||||
foreach (dbFetchRows("SELECT `hostname`,`location`,`status`, COUNT(`status`) AS `total`,`lat`,`lng` FROM `devices` LEFT JOIN `locations` ON `devices`.location_id=`locations`.`id` WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != '' GROUP BY `status`,`lat`,`lng` ORDER BY `status` ASC, `hostname`") as $map_devices) {
|
||||
$color = "#29FF3B";
|
||||
$size = 15;
|
||||
$status = 'Up';
|
||||
if ($map_devices['status'] == 0) {
|
||||
$color = "#FF0000";
|
||||
$size = 30;
|
||||
$status = 'Down';
|
||||
}
|
||||
$data .= "\"$x\": {
|
||||
value: \"" . $map_devices['total'] . "\",
|
||||
latitude: ". $map_devices['lat'] . ",
|
||||
longitude: " . $map_devices['lng'] . ",
|
||||
size: " . $size . ",
|
||||
attrs: {
|
||||
fill: \"" . $color . "\",
|
||||
opacity: 0.8
|
||||
},
|
||||
tooltip: {
|
||||
content: \"Devices " . $status . ": " . $map_devices['total'] . "\"
|
||||
}
|
||||
},\n";
|
||||
$x++;
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
$(function () {
|
||||
$(".mapcontainer").mapael({
|
||||
map: {
|
||||
name: "<?php echo $map_name; ?>",
|
||||
width: <?php echo $map_width; ?>,
|
||||
zoom : {
|
||||
enabled : true,
|
||||
maxLevel : <?php echo $default_zoom+10; ?>,
|
||||
<?php echo $init_zoom; ?>
|
||||
},
|
||||
defaultArea: {
|
||||
attrs: {
|
||||
fill : "#449603",
|
||||
stroke: "#295C00"
|
||||
},
|
||||
attrsHover: {
|
||||
fill: "#367504",
|
||||
stroke: "#5d5d5d",
|
||||
"stroke-width": 1,
|
||||
"stroke-linejoin": "round"
|
||||
}
|
||||
}
|
||||
},
|
||||
plots: {
|
||||
<?php echo $data; ?>
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="mapcontainer">
|
||||
<div class="map">
|
||||
<span>Alternative content for the map</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
include_once 'includes/html/object-cache.inc.php';
|
||||
echo '<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-4">';
|
||||
include_once 'includes/html/front/boxes.inc.php';
|
||||
echo ' </div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-4">';
|
||||
include_once 'includes/html/common/device-summary-vert.inc.php';
|
||||
echo implode('', $common_output);
|
||||
echo ' </div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">';
|
||||
$device['device_id'] = '-1';
|
||||
require_once 'includes/html/common/alerts.inc.php';
|
||||
echo implode('', $common_output);
|
||||
unset($device['device_id']);
|
||||
echo ' </div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
//From default.php - This code is not part of above license.
|
||||
if (Config::get('enable_syslog')) {
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . Config::get('dateformat.mysql.compact') . "') AS date from syslog ORDER BY seq DESC LIMIT 20";
|
||||
|
||||
echo('<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Syslog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">');
|
||||
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
|
||||
|
||||
unset($syslog_output);
|
||||
include("includes/html/print-syslog.inc.php");
|
||||
echo $syslog_output;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
} else {
|
||||
if (Auth::user()->hasGlobalAdmin()) {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
} else {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '" . Config::get('dateformat.mysql.compact') . "') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
|
||||
P.device_id AND P.user_id = " . Auth::id() . " ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
}
|
||||
|
||||
echo('<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Eventlog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">');
|
||||
|
||||
foreach (dbFetchRows($query) as $entry) {
|
||||
include 'includes/html/print-event.inc.php';
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
}
|
||||
?>
|
||||
@@ -1,697 +0,0 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
/*
|
||||
* Code for Gridster.sort_by_row_and_col_asc(serialization) call is from http://gridster.net/demos/grid-from-serialize.html
|
||||
*/
|
||||
|
||||
$no_refresh = true;
|
||||
$default_dash = get_user_pref('dashboard', 0);
|
||||
|
||||
require_once 'includes/html/modal/alert_notes.inc.php';
|
||||
require_once 'includes/html/modal/alert_ack.inc.php';
|
||||
|
||||
// get all dashboards this user can access and put them into two lists user_dashboards and shared_dashboards
|
||||
$dashboards = get_dashboards();
|
||||
list($user_dashboards, $shared_dashboards) = array_reduce($dashboards, function ($ret, $dash) {
|
||||
if ($dash['user_id'] == Auth::id()) {
|
||||
$ret[0][] = $dash;
|
||||
} else {
|
||||
$ret[1][] = $dash;
|
||||
}
|
||||
return $ret;
|
||||
}, array());
|
||||
|
||||
// if the default dashboard doesn't exist, set it to the global default or to 0
|
||||
if (!isset($dashboards[$default_dash])) {
|
||||
$global_default = (int)Config::get('webui.default_dashboard_id');
|
||||
$default_dash = isset($dashboards[$global_default]) ? $global_default : 0;
|
||||
}
|
||||
|
||||
// if there are no possible dashboards, add one
|
||||
if ($default_dash == 0 && empty($user_dashboards)) {
|
||||
$new_dash = array(
|
||||
'dashboard_name'=>'Default',
|
||||
'user_id'=>Auth::id(),
|
||||
);
|
||||
|
||||
$dashboard_id = dbInsert($new_dash, 'dashboards');
|
||||
$new_dash['dashboard_id'] = $dashboard_id;
|
||||
$new_dash['username'] = Auth::user()->username;
|
||||
$vars['dashboard'] = $new_dash;
|
||||
|
||||
if (dbFetchCell('select 1 from users_widgets where user_id = ? && dashboard_id = ?', array(Auth::id(),0)) == 1) {
|
||||
dbUpdate(array('dashboard_id'=>$dashboard_id), 'users_widgets', 'user_id = ? && dashboard_id = ?', array(Auth::id(), 0));
|
||||
}
|
||||
} else {
|
||||
// load a dashboard
|
||||
$orig = $vars['dashboard'];
|
||||
if (!empty($orig) && isset($dashboards[$orig])) {
|
||||
// specific dashboard
|
||||
$vars['dashboard'] = $dashboards[$orig];
|
||||
} else {
|
||||
// load a default dashboard
|
||||
$vars['dashboard'] = $default_dash == 0 ? current($user_dashboards) : $dashboards[$default_dash];
|
||||
|
||||
// $dashboard was requested, but doesn't exist
|
||||
if (!empty($orig)) {
|
||||
Toastr::error('Dashboard <code>#' . $orig .
|
||||
'</code> does not exist! Loaded <code>' . htmlentities($vars['dashboard']['dashboard_name']) .
|
||||
'</code> instead.', 'Requested Dashboard Not Found!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = dbFetchRows(
|
||||
'SELECT `user_widget_id`,`users_widgets`.`widget_id`,`title`,`widget`,`col`,`row`,`size_x`,`size_y`,`refresh` FROM `users_widgets`
|
||||
LEFT JOIN `widgets` ON `widgets`.`widget_id`=`users_widgets`.`widget_id` WHERE `dashboard_id`=?',
|
||||
array($vars['dashboard']['dashboard_id'])
|
||||
);
|
||||
if (empty($data)) {
|
||||
$data[] = array('user_widget_id'=>'0','widget_id'=>1,'title'=>'Add a widget','widget'=>'placeholder','col'=>1,'row'=>1,'size_x'=>6,'size_y'=>2,'refresh'=>60);
|
||||
}
|
||||
|
||||
$data = serialize(json_encode($data));
|
||||
$dash_config = unserialize(stripslashes($data));
|
||||
|
||||
if (empty($vars['bare']) || $vars['bare'] == "no") {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="btn-group btn-lg">
|
||||
<button class="btn btn-default disabled" style="min-width:160px;"><span class="pull-left">Dashboards</span></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="min-width:160px;"><span class="pull-left"><?php echo ($vars['dashboard']['user_id'] != Auth::id() ? $vars['dashboard']['username'].':' : ''); ?><?php echo $vars['dashboard']['dashboard_name']; ?></span>
|
||||
<span class="pull-right">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<?php
|
||||
|
||||
$nodash = true;
|
||||
foreach ($user_dashboards as $dash) {
|
||||
if ($dash['dashboard_id'] != $vars['dashboard']['dashboard_id']) {
|
||||
echo ' <li><a href="' . rtrim(Config::get('base_url'), '/') . '/overview/dashboard=' . $dash['dashboard_id'] . '">' . $dash['dashboard_name'] . '</a></li>';
|
||||
$nodash = false;
|
||||
}
|
||||
}
|
||||
if ($nodash) {
|
||||
echo ' <li><a>No other Dashboards</a></li>';
|
||||
}
|
||||
|
||||
if (!empty($shared_dashboards)) {
|
||||
echo ' <li role="separator" class="divider"></li>';
|
||||
echo ' <li class="dropdown-header">Shared Dashboards</li>';
|
||||
foreach ($shared_dashboards as $dash) {
|
||||
if ($dash['dashboard_id'] != $vars['dashboard']['dashboard_id']) {
|
||||
echo ' <li><a href="' . rtrim(Config::get('base_url'), '/') . '/overview/dashboard=' . $dash['dashboard_id'] . '"> ' . $dash['username'] . ':' . $dash['dashboard_name'] . ($dash['access'] == 1 ? ' (Read)' : '') . '</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<button class="btn btn-default edit-dash-btn" href="#edit_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="Edit Dashboard"><i class="fa fa-pencil-square-o fa-fw"></i></button>
|
||||
<button class="btn btn-danger" href="#del_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="Remove Dashboard"><i class="fa fa-trash fa-fw"></i></button>
|
||||
<button class="btn btn-success" href="#add_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="New Dashboard"><i class="fa fa-plus fa-fw"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dash-collapse" id="add_dash">
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<form class="form-inline" onsubmit="dashboard_add(this); return false;" name="add_form" id="add_form">
|
||||
<?php echo csrf_field() ?>
|
||||
<div class="col-sm-3 col-sx-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default disabled" type="button" style="min-width:160px;"><span class="pull-left">New Dashboard</span></a>
|
||||
</span>
|
||||
<input class="form-control" type="text" placeholder="Name" name="dashboard_name" id="dashboard_name" style="min-width:160px;">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="submit">Add</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="dash-collapse" id="edit_dash">
|
||||
<!-- Start Dashboard-Settings -->
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<form class="form-inline" onsubmit="dashboard_edit(this); return false;">
|
||||
<?php echo csrf_field() ?>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default disabled" type="button" style="min-width:160px;"><span class="pull-left">Dashboard Name</span></a>
|
||||
</span>
|
||||
<input class="form-control" type="text" placeholder="Dashbord Name" name="dashboard_name" value="<?php echo $vars['dashboard']['dashboard_name']; ?>" style="width:160px;">
|
||||
<select class="form-control" name="access" style="width:160px;">
|
||||
<?php
|
||||
foreach (array('Private','Shared (Read)','Shared') as $k => $v) {
|
||||
echo ' <option value="'.$k.'"'.($vars['dashboard']['access'] == $k ? 'selected' : '').'>'.$v.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span class="input-group-btn pull-left">
|
||||
<button class="btn btn-primary" type="submit">Update</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Dashboard-Settings -->
|
||||
|
||||
<!-- Start Widget-Select -->
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-default disabled" role="button" style="min-width:160px;"><span class="pull-left">Add Widgets</span></a>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="min-width:160px;"><span class="pull-left">Select Widget</span>
|
||||
<span class="pull-right">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<?php
|
||||
foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widgets) {
|
||||
echo ' <li><a href="#" onsubmit="return false;" class="place_widget" data-widget_id="'.$widgets['widget_id'] .'">'. $widgets['widget_title'] .'</a></li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Widget-Select -->
|
||||
<hr>
|
||||
</div>
|
||||
<div class="dash-collapse" id="del_dash">
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-danger" type="button" id="clear_widgets" name="clear_widgets" style="min-width:160px;"><span class="pull-left">Remove</span><strong class="pull-right">Widgets</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-danger" type="button" onclick="dashboard_delete(this); return false;" data-dashboard="<?php echo $vars['dashboard']['dashboard_id']; ?>" style="min-width:160px;"><span class="pull-left">Delete</span><strong class="pull-right">Dashboard</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<?php } //End Vars['bare'] If
|
||||
?>
|
||||
<script src="js/jquery.gridster.min.js"></script>
|
||||
|
||||
<span class="message" id="message"></span>
|
||||
|
||||
<div class="gridster grid">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var gridster;
|
||||
|
||||
var serialization = <?php echo $dash_config; ?>;
|
||||
|
||||
serialization = Gridster.sort_by_row_and_col_asc(serialization);
|
||||
|
||||
function updatePos(gridster) {
|
||||
var s = JSON.stringify(gridster.serialize());
|
||||
<?php
|
||||
if ($vars['dashboard']['dashboard_id'] > 0) {
|
||||
echo "var dashboard_id = " . $vars['dashboard']['dashboard_id'] . ";";
|
||||
} else {
|
||||
echo "var dashboard_id = 0;";
|
||||
}
|
||||
?>
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
data: s,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var gridster_state = 0;
|
||||
|
||||
$(function(){
|
||||
<?php
|
||||
if ($vars['dashboard']['dashboard_id'] > 0) {
|
||||
echo "var dashboard_id = " . $vars['dashboard']['dashboard_id'] . ";";
|
||||
} else {
|
||||
echo "var dashboard_id = 0;";
|
||||
}
|
||||
?>
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
dashboard_collapse();
|
||||
gridster = $(".gridster ul").gridster({
|
||||
widget_base_dimensions: ['auto', 100],
|
||||
autogenerate_stylesheet: true,
|
||||
widget_margins: [5, 5],
|
||||
avoid_overlapped_widgets: true,
|
||||
min_cols: 1,
|
||||
max_cols: 20,
|
||||
draggable: {
|
||||
handle: 'header, span',
|
||||
stop: function(e, ui, $widget) {
|
||||
updatePos(gridster);
|
||||
},
|
||||
},
|
||||
resize: {
|
||||
enabled: true,
|
||||
stop: function(e, ui, widget) {
|
||||
updatePos(gridster);
|
||||
widget_reload(widget.attr('id'),widget.data('type'));
|
||||
}
|
||||
},
|
||||
serialize_params: function(w, wgd) {
|
||||
return {
|
||||
id: $(w).attr('id'),
|
||||
col: wgd.col,
|
||||
row: wgd.row,
|
||||
size_x: wgd.size_x,
|
||||
size_y: wgd.size_y
|
||||
};
|
||||
}
|
||||
}).data('gridster');
|
||||
$('.gridster ul').css({'width': $(window).width()});
|
||||
|
||||
gridster.remove_all_widgets();
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
$.each(serialization, function() {
|
||||
widget_dom(this);
|
||||
});
|
||||
$(document).on('click','.edit-dash-btn', function() {
|
||||
if (gridster_state == 0) {
|
||||
gridster.enable();
|
||||
gridster.enable_resize();
|
||||
gridster_state = 1;
|
||||
$('.fade-edit').fadeIn();
|
||||
}
|
||||
else {
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
gridster_state = 0;
|
||||
$('.fade-edit').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click','#clear_widgets', function() {
|
||||
var widget_id = $(this).data('widget-id');
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'remove-all',
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
gridster.remove_all_widgets();
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.place_widget').on('click', function(event, state) {
|
||||
var widget_id = $(this).data('widget_id');
|
||||
event.preventDefault();
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'add',
|
||||
widget_id: widget_id,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
widget_dom(data.extra);
|
||||
updatePos(gridster);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on( "click", ".close-widget", function() {
|
||||
var widget_id = $(this).data('widget-id');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'remove',
|
||||
widget_id: widget_id,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
gridster.remove_widget($('#'+widget_id));
|
||||
updatePos(gridster);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click",".edit-widget",function() {
|
||||
obj = $(this).parent().parent().parent();
|
||||
if( obj.data('settings') == 1 ) {
|
||||
obj.data('settings','0');
|
||||
} else {
|
||||
obj.data('settings','1');
|
||||
}
|
||||
widget_reload(obj.attr('id'),obj.data('type'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function dashboard_collapse(target) {
|
||||
if (target !== undefined) {
|
||||
$('.dash-collapse:not('+target+')').each(function() {
|
||||
$(this).fadeOut(0);
|
||||
});
|
||||
$(target).fadeToggle(300);
|
||||
if (target != "#edit_dash") {
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
gridster_state = 0;
|
||||
$('.fade-edit').fadeOut();
|
||||
}
|
||||
} else {
|
||||
$('.dash-collapse').fadeOut(0);
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_delete(data) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: 'delete-dashboard',
|
||||
dashboard_id: $(data).data('dashboard')
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "<?php echo rtrim(Config::get('base_url'), '/'); ?>/overview";
|
||||
}, 500);
|
||||
|
||||
} else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function dashboard_edit(data) {
|
||||
<?php
|
||||
if ($vars['dashboard']['dashboard_id'] > 0) {
|
||||
echo "var dashboard_id = " . $vars['dashboard']['dashboard_id'] . ";";
|
||||
} else {
|
||||
echo "var dashboard_id = 0;";
|
||||
}
|
||||
?>
|
||||
datas = $(data).serializeArray();
|
||||
data = [];
|
||||
for( var field in datas ) {
|
||||
data[datas[field].name] = datas[field].value;
|
||||
}
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: 'edit-dashboard',
|
||||
dashboard_name: data['dashboard_name'],
|
||||
dashboard_id: dashboard_id,
|
||||
access: data['access']
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == "ok") {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "<?php echo rtrim(Config::get('base_url'), '/'); ?>/overview/dashboard=" + dashboard_id;
|
||||
}, 500);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_add(data) {
|
||||
datas = $(data).serializeArray();
|
||||
data = [];
|
||||
for( var field in datas ) {
|
||||
data[datas[field].name] = datas[field].value;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {type: 'add-dashboard', dashboard_name: data['dashboard_name']},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "<?php echo rtrim(Config::get('base_url'), '/'); ?>/overview/dashboard=" + data.dashboard_id;
|
||||
}, 500);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function widget_dom(data) {
|
||||
dom = '<li id="'+data.user_widget_id+'" data-type="'+data.widget+'" data-settings="0">'+
|
||||
'<header class="widget_header"><span id="widget_title_'+data.user_widget_id+'">'+data.title+
|
||||
'</span>'+
|
||||
'<span class="fade-edit pull-right">'+
|
||||
<?php
|
||||
if (($vars['dashboard']['access'] == 1 && Auth::id() === $vars['dashboard']['user_id']) ||
|
||||
($vars['dashboard']['access'] == 0 || $vars['dashboard']['access'] == 2)) {
|
||||
echo "'<i class=\"fa fa-pencil-square-o edit-widget\" data-widget-id=\"'+data.user_widget_id+'\" aria-label=\"Settings\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Settings\"> </i> '+";
|
||||
}
|
||||
?>
|
||||
'<i class="text-danger fa fa-times close-widget" data-widget-id="'+data.user_widget_id+'" aria-label="Close" data-toggle="tooltip" data-placement="top" title="Remove"> </i> '+
|
||||
'</span>'+
|
||||
'</header>'+
|
||||
'<div class="widget_body" id="widget_body_'+data.user_widget_id+'">'+data.widget+'</div>'+
|
||||
'\<script\>var timeout'+data.user_widget_id+' = grab_data('+data.user_widget_id+','+data.refresh+',\''+data.widget+'\');\<\/script\>'+
|
||||
'</li>';
|
||||
if (data.hasOwnProperty('col') && data.hasOwnProperty('row')) {
|
||||
gridster.add_widget(dom, parseInt(data.size_x), parseInt(data.size_y), parseInt(data.col), parseInt(data.row));
|
||||
} else {
|
||||
gridster.add_widget(dom, parseInt(data.size_x), parseInt(data.size_y));
|
||||
}
|
||||
if (gridster_state == 0) {
|
||||
$('.fade-edit').fadeOut(0);
|
||||
}
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
|
||||
function widget_settings(data) {
|
||||
var widget_settings = {};
|
||||
var widget_id = 0;
|
||||
var datas = $(data).serializeArray();
|
||||
for( var field in datas ) {
|
||||
var name = datas[field].name;
|
||||
if (name.endsWith('[]')) {
|
||||
name = name.slice(0, -2);
|
||||
if (widget_settings[name]) {
|
||||
widget_settings[name].push(datas[field].value);
|
||||
} else {
|
||||
widget_settings[name] = [datas[field].value];
|
||||
}
|
||||
} else {
|
||||
widget_settings[name] = datas[field].value;
|
||||
}
|
||||
}
|
||||
|
||||
$('.gridster').find('div[id^=widget_body_]').each(function() {
|
||||
if(this.contains(data)) {
|
||||
widget_id = $(this).parent().attr('id');
|
||||
widget_type = $(this).parent().data('type');
|
||||
$(this).parent().data('settings','0');
|
||||
}
|
||||
});
|
||||
if( widget_id > 0 && widget_settings != {} ) {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: '<?php echo url('/ajax/form/widget-settings/'); ?>/' + widget_id,
|
||||
data: {settings: widget_settings},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
widget_reload(widget_id,widget_type);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function widget_reload(id,data_type) {
|
||||
$("#widget_body_"+id+" .bootgrid-table").bootgrid("destroy");
|
||||
$("#widget_body_"+id+" *").off();
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
if ($widget_body.parent().data('settings') == 1 ) {
|
||||
settings = 1;
|
||||
} else {
|
||||
settings = 0;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url + '/dash/' + data_type,
|
||||
data: {
|
||||
id: id,
|
||||
dimensions: {x:$widget_body.width(), y:$widget_body.height()},
|
||||
settings:settings
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
$widget_body.empty();
|
||||
if (data.status === 'ok') {
|
||||
$("#widget_title_"+id).html(data.title);
|
||||
$widget_body.html(data.html).parent().data('settings', data.show_settings);
|
||||
} else {
|
||||
$widget_body.html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
$widget_body.empty();
|
||||
if (data.responseJSON.error) {
|
||||
$widget_body.html('<div class="alert alert-info">' + data.responseJSON.error + '</div>');
|
||||
} else {
|
||||
$widget_body.html('<div class="alert alert-info"><?php echo __('Problem with backend'); ?></div>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function grab_data(id,refresh,data_type) {
|
||||
if( $("#widget_body_"+id).parent().data('settings') == 0 ) {
|
||||
widget_reload(id,data_type);
|
||||
}
|
||||
new_refresh = refresh * 1000;
|
||||
setTimeout(function() {
|
||||
grab_data(id,refresh,data_type);
|
||||
},
|
||||
new_refresh);
|
||||
}
|
||||
$('#new-widget').popover();
|
||||
|
||||
<?php
|
||||
if (empty($vars['dashboard']['dashboard_id']) && $default_dash == 0) {
|
||||
echo "\$('#dashboard_name').val('Default');\n";
|
||||
echo "dashboard_add(\$('#add_form'));\n";
|
||||
}
|
||||
?>
|
||||
|
||||
</script>
|
||||
@@ -1,188 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Overview pages have changed to a new format, this page will not be converted to the new format and will be removed in the next release (1.59).
|
||||
<br>For more info, see: <a href="https://t.libren.ms/overview">https://t.libren.ms/overview</a>
|
||||
</div>
|
||||
</div>
|
||||
<table border=0 cellpadding=10 cellspacing=10 width=100%>
|
||||
<tr>
|
||||
<td bgcolor=#e5e5e5 valign=top>
|
||||
<?php
|
||||
|
||||
use LibreNMS\Config;
|
||||
|
||||
$nodes = array();
|
||||
$param = array();
|
||||
$uptimesql = '';
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && Config::get('uptime_warning') > 0) {
|
||||
$uptimesql = ' AND A.attrib_value < ?';
|
||||
$param = [Config::get('uptime_warning')];
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' ".$uptimesql, $param) as $device) {
|
||||
unset($already);
|
||||
$i = 0;
|
||||
while ($i <= count($nodes)) {
|
||||
$thisnode = $device['device_id'];
|
||||
if ($nodes[$i] == $thisnode) {
|
||||
$already = 'yes';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$already) {
|
||||
$nodes[] = $device['device_id'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'") as $device) {
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span><br />
|
||||
<span class=body-date-1>".truncate($device['location'], 35).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::get('warn.ifdown')) {
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'") as $interface) {
|
||||
if (port_permitted($interface['port_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
|
||||
<strong>".generate_port_link($interface, makeshortif($interface['ifDescr'])).'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'") as $service) {
|
||||
if (device_permitted($service['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />
|
||||
<strong>".$service['service_type'].'</strong><br />
|
||||
<span class=body-date-1>'.truncate($interface['ifAlias'], 15).'</span>
|
||||
</center></div>';
|
||||
}
|
||||
}
|
||||
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id") as $peer) {
|
||||
if (device_permitted($peer['device_id'])) {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />
|
||||
<strong>".$peer['bgpPeerIdentifier'].'</strong><br />
|
||||
<span class=body-date-1>AS'.$peer['bgpPeerRemoteAs'].' '.truncate($peer['astext'], 10).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (filter_var(Config::get('uptime_warning'), FILTER_VALIDATE_FLOAT) !== false && Config::get('uptime_warning') > 0) {
|
||||
foreach (dbFetchRows("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < ? AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'", [Config::get('uptime_warning')]) as $device) {
|
||||
if (device_permitted($device['device_id']) && $device['attrib_value'] < Config::get('uptime_warning') && $device['attrib_type'] == 'uptime') {
|
||||
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
|
||||
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
|
||||
<span class=body-date-1>".formatUptime($device['attrib_value']).'</span>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
<div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'>
|
||||
|
||||
<h3>Recent Syslog Messages</h3>
|
||||
|
||||
";
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '" . Config::get('dateformat.mysql.compact') . "') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
|
||||
echo '<table cellspacing=0 cellpadding=2 width=100%>';
|
||||
foreach (dbFetchRows($sql) as $entry) {
|
||||
unset($syslog_output);
|
||||
include 'includes/html/print-syslog.inc.php';
|
||||
echo $syslog_output;
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</div>
|
||||
|
||||
</td>
|
||||
<td bgcolor=#e5e5e5 width=470 valign=top>';
|
||||
|
||||
// this stuff can be customised to show whatever you want....
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['transit'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['peering'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Core: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
unset($seperator);
|
||||
foreach (dbFetchRows($sql) as $interface) {
|
||||
$ports['core'] .= $seperator.$interface['port_id'];
|
||||
$seperator = ',';
|
||||
}
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['peering'] && $ports['transit']) {
|
||||
echo "<div style='width: 235px; '>
|
||||
<a href='internet/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Aggregate Internet Traffic</div>" . "<img src='graph.php?type=multiport_bits_duo&id=" . $ports['peering'] . '&idb=' . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=385&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style=' margin-bottom: 5px;'>";
|
||||
|
||||
if ($ports['transit']) {
|
||||
echo "<div style='width: 235px; float: left;'>
|
||||
<a href='iftype/transit/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Transit</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['transit'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
if ($ports['peering']) {
|
||||
echo "<div style='width: 235px; float: right;'>
|
||||
<a href='iftype/peering/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Peering</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['peering'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=155&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
if ($ports['core']) {
|
||||
echo "<div style='width: 235px;'>
|
||||
<a href='iftype/core/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['core'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multiport_bits&id=" . $ports['core'] . '&from=' . Config::get('time.week') . '&to=' . Config::get('time.now') . "&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<div style='font-size: 16px; font-weight: bold; color: #555555;'>Core Traffic</div>" . "<img src='graph.php?type=multiport_bits&id=" . $ports['core'] . '&from=' . Config::get('time.day') . '&to=' . Config::get('time.now') . "&width=385&height=100&legend=no'></a></div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}//end if
|
||||
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
</tr></table>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
$hostname = gethostbyid($alert_entry['device_id']);
|
||||
$alert_state = $alert_entry['state'];
|
||||
|
||||
echo '<tr>
|
||||
<td>
|
||||
'.$alert_entry['time_logged'].'
|
||||
</td>';
|
||||
|
||||
if (!isset($alert_entry['device'])) {
|
||||
$dev = device_by_id_cache($alert_entry['device_id']);
|
||||
echo '<td>
|
||||
'.generate_device_link($dev, shorthost($dev['hostname'])).'
|
||||
</td>';
|
||||
}
|
||||
|
||||
echo '<td>'.htmlspecialchars($alert_entry['name']).'</td>';
|
||||
|
||||
echo "<td>";
|
||||
if ($alert_state != '') {
|
||||
if ($alert_state == '0') {
|
||||
$fa_icon = 'check';
|
||||
$fa_color = 'success';
|
||||
$text = 'Ok';
|
||||
} elseif ($alert_state == '1') {
|
||||
$fa_icon = 'remove';
|
||||
$fa_color = 'danger';
|
||||
$text = 'Alert';
|
||||
} elseif ($alert_state == '2') {
|
||||
$fa_icon = 'info-circle';
|
||||
$fa_color = 'muted';
|
||||
$text = 'Ack';
|
||||
} elseif ($alert_state == '3') {
|
||||
$fa_icon = 'arrow-down';
|
||||
$fa_color = 'warning';
|
||||
$text = 'Worse';
|
||||
} elseif ($alert_state == '4') {
|
||||
$fa_icon = 'arrow-up';
|
||||
$fa_color = 'info';
|
||||
$text = 'Better';
|
||||
}//end if
|
||||
echo "<b><i class='fa fa-fw fa-".$fa_icon." text-".$fa_color."'></i> $text</b>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
echo '</tr>';
|
||||
@@ -1532,7 +1532,7 @@
|
||||
"type": "text"
|
||||
},
|
||||
"front_page": {
|
||||
"default": "pages/front/tiles.php",
|
||||
"default": "default",
|
||||
"type": "text"
|
||||
},
|
||||
"front_page_down_box_limit": {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,606 @@
|
||||
@extends('layouts.librenmsv1')
|
||||
|
||||
@section('title', __('Overview'))
|
||||
|
||||
@section('content')
|
||||
@if (!$bare)
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="btn-group btn-lg">
|
||||
<button class="btn btn-default disabled" style="min-width:160px;"><span class="pull-left">Dashboards</span></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="min-width:160px;"><span class="pull-left">{{ $dashboard->user_id != Auth::id() ? $dashboard->user->username.':' : null}} {{ $dashboard->dashboard_name }}</span>
|
||||
<span class="pull-right">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@forelse ($user_dashboards as $dash)
|
||||
@if($dash->dashboard_id != $dashboard->dashboard_id)
|
||||
<li>
|
||||
<a href="{{ url("?dashboard=$dash->dashboard_id") }}">{{ $dash->dashboard_name }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@empty
|
||||
<li><a>No other Dashboards</a></li>
|
||||
@endforelse
|
||||
|
||||
@isset($shared_dashboards)
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Shared Dashboards</li>
|
||||
@foreach ($shared_dashboards as $dash)
|
||||
@if($dash->dashboard_id != $dashboard->dashboard_id)
|
||||
<li>
|
||||
<a href="{{ url("?dashboard=$dash->dashboard_id") }}">
|
||||
{{ $dash->username . ':' . $dash->dashboard_name . ($dash->access == 1 ? ' (Read)' : '') }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
@endisset
|
||||
</ul>
|
||||
</div>
|
||||
<button class="btn btn-default edit-dash-btn" href="#edit_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="Edit Dashboard"><i class="fa fa-pencil-square-o fa-fw"></i></button>
|
||||
<button class="btn btn-danger" href="#del_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="Remove Dashboard"><i class="fa fa-trash fa-fw"></i></button>
|
||||
<button class="btn btn-success" href="#add_dash" onclick="dashboard_collapse($(this).attr('href'))" data-toggle="tooltip" data-container="body" data-placement="top" title="New Dashboard"><i class="fa fa-plus fa-fw"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dash-collapse" id="add_dash" style="display: none;" >
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<form class="form-inline" onsubmit="dashboard_add(this); return false;" name="add_form" id="add_form">
|
||||
@csrf
|
||||
<div class="col-sm-3 col-sx-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default disabled" type="button" style="min-width:160px;"><span class="pull-left">New Dashboard</span></a>
|
||||
</span>
|
||||
<input class="form-control" type="text" placeholder="Name" name="dashboard_name" id="dashboard_name" style="min-width:160px;">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="submit">Add</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="dash-collapse" id="edit_dash" style="display: none;">
|
||||
<!-- Start Dashboard-Settings -->
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<form class="form-inline" onsubmit="dashboard_edit(this); return false;">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default disabled" type="button" style="min-width:160px;"><span class="pull-left">Dashboard Name</span></a>
|
||||
</span>
|
||||
<input class="form-control" type="text" placeholder="Dashbord Name" name="dashboard_name" value="{{ $dashboard->dashboard_name }}" style="width:160px;">
|
||||
<select class="form-control" name="access" style="width:160px;">
|
||||
@foreach (array('Private','Shared (Read)','Shared') as $k => $v)
|
||||
<option value="{{ $k }}" {{ $dashboard->access == $k ? 'selected' : null }}>{{ $v }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="input-group-btn pull-left">
|
||||
<button class="btn btn-primary" type="submit">Update</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Dashboard-Settings -->
|
||||
<!-- Start Widget-Select -->
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-default disabled" role="button" style="min-width:160px;"><span class="pull-left">Add Widgets</span></a>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="min-width:160px;"><span class="pull-left">Select Widget</span>
|
||||
<span class="pull-right">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@foreach ($widgets as $widget)
|
||||
<li>
|
||||
<a href="#" onsubmit="return false;" class="place_widget" data-widget_id="{{ $widget->widget_id }}">{{ $widget->widget_title }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Widget-Select -->
|
||||
<hr>
|
||||
</div>
|
||||
<div class="dash-collapse" id="del_dash" style="display: none;">
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-danger" type="button" id="clear_widgets" name="clear_widgets" style="min-width:160px;"><span class="pull-left">Remove</span><strong class="pull-right">Widgets</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top:5px;">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-danger" type="button" onclick="dashboard_delete(this); return false;" data-dashboard="{{ $dashboard->dashboard_id }}" style="min-width:160px;"><span class="pull-left">Delete</span><strong class="pull-right">Dashboard</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@endif
|
||||
<span class="message" id="message"></span>
|
||||
<div class="gridster grid">
|
||||
<ul></ul>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascript')
|
||||
<script type="text/javascript" src="js/jquery.gridster.min.js"></script>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var gridster;
|
||||
|
||||
var serialization = {!! $dash_config !!};
|
||||
|
||||
serialization = Gridster.sort_by_row_and_col_asc(serialization);
|
||||
var gridster_state = 0;
|
||||
|
||||
|
||||
@if ($dashboard->dashboard_id > 0)
|
||||
var dashboard_id = {{ $dashboard->dashboard_id }};
|
||||
@else
|
||||
var dashboard_id = 0;
|
||||
@endif
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
dashboard_collapse();
|
||||
gridster = $(".gridster ul").gridster({
|
||||
widget_base_dimensions: ['auto', 100],
|
||||
autogenerate_stylesheet: true,
|
||||
widget_margins: [5, 5],
|
||||
avoid_overlapped_widgets: true,
|
||||
min_cols: 1,
|
||||
max_cols: 20,
|
||||
draggable: {
|
||||
handle: 'header, span',
|
||||
stop: function(e, ui, $widget) {
|
||||
updatePos(gridster);
|
||||
},
|
||||
},
|
||||
resize: {
|
||||
enabled: true,
|
||||
stop: function(e, ui, widget) {
|
||||
updatePos(gridster);
|
||||
widget_reload(widget.attr('id'), widget.data('type'));
|
||||
}
|
||||
},
|
||||
serialize_params: function(w, wgd) {
|
||||
return {
|
||||
id: $(w).attr('id'),
|
||||
col: wgd.col,
|
||||
row: wgd.row,
|
||||
size_x: wgd.size_x,
|
||||
size_y: wgd.size_y
|
||||
};
|
||||
}
|
||||
}).data('gridster');
|
||||
$('.gridster ul').css({'width': $(window).width()});
|
||||
|
||||
gridster.remove_all_widgets();
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
$.each(serialization, function() {
|
||||
widget_dom(this);
|
||||
});
|
||||
$(document).on('click','.edit-dash-btn', function() {
|
||||
if (gridster_state == 0) {
|
||||
gridster.enable();
|
||||
gridster.enable_resize();
|
||||
gridster_state = 1;
|
||||
$('.fade-edit').fadeIn();
|
||||
}
|
||||
else {
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
gridster_state = 0;
|
||||
$('.fade-edit').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click','#clear_widgets', function() {
|
||||
var widget_id = $(this).data('widget-id');
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'remove-all',
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
gridster.remove_all_widgets();
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.place_widget').on('click', function(event, state) {
|
||||
var widget_id = $(this).data('widget_id');
|
||||
event.preventDefault();
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'add',
|
||||
widget_id: widget_id,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
widget_dom(data.extra);
|
||||
updatePos(gridster);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on( "click", ".close-widget", function() {
|
||||
var widget_id = $(this).data('widget-id');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
sub_type: 'remove',
|
||||
widget_id: widget_id,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
gridster.remove_widget($('#'+widget_id));
|
||||
updatePos(gridster);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click",".edit-widget",function() {
|
||||
obj = $(this).parent().parent().parent();
|
||||
if( obj.data('settings') == 1 ) {
|
||||
obj.data('settings','0');
|
||||
} else {
|
||||
obj.data('settings','1');
|
||||
}
|
||||
widget_reload(obj.attr('id'),obj.data('type'));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function updatePos(gridster) {
|
||||
var s = JSON.stringify(gridster.serialize());
|
||||
|
||||
@if ($dashboard->dashboard_id > 0)
|
||||
var dashboard_id = {{ $dashboard->dashboard_id }};
|
||||
@else
|
||||
var dashboard_id = 0;
|
||||
@endif
|
||||
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: "update-dashboard-config",
|
||||
data: s,
|
||||
dashboard_id: dashboard_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_collapse(target) {
|
||||
if (target !== undefined) {
|
||||
$('.dash-collapse:not('+target+')').each(function() {
|
||||
$(this).fadeOut(0);
|
||||
});
|
||||
$(target).fadeToggle(300);
|
||||
if (target != "#edit_dash") {
|
||||
gridster.disable();
|
||||
gridster.disable_resize();
|
||||
gridster_state = 0;
|
||||
$('.fade-edit').fadeOut();
|
||||
}
|
||||
} else {
|
||||
$('.dash-collapse').fadeOut(0);
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_delete(data) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: 'delete-dashboard',
|
||||
dashboard_id: $(data).data('dashboard')
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "{{ url('/') }}";
|
||||
}, 500);
|
||||
|
||||
} else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function dashboard_edit(data) {
|
||||
@if ($dashboard->dashboard_id > 0)
|
||||
var dashboard_id = {{ $dashboard->dashboard_id }};
|
||||
@else
|
||||
var dashboard_id = 0;
|
||||
@endif
|
||||
datas = $(data).serializeArray();
|
||||
data = [];
|
||||
for( var field in datas ) {
|
||||
data[datas[field].name] = datas[field].value;
|
||||
}
|
||||
if (dashboard_id > 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {
|
||||
type: 'edit-dashboard',
|
||||
dashboard_name: data['dashboard_name'],
|
||||
dashboard_id: dashboard_id,
|
||||
access: data['access']
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == "ok") {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "{{ url('/?dashboard=') }} + dashboard_id";
|
||||
}, 500);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dashboard_add(data) {
|
||||
datas = $(data).serializeArray();
|
||||
data = [];
|
||||
for( var field in datas ) {
|
||||
data[datas[field].name] = datas[field].value;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: {type: 'add-dashboard', dashboard_name: data['dashboard_name']},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
toastr.success(data.message);
|
||||
setTimeout(function (){
|
||||
window.location.href = "{{ url('/?dashboard=') }} + data.dashboard_id";
|
||||
}, 500);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function widget_dom(data) {
|
||||
dom = '<li id="'+data.user_widget_id+'" data-type="'+data.widget+'" data-settings="0">'+
|
||||
'<header class="widget_header"><span id="widget_title_'+data.user_widget_id+'">'+data.title+
|
||||
'</span>'+
|
||||
'<span class="fade-edit pull-right">'+
|
||||
|
||||
@if (
|
||||
($dashboard->access == 1 && Auth::id() === $dashboard->user_id) ||
|
||||
($dashboard->access == 0 || $dashboard->access == 2)
|
||||
)
|
||||
'<i class="fa fa-pencil-square-o edit-widget" data-widget-id="'+data.user_widget_id+'" aria-label="Settings" data-toggle="tooltip" data-placement="top" title="Settings"> </i> '+
|
||||
@endif
|
||||
'<i class="text-danger fa fa-times close-widget" data-widget-id="'+data.user_widget_id+'" aria-label="Close" data-toggle="tooltip" data-placement="top" title="Remove"> </i> '+
|
||||
'</span>'+
|
||||
'</header>'+
|
||||
'<div class="widget_body" id="widget_body_'+data.user_widget_id+'">'+data.widget+'</div>'+
|
||||
'\<script\>var timeout'+data.user_widget_id+' = grab_data('+data.user_widget_id+','+data.refresh+',\''+data.widget+'\');\<\/script\>'+
|
||||
'</li>';
|
||||
|
||||
if (data.hasOwnProperty('col') && data.hasOwnProperty('row')) {
|
||||
gridster.add_widget(dom, parseInt(data.size_x), parseInt(data.size_y), parseInt(data.col), parseInt(data.row));
|
||||
} else {
|
||||
gridster.add_widget(dom, parseInt(data.size_x), parseInt(data.size_y));
|
||||
}
|
||||
if (gridster_state == 0) {
|
||||
$('.fade-edit').fadeOut(0);
|
||||
}
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
|
||||
function widget_settings(data) {
|
||||
var widget_settings = {};
|
||||
var widget_id = 0;
|
||||
var datas = $(data).serializeArray();
|
||||
for( var field in datas ) {
|
||||
var name = datas[field].name;
|
||||
if (name.endsWith('[]')) {
|
||||
name = name.slice(0, -2);
|
||||
if (widget_settings[name]) {
|
||||
widget_settings[name].push(datas[field].value);
|
||||
} else {
|
||||
widget_settings[name] = [datas[field].value];
|
||||
}
|
||||
} else {
|
||||
widget_settings[name] = datas[field].value;
|
||||
}
|
||||
}
|
||||
|
||||
$('.gridster').find('div[id^=widget_body_]').each(function() {
|
||||
if(this.contains(data)) {
|
||||
widget_id = $(this).parent().attr('id');
|
||||
widget_type = $(this).parent().data('type');
|
||||
$(this).parent().data('settings','0');
|
||||
}
|
||||
});
|
||||
if( widget_id > 0 && widget_settings != {} ) {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: '{{ url('/ajax/form/widget-settings/') }}/' + widget_id,
|
||||
data: {settings: widget_settings},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if( data.status == "ok" ) {
|
||||
widget_reload(widget_id, widget_type);
|
||||
toastr.success(data.message);
|
||||
}
|
||||
else {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
toastr.error(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function widget_reload(id, data_type) {
|
||||
$("#widget_body_"+id+" .bootgrid-table").bootgrid("destroy");
|
||||
$("#widget_body_"+id+" *").off();
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
if ($widget_body.parent().data('settings') == 1 ) {
|
||||
settings = 1;
|
||||
} else {
|
||||
settings = 0;
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url + '/dash/' + data_type,
|
||||
data: {
|
||||
id: id,
|
||||
dimensions: {x:$widget_body.width(), y:$widget_body.height()},
|
||||
settings:settings
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
$widget_body.empty();
|
||||
if (data.status === 'ok') {
|
||||
$("#widget_title_"+id).html(data.title);
|
||||
$widget_body.html(data.html).parent().data('settings', data.show_settings);
|
||||
} else {
|
||||
$widget_body.html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
var $widget_body = $("#widget_body_"+id);
|
||||
$widget_body.empty();
|
||||
if (data.responseJSON.error) {
|
||||
$widget_body.html('<div class="alert alert-info">' + data.responseJSON.error + '</div>');
|
||||
} else {
|
||||
$widget_body.html('<div class="alert alert-info">{{ __('Problem with backend') }}</div>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function grab_data(id,refresh, data_type) {
|
||||
if( $("#widget_body_"+id).parent().data('settings') == 0 ) {
|
||||
widget_reload(id, data_type);
|
||||
}
|
||||
new_refresh = refresh * 1000;
|
||||
setTimeout(function() {
|
||||
grab_data(id,refresh,data_type);
|
||||
},
|
||||
new_refresh);
|
||||
}
|
||||
$('#new-widget').popover();
|
||||
|
||||
@if (empty($dashboard->dashboard_id) && $default_dash == 0)
|
||||
$('#dashboard_name').val('Default');
|
||||
dashboard_add($('#add_form'));
|
||||
@endif
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,124 @@
|
||||
@extends('layouts.librenmsv1')
|
||||
|
||||
@section('title', __('Overview'))
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
@if (Config::get('vertical_summary'))
|
||||
<div class="col-md-9">
|
||||
@else
|
||||
<div class="col-md-8">
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class=front-page>
|
||||
<div class="status-boxes">
|
||||
|
||||
@foreach ($devices_down as $device)
|
||||
<div class="front-box device-down">
|
||||
{!! \LibreNMS\Util\Url::deviceLink($device, $device->shortDisplayName()) !!}
|
||||
<br />
|
||||
<span class=list-device-down>@lang('Device Down')</span>
|
||||
<br />
|
||||
<span class=body-date-1>{{ \LibreNMS\Util\StringHelpers::shortenText($device->location, 20) }}</span>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach ($ports_down as $port)
|
||||
<div class="front-box alert alert-danger">
|
||||
{!! \LibreNMS\Util\Url::deviceLink($port->device, $port->device->shortDisplayName()) !!}
|
||||
<br />
|
||||
<span class="interface-updown">@lang('Port Down')</span>
|
||||
<br />
|
||||
{!! \LibreNMS\Util\Url::PortLink($port) !!}
|
||||
@if($port->ifAlias)
|
||||
<br />
|
||||
<span class="body-date-1">{{ \LibreNMS\Util\StringHelpers::shortenText($port->getLabel(), 20) }}</span>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach ($services_down as $service)
|
||||
<div class="front-box service-down">
|
||||
{!! \LibreNMS\Util\Url::deviceLink($service->device, $service->device->shortDisplayName()) !!}
|
||||
<span class=service-down>@lang('Service Down')</span>
|
||||
{{ $service->service_type }}
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach ($bgp_down as $bgp)
|
||||
<div class="front-box bgp-down">
|
||||
{!! \LibreNMS\Util\Url::deviceLink($bgp->device, $bgp->device->shortDisplayName()) !!}
|
||||
<span class="bgp-down">@lang('BGP Down')</span>
|
||||
<span class="{{ (strstr($bgp->bgpPeerIdentifier, ':') ? 'front-page-bgp-small' : 'front-page-bgp-normal') }}">
|
||||
{{ $bgp->bgpPeerIdentifier }}
|
||||
</span>
|
||||
<br />
|
||||
<span class="body-date-1">AS{{ \LibreNMS\Util\StringHelpers::shortenText($bgp->bgpPeerRemoteAs . ' ' . $bgp->astext, 14) }}</span>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@foreach ($devices_uptime as $device)
|
||||
<div class="front-box device-rebooted">
|
||||
{!! \LibreNMS\Util\Url::deviceLink($device, $device->shortDisplayName()) !!}
|
||||
<span class="device-rebooted">@lang('Device Rebooted')</span>
|
||||
<br />
|
||||
<span class="body-date-1">{{ $device->formatUptime(true) }}</span>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@if(
|
||||
empty($devices_down) &&
|
||||
empty($ports_down) &&
|
||||
empty($services_down) &&
|
||||
empty($bgp_down) &&
|
||||
empty($devices_uptime)
|
||||
)
|
||||
<h5>Nothing here yet</h5>
|
||||
<p class=welcome>
|
||||
This is where status notifications about devices and services would normally go.
|
||||
You might have none because you run such a great network, or perhaps you've just started using {{ Config::get('project_name') }}
|
||||
If you're new to {{ Config::get('project_name') }}, you might
|
||||
want to start by adding one or more devices in the Devices menu.
|
||||
</p>
|
||||
@endif
|
||||
|
||||
|
||||
@if (count($syslog))
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>@lang('Syslog entries')</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">
|
||||
@foreach ($syslog as $entry)
|
||||
<tr>
|
||||
<td>{{ $entry->date }}</td>
|
||||
<td><strong>{!! \LibreNMS\Util\Url::deviceLink($entry->device) !!}</strong></td>
|
||||
<td><strong>{{ $entry->program }} : </strong> {{ $entry->msg }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@@ -32,6 +32,8 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
|
||||
Route::resource('users', 'UserController');
|
||||
Route::get('about', 'AboutController@index');
|
||||
Route::get('authlog', 'UserController@authlog');
|
||||
Route::get('overview', 'OverviewController@index');
|
||||
Route::get('/', 'OverviewController@index');
|
||||
|
||||
// Maps
|
||||
Route::group(['prefix' => 'maps', 'namespace' => 'Maps'], function () {
|
||||
|
||||
Reference in New Issue
Block a user