mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
option to ignore device status (#15697)
* option to ignore device status * . * . * schema update
This commit is contained in:
@@ -90,7 +90,7 @@ class AvailabilityMapController extends WidgetController
|
||||
if (! $settings['show_disabled_and_ignored']) {
|
||||
$device_query->isNotDisabled();
|
||||
}
|
||||
$devices = $device_query->select(['devices.device_id', 'hostname', 'sysName', 'display', 'status', 'uptime', 'last_polled', 'disabled', 'ignore'])->get();
|
||||
$devices = $device_query->select(['devices.device_id', 'hostname', 'sysName', 'display', 'status', 'uptime', 'last_polled', 'disabled', 'ignore', 'ignore_status'])->get();
|
||||
|
||||
// process status
|
||||
$uptime_warn = (int) Config::get('uptime_warning', 86400);
|
||||
@@ -253,6 +253,10 @@ class AvailabilityMapController extends WidgetController
|
||||
return ['disabled', 'blackbg'];
|
||||
}
|
||||
|
||||
if ($device->ignore_status) {
|
||||
return ['ignored-up', 'label-success'];
|
||||
}
|
||||
|
||||
if ($device->ignore) {
|
||||
if (($device->status == 1) && ($device->uptime != 0)) {
|
||||
return ['ignored-up', 'label-success'];
|
||||
|
@@ -55,6 +55,7 @@ class Device extends BaseModel
|
||||
'display',
|
||||
'icon',
|
||||
'ignore',
|
||||
'ignore_status',
|
||||
'ip',
|
||||
'location_id',
|
||||
'notes',
|
||||
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
$table->boolean('ignore_status')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
$table->dropColumn('ignore_status');
|
||||
});
|
||||
}
|
||||
};
|
@@ -32,6 +32,7 @@ if (! empty($_POST['editing'])) {
|
||||
$device_model->purpose = $_POST['descr'];
|
||||
$device_model->poller_group = $_POST['poller_group'];
|
||||
$device_model->ignore = (int) isset($_POST['ignore']);
|
||||
$device_model->ignore_status = (int) isset($_POST['ignore_status']);
|
||||
$device_model->disabled = (int) isset($_POST['disabled']);
|
||||
$device_model->disable_notify = (int) isset($_POST['disable_notify']);
|
||||
$device_model->type = $_POST['type'];
|
||||
@@ -314,6 +315,17 @@ If `devices.ignore = 0` or `macros.device = 1` condition is is set and ignore al
|
||||
?> />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ignore_status" class="col-sm-2 control-label" title="Tag device to ignore Status. It will always be shown as online.">Ignore Device Status</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="ignore_status" type="checkbox" id="ignore_status" value="1" data-size="small"
|
||||
<?php
|
||||
if ($device_model->ignore_status) {
|
||||
echo 'checked=checked';
|
||||
}
|
||||
?> />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-1 col-md-offset-2">
|
||||
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
|
||||
|
@@ -663,6 +663,7 @@ devices:
|
||||
- { Field: port_association_mode, Type: int, 'Null': false, Extra: '', Default: '1' }
|
||||
- { Field: max_depth, Type: int, 'Null': false, Extra: '', Default: '0' }
|
||||
- { Field: disable_notify, Type: tinyint, 'Null': false, Extra: '', Default: '0' }
|
||||
- { Field: ignore_status, Type: tinyint, 'Null': false, Extra: '', Default: '0' }
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [device_id], Unique: true, Type: BTREE }
|
||||
devices_hostname_sysname_display_index: { Name: devices_hostname_sysname_display_index, Columns: [hostname, sysName, display], Unique: false, Type: BTREE }
|
||||
|
Reference in New Issue
Block a user