mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Rewrite Poller Management to Blade/Eloquent (#11277)
* Rewrite Poller Management to Blade/Eloquent * remove further no more needed file * Code Climate * Code Climate * hardcode tabs * change URL style * change prefix from poller-groups to poller * . * parameter fix * Refactor to use more direct routing. remove switch statement. Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -41,21 +41,21 @@ class Html
|
|||||||
public static function graphRow($graph_array, $print = false)
|
public static function graphRow($graph_array, $print = false)
|
||||||
{
|
{
|
||||||
if (session('widescreen')) {
|
if (session('widescreen')) {
|
||||||
if (!$graph_array['height']) {
|
if (!array_key_exists('height', $graph_array)) {
|
||||||
$graph_array['height'] = '110';
|
$graph_array['height'] = '110';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$graph_array['width']) {
|
if (!array_key_exists('width', $graph_array)) {
|
||||||
$graph_array['width'] = '215';
|
$graph_array['width'] = '215';
|
||||||
}
|
}
|
||||||
|
|
||||||
$periods = Config::get('graphs.mini.widescreen');
|
$periods = Config::get('graphs.mini.widescreen');
|
||||||
} else {
|
} else {
|
||||||
if (!$graph_array['height']) {
|
if (!array_key_exists('height', $graph_array)) {
|
||||||
$graph_array['height'] = '100';
|
$graph_array['height'] = '100';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$graph_array['width']) {
|
if (!array_key_exists('width', $graph_array)) {
|
||||||
$graph_array['width'] = '215';
|
$graph_array['width'] = '215';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,160 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Poller.php
|
|
||||||
*
|
|
||||||
* Check that the poller and discovery are running properly.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
* @package LibreNMS
|
|
||||||
* @link http://librenms.org
|
|
||||||
* @copyright 2017 Tony Murray
|
|
||||||
* @author Tony Murray <murraytony@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace LibreNMS\Validations;
|
|
||||||
|
|
||||||
use LibreNMS\Config;
|
|
||||||
use LibreNMS\ValidationResult;
|
|
||||||
use LibreNMS\Validator;
|
|
||||||
|
|
||||||
class Poller extends BaseValidation
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Validate this module.
|
|
||||||
* To return ValidationResults, call ok, warn, fail, or result methods on the $validator
|
|
||||||
*
|
|
||||||
* @param Validator $validator
|
|
||||||
*/
|
|
||||||
public function validate(Validator $validator)
|
|
||||||
{
|
|
||||||
if (!dbIsConnected()) {
|
|
||||||
$validator->warn("Could not check poller/discovery, db is not connected.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dbFetchCell('SELECT COUNT(*) FROM `devices`') == 0) {
|
|
||||||
$result = ValidationResult::warn("You have not added any devices yet.");
|
|
||||||
|
|
||||||
if (isCli()) {
|
|
||||||
$result->setFix("You can add a device in the webui or with ./addhost.php");
|
|
||||||
} else {
|
|
||||||
$base_url = $validator->getBaseURL();
|
|
||||||
$result->setFix("You can add a device by visiting $base_url/addhost");
|
|
||||||
}
|
|
||||||
|
|
||||||
$validator->result($result);
|
|
||||||
return; // can't check poller/discovery if there are no devices.
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->checkDuplicatePollerEntries($validator);
|
|
||||||
$this->checkLastPolled($validator);
|
|
||||||
$this->checkDeviceLastPolled($validator);
|
|
||||||
$this->checkDevicePollDuration($validator);
|
|
||||||
$this->checkLastDiscovered($validator);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function checkDuplicatePollerEntries(Validator $validator)
|
|
||||||
{
|
|
||||||
$sql = "SELECT TRIM(TRAILING '\n' FROM `poller_name`) as `name`, COUNT(*) as `count` FROM `pollers` GROUP BY `name`;";
|
|
||||||
foreach (dbFetchRows($sql) as $poller) {
|
|
||||||
if ($poller['count'] > 1) {
|
|
||||||
$validator->warn(
|
|
||||||
'Duplicate poller entries',
|
|
||||||
"Remove duplicates manually or with: DELETE FROM `pollers` WHERE `poller_name` LIKE '%\\n'"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function checkLastPolled(Validator $validator)
|
|
||||||
{
|
|
||||||
$period = (int)Config::get('rrd.step', 300);
|
|
||||||
// pollers table is only updated by poller-wrapper.py
|
|
||||||
if (dbFetchCell('SELECT COUNT(*) FROM `pollers`')) {
|
|
||||||
$dedupe_sql = "SELECT TRIM(TRAILING '\\n' FROM `poller_name`) AS `name`, MAX(`last_polled`) AS `polled` FROM `pollers` GROUP BY `name`";
|
|
||||||
$sql = "SELECT `name` FROM ($dedupe_sql) AS pt WHERE `polled` <= DATE_ADD(NOW(), INTERVAL - $period SECOND)";
|
|
||||||
|
|
||||||
$pollers = dbFetchColumn($sql);
|
|
||||||
if (count($pollers) > 0) {
|
|
||||||
foreach ($pollers as $poller) {
|
|
||||||
$validator->fail("The poller ($poller) has not completed within the last $period seconds, check the cron job.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif (dbFetchCell('SELECT COUNT(*) FROM `poller_cluster`')) {
|
|
||||||
$sql = "SELECT `node_id` FROM `poller_cluster` WHERE `last_report` <= DATE_ADD(NOW(), INTERVAL - $period SECOND)";
|
|
||||||
|
|
||||||
$pollers = dbFetchColumn($sql);
|
|
||||||
if (count($pollers) > 0) {
|
|
||||||
foreach ($pollers as $poller) {
|
|
||||||
$validator->fail("The poller cluster member ($poller) has not checked in within the last $period seconds, check that it is running and healthy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$validator->fail('The poller has never run or you are not using poller-wrapper.py, check the cron job.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function checkDeviceLastPolled(Validator $validator)
|
|
||||||
{
|
|
||||||
$overdue = (int)(Config::get('rrd.step', 300) * 1.2);
|
|
||||||
if (count($devices = dbFetchColumn("SELECT `hostname` FROM `devices` WHERE (`last_polled` < DATE_ADD(NOW(), INTERVAL - $overdue SECOND) OR `last_polled` IS NULL) AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1")) > 0) {
|
|
||||||
$result = ValidationResult::warn("Some devices have not been polled in the last 5 minutes. You may have performance issues.")
|
|
||||||
->setList('Devices', $devices);
|
|
||||||
|
|
||||||
if (isCli()) {
|
|
||||||
$result->setFix('Check your poll log and see: http://docs.librenms.org/Support/Performance/');
|
|
||||||
} else {
|
|
||||||
$base_url = $validator->getBaseURL();
|
|
||||||
$result->setFix("Check $base_url/pollers/tab=log and see: http://docs.librenms.org/Support/Performance/");
|
|
||||||
}
|
|
||||||
|
|
||||||
$validator->result($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private function checkDevicePollDuration(Validator $validator)
|
|
||||||
{
|
|
||||||
$period = (int)Config::get('rrd.step', 300);
|
|
||||||
if (count($devices = dbFetchColumn("SELECT `hostname` FROM `devices` WHERE last_polled_timetaken > $period AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1")) > 0) {
|
|
||||||
$result = ValidationResult::fail("Some devices have not completed their polling run in 5 minutes, this will create gaps in data.")
|
|
||||||
->setList('Devices', $devices);
|
|
||||||
|
|
||||||
if (isCli()) {
|
|
||||||
$result->setFix('Check your poll log and see: http://docs.librenms.org/Support/Performance/');
|
|
||||||
} else {
|
|
||||||
$base_url = $validator->getBaseURL();
|
|
||||||
$result->setFix("Check $base_url/pollers/tab=log/ and see: http://docs.librenms.org/Support/Performance/");
|
|
||||||
}
|
|
||||||
|
|
||||||
$validator->result($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function checkLastDiscovered(Validator $validator)
|
|
||||||
{
|
|
||||||
$incomplete_sql = "SELECT 1 FROM `devices` WHERE `last_discovered` <= DATE_ADD(NOW(), INTERVAL - 24 HOUR)
|
|
||||||
AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1 AND `snmp_disable` = 0";
|
|
||||||
|
|
||||||
if (!dbFetchCell('SELECT 1 FROM `devices` WHERE `last_discovered` IS NOT NULL')) {
|
|
||||||
$validator->fail('Discovery has never run. Check the cron job');
|
|
||||||
} elseif (dbFetchCell($incomplete_sql)) {
|
|
||||||
$validator->fail(
|
|
||||||
"Discovery has not completed in the last 24 hours.",
|
|
||||||
"Check the cron job to make sure it is running and using discovery-wrapper.py"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -98,7 +98,7 @@ class Checks
|
|||||||
$warn_sec = Config::get('rrd.step', 300) * 3;
|
$warn_sec = Config::get('rrd.step', 300) * 3;
|
||||||
if (Device::isUp()->where('last_polled', '<=', Carbon::now()->subSeconds($warn_sec))->exists()) {
|
if (Device::isUp()->where('last_polled', '<=', Carbon::now()->subSeconds($warn_sec))->exists()) {
|
||||||
$warn_min = $warn_sec / 60;
|
$warn_min = $warn_sec / 60;
|
||||||
Toastr::warning('<a href="pollers/tab=log/filter=unpolled/">It appears as though you have some devices that haven\'t completed polling within the last ' . $warn_min . ' minutes, you may want to check that out :)</a>', 'Devices unpolled');
|
Toastr::warning('<a href="poller/log?filter=unpolled/">It appears as though you have some devices that haven\'t completed polling within the last ' . $warn_min . ' minutes, you may want to check that out :)</a>', 'Devices unpolled');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Directory access checks
|
// Directory access checks
|
||||||
|
129
app/Http/Controllers/PollerController.php
Normal file
129
app/Http/Controllers/PollerController.php
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Device;
|
||||||
|
use App\Models\Poller;
|
||||||
|
use App\Models\PollerCluster;
|
||||||
|
use App\Models\PollerGroups;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PollerController extends Controller
|
||||||
|
{
|
||||||
|
public $rrdstep;
|
||||||
|
public $defaultPollerId;
|
||||||
|
|
||||||
|
public $defaultGroup = [
|
||||||
|
'id' => 0,
|
||||||
|
'group_name' => 'General',
|
||||||
|
'descr' => ''
|
||||||
|
];
|
||||||
|
public $defaultPollerMarker = '(default Poller)';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->authorizeResource(PollerGroups::class, 'poller_groups'); // FIXME is this correct? not a resource anymore
|
||||||
|
$this->rrdstep = \LibreNMS\Config::get('rrd.step');
|
||||||
|
$this->defaultPollerId = \LibreNMS\Config::get('distributed_poller_group');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logTab(Request $request)
|
||||||
|
{
|
||||||
|
return view('poller.log', [
|
||||||
|
'current_tab' => 'log',
|
||||||
|
'filter' => $request->input('filter', 'active')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// output for poller groups
|
||||||
|
public function groupsTab()
|
||||||
|
{
|
||||||
|
$group_list = PollerGroups::get();
|
||||||
|
|
||||||
|
# default poller_group
|
||||||
|
$defaultGroup = $this->defaultGroup;
|
||||||
|
$defaultGroup['devices'] = Device::where('poller_group', $defaultGroup['id'])->get();
|
||||||
|
$defaultGroup['is_default_poller'] = ($defaultGroup['id'] == $this->defaultPollerId) ? true : false;
|
||||||
|
|
||||||
|
# poller_groups
|
||||||
|
$poller_group_list = [];
|
||||||
|
foreach ($group_list as $group) {
|
||||||
|
$group['is_default_poller'] = ($group['id'] == $this->defaultPollerId) ? true : false;
|
||||||
|
|
||||||
|
$poller_group_list[] = $group;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('poller.groups', [
|
||||||
|
'current_tab' => 'groups',
|
||||||
|
'default_poller_marker' => $this->defaultPollerMarker,
|
||||||
|
'poller_groups' => $poller_group_list,
|
||||||
|
'default_poller_group' => $defaultGroup,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// data output for poller view
|
||||||
|
public function pollerTab()
|
||||||
|
{
|
||||||
|
return view('poller.poller', [
|
||||||
|
'current_tab' => 'poller',
|
||||||
|
'pollers' => $this->poller(),
|
||||||
|
'poller_cluster' => $this->pollerCluster(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function performanceTab()
|
||||||
|
{
|
||||||
|
return view('poller.performance', ['current_tab' => 'performance']);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function pollerStatus($poller)
|
||||||
|
{
|
||||||
|
$old = $poller['now'] - strtotime($poller['last_polled']);
|
||||||
|
|
||||||
|
if ($old >= $this->rrdstep) {
|
||||||
|
$poller['row_class'] = 'danger';
|
||||||
|
} elseif ($old >= ($this->rrdstep * 0.95)) {
|
||||||
|
$poller['row_class'] = 'warning';
|
||||||
|
} else {
|
||||||
|
$poller['row_class'] = 'success';
|
||||||
|
}
|
||||||
|
|
||||||
|
$poller['long_not_polled'] = (\Auth::user()->hasGlobalAdmin() && ($old > ($this->rrdstep * 2))) ? true : false;
|
||||||
|
|
||||||
|
return $poller;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function poller()
|
||||||
|
{
|
||||||
|
$rows = Poller::orderBy('poller_name')->get();
|
||||||
|
|
||||||
|
$time = time();
|
||||||
|
|
||||||
|
$groups = [];
|
||||||
|
|
||||||
|
foreach ($rows as $poller) {
|
||||||
|
$poller['now'] = $time;
|
||||||
|
|
||||||
|
$poller = $this->pollerStatus($poller);
|
||||||
|
|
||||||
|
$groups[] = $poller;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function pollerCluster()
|
||||||
|
{
|
||||||
|
$rows = PollerCluster::orderBy('poller_name')->get();
|
||||||
|
|
||||||
|
$cluster = [];
|
||||||
|
|
||||||
|
foreach ($rows as $poller) {
|
||||||
|
$poller = $this->pollerStatus($poller);
|
||||||
|
|
||||||
|
$cluster[] = $poller;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cluster;
|
||||||
|
}
|
||||||
|
}
|
35
app/Models/Poller.php
Normal file
35
app/Models/Poller.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Thomas Berberich
|
||||||
|
* @author Thomas Berberich <sourcehhdoctor@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Poller extends Model
|
||||||
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $fillable = ['poller_name'];
|
||||||
|
}
|
41
app/Models/PollerCluster.php
Normal file
41
app/Models/PollerCluster.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Thomas Berberich
|
||||||
|
* @author Thomas Berberich <sourcehhdoctor@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PollerCluster extends Model
|
||||||
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
protected $table = 'poller_cluster';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $fillable = ['poller_name'];
|
||||||
|
|
||||||
|
public function stats()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\PollerClusterStats', 'parent_poller', 'id');
|
||||||
|
}
|
||||||
|
}
|
35
app/Models/PollerClusterStats.php
Normal file
35
app/Models/PollerClusterStats.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Thomas Berberich
|
||||||
|
* @author Thomas Berberich <sourcehhdoctor@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PollerClusterStats extends Model
|
||||||
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
# protected $fillable = ['poller_name'];
|
||||||
|
}
|
40
app/Models/PollerGroups.php
Normal file
40
app/Models/PollerGroups.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2020 Thomas Berberich
|
||||||
|
* @author Thomas Berberich <sourcehhdoctor@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PollerGroups extends Model
|
||||||
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $fillable = ['group_name', 'descr'];
|
||||||
|
|
||||||
|
public function devices()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Device', 'poller_group', 'id');
|
||||||
|
}
|
||||||
|
}
|
@@ -10,7 +10,7 @@ We now have support for polling data at intervals to fit your needs.
|
|||||||
- You must also change your cron entry for `poller-wrapper.py` for
|
- You must also change your cron entry for `poller-wrapper.py` for
|
||||||
this to work (if you change from the default 300 seconds).
|
this to work (if you change from the default 300 seconds).
|
||||||
- Your polling _MUST_ complete in the time you configure for the
|
- Your polling _MUST_ complete in the time you configure for the
|
||||||
heartbeat step value. See `/pollers/tab=pollers/` in your WebUI for
|
heartbeat step value. See `/poller` in your WebUI for
|
||||||
your current value.
|
your current value.
|
||||||
- This will only affect RRD files created from the moment you change
|
- This will only affect RRD files created from the moment you change
|
||||||
your settings.
|
your settings.
|
||||||
|
@@ -1,55 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$no_refresh = true;
|
|
||||||
|
|
||||||
|
|
||||||
echo '<ul class="nav nav-tabs">';
|
|
||||||
|
|
||||||
$poll_tabs = [
|
|
||||||
[
|
|
||||||
'name' => 'Pollers',
|
|
||||||
'icon' => 'fa-th-large',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
if (\LibreNMS\Config::get('distributed_poller')) {
|
|
||||||
$poll_tabs[] = array(
|
|
||||||
'name' => 'Groups',
|
|
||||||
'icon' => 'fa-th',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$poll_tabs[] = [
|
|
||||||
'name' => 'Performance',
|
|
||||||
'icon' => 'fa-line-chart',
|
|
||||||
];
|
|
||||||
$poll_tabs[] = [
|
|
||||||
'name' => 'Log',
|
|
||||||
'icon' => 'fa-file-text',
|
|
||||||
];
|
|
||||||
|
|
||||||
$current_tab = basename($vars['tab'] ?? 'pollers');
|
|
||||||
|
|
||||||
foreach ($poll_tabs as $tab) {
|
|
||||||
$taburl = strtolower($tab['name']);
|
|
||||||
echo '<li role="presentation" ' . ($current_tab == $taburl ? ' class="active"' : '') . '><a href="';
|
|
||||||
echo generate_url(['page' => 'pollers', 'tab' => $taburl]);
|
|
||||||
echo '"><i class="fa ' . $tab['icon'] . ' fa-lg icon-theme" aria-hidden="true"></i> ' . $tab['name'];
|
|
||||||
echo '</a></li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</ul>';
|
|
||||||
|
|
||||||
include_once "includes/html/pages/pollers/$current_tab.inc.php";
|
|
@@ -1,72 +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;
|
|
||||||
|
|
||||||
$pagetitle[] = 'Poller Groups';
|
|
||||||
|
|
||||||
require_once 'includes/html/modal/poller_groups.inc.php';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<br />
|
|
||||||
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#poller-groups">Create new poller group</button>
|
|
||||||
<br /><br />
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-bordered table-hover table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Group Name</th>
|
|
||||||
<th>Devices</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Action</th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$default_group = ['id' => 0,
|
|
||||||
'group_name' => 'General',
|
|
||||||
'descr' => ''];
|
|
||||||
|
|
||||||
$group_list = dbFetchRows('SELECT * FROM `poller_groups`');
|
|
||||||
|
|
||||||
$default_poller = Config::get('distributed_poller_group');
|
|
||||||
|
|
||||||
array_unshift($group_list, $default_group);
|
|
||||||
|
|
||||||
foreach ($group_list as $group) {
|
|
||||||
$group_device_count = dbFetchCell('SELECT COUNT(*) FROM devices WHERE `poller_group`=?', $group['id']);
|
|
||||||
|
|
||||||
$group_name = $group['group_name'];
|
|
||||||
if ($group['id'] == $default_poller) {
|
|
||||||
$group_name .= ' (default Poller)';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr id="'.$group['id'].'">
|
|
||||||
<td>'.$group['id'].'</td>
|
|
||||||
<td>'.$group_name.'</td>
|
|
||||||
<td><a href="/devices/poller_group='.$group['id'].'")">'.$group_device_count.'</a></td>
|
|
||||||
<td>'.$group['descr'].'</td>';
|
|
||||||
echo '<td>';
|
|
||||||
if ($group['id']) {
|
|
||||||
echo '<button type="button" class="btn btn-success btn-xs" id="'.$group['id'].'" data-group_id="'.$group['id'].'" data-toggle="modal" data-target="#poller-groups">Edit</button> <button type="button" class="btn btn-danger btn-xs" id="'.$group['id'].'" data-group_id="'.$group['id'].'" data-toggle="modal" data-target="#confirm-delete">Delete</button>';
|
|
||||||
}
|
|
||||||
echo '</td>
|
|
||||||
</tr>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
|
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* log.inc.php
|
|
||||||
*
|
|
||||||
* -Description-
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
* @package LibreNMS
|
|
||||||
* @link http://librenms.org
|
|
||||||
* @copyright 2018 Tony Murray
|
|
||||||
* @author Tony Murray <murraytony@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
$no_refresh = true;
|
|
||||||
$pagetitle[] = 'Poll Log';
|
|
||||||
if (isset($vars['filter'])) {
|
|
||||||
$type = $vars['filter'];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<table id="poll-log" class="table table-condensed table-hover table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-column-id="hostname">Hostname</th>
|
|
||||||
<th data-column-id="last_polled">Last Polled</th>
|
|
||||||
<th data-column-id="poller_group">Poller Group</th>
|
|
||||||
<th data-column-id="last_polled_timetaken" data-order="desc">Polling Duration (Seconds)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
searchbar = "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
|
|
||||||
"<div class=\"col-sm-8 actionBar\"><span class=\"pull-left\">"+
|
|
||||||
"<a href='<?php echo generate_url(['page' => 'pollers', 'tab' => 'log']); ?>' class='btn btn-primary btn-sm <?php echo $vars['filter'] == 'unpolled' ? '' : 'active' ?>'>All devices</a> "+
|
|
||||||
"<a href='<?php echo generate_url(['page' => 'pollers', 'tab' => 'log', 'filter' => 'unpolled']); ?>' class='btn btn-danger btn-sm <?php echo $vars['filter'] == 'unpolled' ? 'active' : '' ?>'>Unpolled devices</a>"+
|
|
||||||
"</div><div class=\"col-sm-4 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div>";
|
|
||||||
|
|
||||||
var grid = $("#poll-log").bootgrid({
|
|
||||||
ajax: true,
|
|
||||||
rowCount: [50, 100, 250, -1],
|
|
||||||
columnSelection: false,
|
|
||||||
templates: {
|
|
||||||
header: searchbar
|
|
||||||
},
|
|
||||||
post: function ()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
id: "poll-log",
|
|
||||||
type: "<?php echo $type;?>"
|
|
||||||
};
|
|
||||||
},
|
|
||||||
url: "ajax_table.php"
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$pagetitle[] = 'Poll Performance';
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
<br />
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Total Poller Time</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<?php
|
|
||||||
$graph_array = [
|
|
||||||
'type' => 'global_poller_perf',
|
|
||||||
'legend' => 'yes',
|
|
||||||
'height' => 100,
|
|
||||||
];
|
|
||||||
require 'includes/html/print-graphrow.inc.php';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Total Poller Time Per Module</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<?php
|
|
||||||
$graph_array = [
|
|
||||||
'type' => 'global_poller_modules_perf',
|
|
||||||
'legend' => 'yes',
|
|
||||||
'height' => 100,
|
|
||||||
];
|
|
||||||
require 'includes/html/print-graphrow.inc.php';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,175 +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;
|
|
||||||
|
|
||||||
$pagetitle[] = 'Pollers';
|
|
||||||
|
|
||||||
require_once 'includes/html/modal/delete_poller.inc.php';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$query = 'SELECT *,UNIX_TIMESTAMP(NOW()) AS `now`, UNIX_TIMESTAMP(`last_polled`) AS `then` FROM `pollers` ORDER BY poller_name';
|
|
||||||
$rows = dbFetchRows($query);
|
|
||||||
|
|
||||||
if (count($rows) !== 0) {
|
|
||||||
echo '
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Standard Pollers</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-bordered table-hover table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>Poller Name</th>
|
|
||||||
<th>Devices Polled</th>
|
|
||||||
<th>Total Poll Time</th>
|
|
||||||
<th>Last Ran</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
foreach ($rows as $poller) {
|
|
||||||
$old = ($poller['now'] - $poller['then']);
|
|
||||||
$step = Config::get('rrd.step', 300);
|
|
||||||
|
|
||||||
if ($old >= $step) {
|
|
||||||
$row_class = 'danger';
|
|
||||||
} elseif ($old >= ($step * 0.95)) {
|
|
||||||
$row_class = 'warning';
|
|
||||||
} else {
|
|
||||||
$row_class = 'success';
|
|
||||||
}
|
|
||||||
|
|
||||||
$actions = "";
|
|
||||||
if (\Auth::user()->hasGlobalAdmin() && $old > ($step * 2)) {
|
|
||||||
// missed 2 polls show delete button
|
|
||||||
$actions .= "<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-id='{$poller['id']}' data-pollertype='delete-poller' name='delete-poller'><i class='fa fa-trash' aria-hidden='true'></i></button>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr class="'.$row_class.'" id="row_' . $poller['id'] . '">
|
|
||||||
<td>'.$poller['poller_name'].'</td>
|
|
||||||
<td>'.$poller['devices'].'</td>
|
|
||||||
<td>'.$poller['time_taken'].' Seconds</td>
|
|
||||||
<td>'.$poller['last_polled'].'</td>
|
|
||||||
<td>'.$actions.'</td>
|
|
||||||
</tr>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = 'SELECT *,UNIX_TIMESTAMP(NOW()) AS `now`, UNIX_TIMESTAMP(`last_report`) AS `then` FROM `poller_cluster` ORDER BY poller_name';
|
|
||||||
$rows = dbFetchRows($query);
|
|
||||||
|
|
||||||
if (count($rows) !== 0) {
|
|
||||||
echo '
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Poller Cluster Health</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-bordered table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Node ID</th>
|
|
||||||
<th>Version</th>
|
|
||||||
<th>Groups Served</th>
|
|
||||||
<th>Last Checkin</th>
|
|
||||||
<th>Cluster Master</th>
|
|
||||||
<th>Job</th>
|
|
||||||
<th>Workers</th>
|
|
||||||
<th>Devices Actioned<br><small>Last Interval</small></th>
|
|
||||||
<th>Devices Pending</th>
|
|
||||||
<th>Worker Seconds<br><small>Consumed/Maximum</small></th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
foreach ($rows as $poller) {
|
|
||||||
$old = ($poller['now'] - $poller['then']);
|
|
||||||
$step = Config::get('rrd.step', 300);
|
|
||||||
|
|
||||||
if ($old >= $step) {
|
|
||||||
$row_class = 'danger';
|
|
||||||
} elseif ($old >= ($step * 0.95)) {
|
|
||||||
$row_class = 'warning';
|
|
||||||
} else {
|
|
||||||
$row_class = 'success';
|
|
||||||
}
|
|
||||||
|
|
||||||
$actions = "";
|
|
||||||
if (\Auth::user()->hasGlobalAdmin() && $old > ($step * 2)) {
|
|
||||||
// missed 2 polls show delete button
|
|
||||||
$actions .= "<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-id='{$poller['id']}' data-pollertype='delete-cluster-poller' name='delete-cluster-poller'><i class='fa fa-trash' aria-hidden='true'></i></button>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$stat_query = 'SELECT * FROM `poller_cluster_stats` WHERE `parent_poller`=' . $poller['id'] . ';';
|
|
||||||
$stat_row = dbFetchRows($stat_query);
|
|
||||||
$stat_count = count($stat_row);
|
|
||||||
|
|
||||||
$first_row = true;
|
|
||||||
|
|
||||||
foreach ($stat_row as $stats) {
|
|
||||||
// Emit the row container
|
|
||||||
echo '<tr class="'.$row_class.'" id="row_' . $poller['id'] . '">';
|
|
||||||
|
|
||||||
if ($first_row) {
|
|
||||||
// On the first iteration, print some rowspanned columns
|
|
||||||
echo '
|
|
||||||
<td rowspan="'.$stat_count.'">'.$poller['poller_name'].'</td>
|
|
||||||
<td rowspan="'.$stat_count.'"' . (empty($poller['node_id']) ? ' class="danger"' : '') . '>'.$poller['node_id'].'</td>
|
|
||||||
<td rowspan="'.$stat_count.'">'.$poller['poller_version'].'</td>
|
|
||||||
<td rowspan="'.$stat_count.'">'.$poller['poller_groups'].'</td>
|
|
||||||
<td rowspan="'.$stat_count.'">'.$poller['last_report'].'</td>
|
|
||||||
<td rowspan="'.$stat_count.'">'. ($poller['master'] ? "Yes" : "No") .'</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emit the job stats
|
|
||||||
echo '
|
|
||||||
<td>'.$stats['poller_type'].'</td>
|
|
||||||
<td>'.$stats['workers'].'</td>
|
|
||||||
<td>'.$stats['devices'].'</td>
|
|
||||||
<td>'.$stats['depth'].'</td>
|
|
||||||
<td>'.$stats['worker_seconds'].' / '.$stats['frequency']*$stats['workers'].'</td>';
|
|
||||||
|
|
||||||
if ($first_row) {
|
|
||||||
// On the first iteration, print some rowspanned columns
|
|
||||||
echo '<td rowspan="'.$stat_count.'">'.$actions.'</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// End the row
|
|
||||||
echo '</tr>';
|
|
||||||
$first_row = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</table>
|
|
||||||
<small>
|
|
||||||
Worker seconds indicates the maximum polling throughput a node can achieve in perfect conditions. If the consumed is close to the maximum, consider adding more threads, or better tuning your groups.<br>
|
|
||||||
If there are devices pending but consumed worker seconds is low, your hardware is not sufficient for the number of devices and the poller cannot reach maximum throughput.
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
?>
|
|
@@ -526,14 +526,14 @@
|
|||||||
aria-hidden="true"></i> @lang('Auth History')</a></li>
|
aria-hidden="true"></i> @lang('Auth History')</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li class="dropdown-submenu">
|
<li class="dropdown-submenu">
|
||||||
<a href="{{ url('pollers') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Pollers')</a>
|
<a href="{{ url('poller') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Poller')</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="{{ url('pollers/tab=pollers') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Pollers')</a></li>
|
<li><a href="{{ url('poller') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Poller')</a></li>
|
||||||
@config('distributed_poller')
|
@config('distributed_poller')
|
||||||
<li><a href="{{ url('pollers/tab=groups') }}"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> @lang('Groups')</a></li>
|
<li><a href="{{ url('poller/groups') }}"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> @lang('Groups')</a></li>
|
||||||
@endconfig
|
@endconfig
|
||||||
<li><a href="{{ url('pollers/tab=performance') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Performance')</a></li>
|
<li><a href="{{ url('poller/performance') }}"><i class="fa fa-line-chart fa-fw fa-lg" aria-hidden="true"></i> @lang('Performance')</a></li>
|
||||||
<li><a href="{{ url('pollers/tab=log') }}"><i class="fa fa-file-text fa-fw fa-lg" aria-hidden="true"></i> @lang('History')</a></li>
|
<li><a href="{{ url('poller/log') }}"><i class="fa fa-file-text fa-fw fa-lg" aria-hidden="true"></i> @lang('Log')</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
|
@@ -1,36 +1,63 @@
|
|||||||
<?php
|
@extends('poller.index')
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!Auth::user()->hasGlobalAdmin()) {
|
@section('title', __('Poller Groups'))
|
||||||
echo ('ERROR: You need to be admin');
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
@parent
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#poller-groups">@lang('Create new poller group')</button>
|
||||||
|
<br /><br />
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>@lang('ID')</th>
|
||||||
|
<th>@lang('Group Name')</th>
|
||||||
|
<th>@lang('Devices')</th>
|
||||||
|
<th>@lang('Description')</th>
|
||||||
|
<th>@lang('Action')</th>
|
||||||
|
</tr>
|
||||||
|
<tr id="{{ $default_poller_group['id'] }}">
|
||||||
|
<td>{{ $default_poller_group['id'] }}</td>
|
||||||
|
<td>{{ $default_poller_group['group_name'] }}@if($default_poller_group['is_default_poller']) {{ $default_poller_marker }}@endif</td>
|
||||||
|
<td><a href="/devices/poller_group={{ $default_poller_group['id'] }}">{{ $default_poller_group['devices']->count() }}</a></td>
|
||||||
|
<td>{{ $default_poller_group['descr'] }}</td>
|
||||||
|
<td>
|
||||||
|
</tr>
|
||||||
|
@foreach ($poller_groups as $group)
|
||||||
|
<tr id="{{ $group['id'] }}">
|
||||||
|
<td>{{ $group['id'] }}</td>
|
||||||
|
<td>{{ $group['group_name'] }}@if($group['is_default_poller']) {{ $default_poller_marker }}@endif</td>
|
||||||
|
<td><a href="/devices/poller_group={{ $group['id'] }}">{{ $group['devices']->count() }}</a></td>
|
||||||
|
<td>{{ $group['descr'] }}</td>
|
||||||
|
<td>
|
||||||
|
@if($group['id'])
|
||||||
|
<button type="button" class="btn btn-success btn-xs" id="{{$group['id']}}" data-group_id="{{$group['id']}}" data-toggle="modal" data-target="#poller-groups">@lang('Edit')</button>
|
||||||
|
<button type="button" class="btn btn-danger btn-xs" id="{{$group['id']}}" data-group_id="{{$group['id']}}" data-toggle="modal" data-target="#confirm-delete">@lang('Delete')</button>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(auth()->user()->isAdmin())
|
||||||
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="Delete" aria-hidden="true">
|
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="Delete" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-sm">
|
<div class="modal-dialog modal-sm">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h5 class="modal-title" id="Delete">Confirm Delete</h5>
|
<h5 class="modal-title" id="Delete">@lang('Confirm Delete')</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>If you would like to remove the Poller Group then please click Delete.</p>
|
<p>@lang('If you would like to remove the Poller Group then please click Delete.')</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<form role="form" class="remove_group_form">
|
<form role="form" class="remove_group_form">
|
||||||
<?php echo csrf_field() ?>
|
@csrf
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">@lang('Cancel')</button>
|
||||||
<button type="submit" class="btn btn-danger danger" id="group-removal" data-target="group-removal">Delete</button>
|
<button type="submit" class="btn btn-danger danger" id="group-removal" data-target="group-removal">@lang('Delete')</button>
|
||||||
<input type="hidden" name="group_id" id="group_id" value="">
|
<input type="hidden" name="group_id" id="group_id" value="">
|
||||||
<input type="hidden" name="type" id="type" value="poller-group-remove">
|
<input type="hidden" name="type" id="type" value="poller-group-remove">
|
||||||
<input type="hidden" name="confirm" id="confirm" value="yes">
|
<input type="hidden" name="confirm" id="confirm" value="yes">
|
||||||
@@ -44,11 +71,11 @@ if (!Auth::user()->hasGlobalAdmin()) {
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title" id="Create">Poller Groups</h4>
|
<h4 class="modal-title" id="Create">@lang('Poller Groups')</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form method="post" role="form" id="poller_groups" class="form-horizontal poller-groups-form">
|
<form method="post" role="form" id="poller_groups" class="form-horizontal poller-groups-form">
|
||||||
<?php echo csrf_field() ?>
|
@csrf
|
||||||
<input type="hidden" name="group_id" id="group_id" value="">
|
<input type="hidden" name="group_id" id="group_id" value="">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -58,20 +85,20 @@ if (!Auth::user()->hasGlobalAdmin()) {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="group_name" class="col-sm-3 control-label">Group Name:</label>
|
<label for="group_name" class="col-sm-3 control-label">@lang('Group Name'):</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="input" class="form-control" id="group_name" name="group_name" placeholder="Group Name">
|
<input type="input" class="form-control" id="group_name" name="group_name" placeholder="Group Name">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="descr" class="col-sm-3 control-label">Description:</label>
|
<label for="descr" class="col-sm-3 control-label">@lang('Description'):</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="input" class="form-control" id="descr" name="descr" placeholder="Description">
|
<input type="input" class="form-control" id="descr" name="descr" placeholder="Description">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-3 col-sm-9">
|
<div class="col-sm-offset-3 col-sm-9">
|
||||||
<button type="submit" class="btn btn-primary btn-sm" id="create-group" name="create-group">Add Poller Group</button>
|
<button type="submit" class="btn btn-primary btn-sm" id="create-group" name="create-group">@lang('Add Poller Group')</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,8 +108,12 @@ if (!Auth::user()->hasGlobalAdmin()) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script>
|
@endif
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
@if(auth()->user()->isAdmin())
|
||||||
|
<script>
|
||||||
$('#confirm-delete').on('show.bs.modal', function(e) {
|
$('#confirm-delete').on('show.bs.modal', function(e) {
|
||||||
group_id = $(e.relatedTarget).data('group_id');
|
group_id = $(e.relatedTarget).data('group_id');
|
||||||
$("#group_id").val(group_id);
|
$("#group_id").val(group_id);
|
||||||
@@ -152,8 +183,6 @@ $('#create-group').click('', function(e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@endif
|
||||||
</script>
|
</script>
|
||||||
|
@endsection
|
||||||
<?php
|
|
||||||
}
|
|
26
resources/views/poller/index.blade.php
Normal file
26
resources/views/poller/index.blade.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@extends('layouts.librenmsv1')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li role="presentation" @if( $current_tab == 'poller' ) ' class="active"' @endif>
|
||||||
|
<a href="/poller"><i class="fa fa-th-large fa-lg icon-theme" aria-hidden="true"></i>@lang('Poller')</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation" @if( $current_tab == 'groups' ) ' class="active"' @endif>
|
||||||
|
<a href="/poller/groups"><i class="fa fa-th fa-lg icon-theme" aria-hidden="true"></i>@lang('Groups')</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation" @if( $current_tab == 'performance' ) ' class="active"' @endif>
|
||||||
|
<a href="/poller/performance"><i class="fa fa-line-chart fa-lg icon-theme" aria-hidden="true"></i>@lang('Performance')</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation" @if( $current_tab == 'log' ) ' class="active"' @endif>
|
||||||
|
<a href="/poller/log"><i class="fa fa-file-text fa-lg icon-theme" aria-hidden="true"></i>@lang('Log')</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
@endsection
|
||||||
|
@section('content_footer')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
47
resources/views/poller/log.blade.php
Normal file
47
resources/views/poller/log.blade.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
@extends('poller.index')
|
||||||
|
|
||||||
|
@section('title', __('Poller Log'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
@parent
|
||||||
|
|
||||||
|
<table id="poll-log" class="table table-condensed table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-column-id="hostname">@lang('Hostname')</th>
|
||||||
|
<th data-column-id="last_polled">@lang('Last Polled')</th>
|
||||||
|
<th data-column-id="poller_group">@lang('Poller Group')</th>
|
||||||
|
<th data-column-id="last_polled_timetaken" data-order="desc">@lang('Polling Duration (Seconds)')</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
<script>
|
||||||
|
searchbar = "<div id=\"\{\{ctx.id\}\}\" class=\"\{\{css.header\}\}\"><div class=\"row\">"+
|
||||||
|
"<div class=\"col-sm-8 actionBar\"><span class=\"pull-left\">"+
|
||||||
|
"<a href='poller/log' class='btn btn-primary btn-sm @if($filter == 'unpolled') 'active' @endif'>All devices</a> "+
|
||||||
|
"<a href='poller/log?filter=unpolled' class='btn btn-danger btn-sm @if($filter == 'unpolled') 'active' @endif'>Unpolled devices</a>"+
|
||||||
|
"</div><div class=\"col-sm-4 actionBar\"><p class=\"\{\{css.search\}\}\"></p><p class=\"\{\{css.actions\}\}\"></p></div>";
|
||||||
|
|
||||||
|
var grid = $("#poll-log").bootgrid({
|
||||||
|
ajax: true,
|
||||||
|
rowCount: [50, 100, 250, -1],
|
||||||
|
columnSelection: false,
|
||||||
|
templates: {
|
||||||
|
header: searchbar
|
||||||
|
},
|
||||||
|
post: function ()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
id: "poll-log",
|
||||||
|
type: "{{ $filter }}"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
url: "ajax_table.php"
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endsection
|
29
resources/views/poller/performance.blade.php
Normal file
29
resources/views/poller/performance.blade.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
@extends('poller.index')
|
||||||
|
|
||||||
|
@section('title', __('Poller Performance'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
@parent
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Total Poller Time</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php \LibreNMS\Util\Html::graphRow(['type' => 'global_poller_perf',
|
||||||
|
'legend' => 'yes', 'height' => 100], true); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Total Poller Time Per Module</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php \LibreNMS\Util\Html::graphRow(['type' => 'global_poller_modules_perf',
|
||||||
|
'legend' => 'yes', 'height' => 100], true); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
159
resources/views/poller/poller.blade.php
Normal file
159
resources/views/poller/poller.blade.php
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
@extends('poller.index')
|
||||||
|
|
||||||
|
@section('title', __('Pollers'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
@parent
|
||||||
|
|
||||||
|
<br />
|
||||||
|
@if( $pollers )
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">@lang('Standard Pollers')</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>@lang('Poller Name')</th>
|
||||||
|
<th>@lang('Devices Polled')</th>
|
||||||
|
<th>@lang('Total Poll Time')</th>
|
||||||
|
<th>@lang('Last Run')</th>
|
||||||
|
<th>@lang('Actions')</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($pollers as $poller)
|
||||||
|
<tr class="{{ $poller['row_class'] }}" id="row_{{ $poller['id'] }}">
|
||||||
|
<td>{{ $poller['poller_name'] }}</td>
|
||||||
|
<td>{{ $poller['devices'] }}</td>
|
||||||
|
<td>{{ $poller['time_taken'] }} Seconds</td>
|
||||||
|
<td>{{ $poller['last_polled'] }}</td>
|
||||||
|
<td>@if( $poller['long_not_polled'] )<button type='button' class='btn btn-danger btn-sm' aria-label=@lang('Delete') data-toggle='modal' data-target='#confirm-delete' data-id='{{ $poller['id'] }}' data-pollertype='delete-poller' name='delete-poller'><i class='fa fa-trash' aria-hidden='true'></i></button>@endif</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if( $poller_cluster )
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">@lang('Poller Cluster Health')</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>@lang('Name')</th>
|
||||||
|
<th>@lang('Node ID')</th>
|
||||||
|
<th>@lang('Version')</th>
|
||||||
|
<th>@lang('Groups Served')</th>
|
||||||
|
<th>@lang('Last Checkin')</th>
|
||||||
|
<th>@lang('Cluster Master')</th>
|
||||||
|
<th>@lang('Job')</th>
|
||||||
|
<th>@lang('Workers')</th>
|
||||||
|
<th>@lang('Devices Actioned')<br><small>@lang('Last Interval')</small></th>
|
||||||
|
<th>@lang('Devices Pending')</th>
|
||||||
|
<th>@lang('Worker Seconds')<br><small>@lang('Consumed/Maximum')</small></th>
|
||||||
|
<th>@lang('Actions')</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($poller_cluster as $poller)
|
||||||
|
@foreach($poller['stats'] as $stats)
|
||||||
|
<tr class="{{ $poller['row_class'] }}" id="row_{{ $poller['id'] }}">
|
||||||
|
@if( $loop->first )
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">{{ $poller['poller_name'] }}</td>
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}"@if($poller['node_id'] == '') ' class="danger"' @endif>{{ $poller['node_id'] }}</td>
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">{{ $poller['poller_version'] }}</td>
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">{{ $poller['poller_groups'] }}</td>
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">{{ $poller['last_report'] }}</td>
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">@if( $poller['master'] ) "@lang('Yes')" @else "@lang('No')" @endif</td>
|
||||||
|
@endif
|
||||||
|
<td>{{ $stats['poller_type'] }}</td>
|
||||||
|
<td>{{ $stats['workers'] }}</td>
|
||||||
|
<td>{{ $stats['devices'] }}</td>
|
||||||
|
<td>{{ $stats['depth'] }}</td>
|
||||||
|
<td>{{ $stats['worker_seconds'] }} / {{ $stats['frequency'] * $stats['workers'] }}</td>
|
||||||
|
@if( $loop->first )
|
||||||
|
<td rowspan="{{ $poller['stats']->count() }}">@if( $poller['long_not_polled'] )<button type='button' class='btn btn-danger btn-sm' aria-label=@lang('Delete') data-toggle='modal' data-target='#confirm-delete' data-id='{{ $poller['id'] }}' data-pollertype='delete-cluster-poller' name='delete-cluster-poller'><i class='fa fa-trash' aria-hidden='true'></i></button>@endif</td>
|
||||||
|
@endif
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
<small>
|
||||||
|
Worker seconds indicates the maximum polling throughput a node can achieve in perfect conditions. If the consumed is close to the maximum, consider adding more threads, or better tuning your groups.<br>
|
||||||
|
If there are devices pending but consumed worker seconds is low, your hardware is not sufficient for the number of devices and the poller cannot reach maximum throughput.
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(auth()->user()->isAdmin())
|
||||||
|
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="@lang('Delete')" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-sm">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h5 class="modal-title" id="Delete">@lang('Confirm Delete')</h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>@lang('Please confirm that you would like to delete this poller.')</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<form role="form" class="remove_token_form">
|
||||||
|
@csrf
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">@lang('Cancel')</button>
|
||||||
|
<button type="submit" class="btn btn-danger danger" id="poller-removal"
|
||||||
|
data-target="poller-removal">@lang('Delete')
|
||||||
|
</button>
|
||||||
|
<input type="hidden" name="id" id="id" value="">
|
||||||
|
<input type="hidden" name="pollertype" id="pollertype" value="">
|
||||||
|
<input type="hidden" name="confirm" id="confirm" value="yes">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
@if(auth()->user()->isAdmin())
|
||||||
|
<script>
|
||||||
|
$('#confirm-delete').on('show.bs.modal', function (e) {
|
||||||
|
id = $(e.relatedTarget).data('id');
|
||||||
|
pollertype = $(e.relatedTarget).data('pollertype');
|
||||||
|
$("#id").val(id);
|
||||||
|
$("#pollertype").val(pollertype);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#poller-removal').click('', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var id = $("#id").val();
|
||||||
|
var pollertype = $("#pollertype").val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: 'ajax_form.php',
|
||||||
|
data: {type: pollertype, id: id},
|
||||||
|
success: function (result) {
|
||||||
|
if (result.status == 0) {
|
||||||
|
toastr.success(result.message);
|
||||||
|
$("#row_" + id).remove();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toastr.error(result.message);
|
||||||
|
}
|
||||||
|
$("#confirm-delete").modal('hide');
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
toastr.error(@lang('An error occurred deleting this poller.'));
|
||||||
|
$("#confirm-delete").modal('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
|
@endsection
|
@@ -23,6 +23,10 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
|
|||||||
|
|
||||||
// pages
|
// pages
|
||||||
Route::resource('device-groups', 'DeviceGroupController');
|
Route::resource('device-groups', 'DeviceGroupController');
|
||||||
|
Route::get('poller', 'PollerController@pollerTab');
|
||||||
|
Route::get('poller/log', 'PollerController@logTab');
|
||||||
|
Route::get('poller/groups', 'PollerController@groupsTab');
|
||||||
|
Route::get('poller/performance', 'PollerController@performanceTab');
|
||||||
Route::get('locations', 'LocationController@index');
|
Route::get('locations', 'LocationController@index');
|
||||||
Route::resource('preferences', 'UserPreferencesController', ['only' => ['index', 'store']]);
|
Route::resource('preferences', 'UserPreferencesController', ['only' => ['index', 'store']]);
|
||||||
Route::resource('users', 'UserController');
|
Route::resource('users', 'UserController');
|
||||||
@@ -42,7 +46,7 @@ Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// old route redirects
|
// old route redirects
|
||||||
Route::permanentRedirect('poll-log', 'pollers/tab=log/');
|
Route::permanentRedirect('poll-log', 'poller/log');
|
||||||
Route::get('settings/sub={tab}', function ($tab) {
|
Route::get('settings/sub={tab}', function ($tab) {
|
||||||
return redirect("settings/$tab");
|
return redirect("settings/$tab");
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user