Details
-
New Feature
-
Resolution: Fixed
-
Minor
-
None
-
Professional Edition
-
Observium 24.4.13510 (19th April 2024)
OS Linux 6.8.7-1.el8.elrepo.x86_64 [amd64] (AlmaLinux 8.9)
Apache nginx/1.24.0
PHP 8.2.19 (OPcache: ENABLED) (Memory: 1GB)
Python 3.9.18
MariaDB 11.3.2-MariaDB (extension: mysqli 8.2.19)
SNMP NET-SNMP 5.8
RRDtool 1.7.2 (rrdcached 1.7.2: unix:/var/run/rrdcached-obs.sock)
Fping 4.2 (IPv4 and IPv6)
Fetch cURL 7.61.1 (OpenSSL/1.1.1k, LibZ 1.2.11, LibIDN 2.2.0)Observium 24.4.13510 (19th April 2024) OS Linux 6.8.7-1.el8.elrepo.x86_64 [amd64] (AlmaLinux 8.9) Apache nginx/1.24.0 PHP 8.2.19 (OPcache: ENABLED) (Memory: 1GB) Python 3.9.18 MariaDB 11.3.2-MariaDB (extension: mysqli 8.2.19) SNMP NET-SNMP 5.8 RRDtool 1.7.2 (rrdcached 1.7.2: unix:/var/run/rrdcached-obs.sock) Fping 4.2 (IPv4 and IPv6) Fetch cURL 7.61.1 (OpenSSL/1.1.1k, LibZ 1.2.11, LibIDN 2.2.0)
Description
There is an existing database field `force_discovery` in the `devices` table that will force a device to be rediscovered along with `new` devices the next time it's run (usually CRONed at 5min intervals). I tested this small change which adds a toggle for this field to the "Edit Device" page, and seems to work as expected:
# diff -u0 device.inc.php.original device.inc.php
--- device.inc.php.original 2024-05-15 17:34:00.989936494 +1000
+++ device.inc.php 2024-05-15 17:57:16.073886657 +1000
@@ -90 +90 @@
- foreach (['purpose', 'ignore', 'disabled', 'poller_id'] as $param) {
+ foreach (['purpose', 'ignore', 'disabled', 'poller_id', 'force_discovery'] as $param) {
@@ -115 +115,4 @@
- $update_message = "Device record updated.";
+ if ((bool)$vars['force_discovery'] != (bool)$device['force_discovery']) {
+ log_event('Device forced discovery ' . ((bool)$vars['force_discovery'] ? 'enabled' : 'disabled') . ': ' . $device['hostname'], $device['device_id'], 'device', $device['device_id'], 5);
+ }
+ $update_message = "Device record updated.";
@@ -240 +243,10 @@
-$form['row'][8]['submit'] = [
+$form['row'][8]['force_discovery'] = [
+ 'type' => 'toggle',
+ 'view' => 'toggle',
+ 'palette' => 'red',
+ 'name' => 'Force Discovery',
+ //'fieldset' => 'edit',
+ 'placeholder' => 'Force the device to be rediscovered in the next 5 mins.',
+ 'readonly' => $readonly,
+ 'value' => $device['force_discovery']];
+$form['row'][9]['submit']
This appears visually like this:
Is it possible for this, or something functionally equivalent, to be merged, as it's a pain to maintain this out of sync with the main repo and the diff seems relatively safe/trivial to me.
Best regards,
Matt Clancy