Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-4835

Add "Force Discovery" toggle to edit device page

Details

    • New Feature
    • Resolution: Fixed
    • Minor
    • None
    • Professional Edition
    • Web Interface

    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

      Attachments

        Activity

          [OBS-4835] Add "Force Discovery" toggle to edit device page

          Thanks Adam

          mcslc Matthew Clancy added a comment - Thanks Adam
          adama Adam Armstrong made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Pending Response [ 10000 ] New: Resolved [ 5 ]

          Added in r13566.

          The patch was broken, it the last array was missing an opening tag.

          adama Adam Armstrong added a comment - Added in r13566. The patch was broken, it the last array was missing an opening tag.
          landy Mike Stupalov made changes -
          Status Original: In Review [ 10101 ] New: Pending Response [ 10000 ]

          I think I'd prefer this to be a single-click button that used an AJAX request to set the field, but this is an OK quick implementation that we can pretend we'll improve later.

          adama Adam Armstrong added a comment - I think I'd prefer this to be a single-click button that used an AJAX request to set the field, but this is an OK quick implementation that we can pretend we'll improve later.
          landy Mike Stupalov made changes -
          Status Original: Pending Response [ 10000 ] New: In Review [ 10101 ]

          Diffed file is `html/pages/device/edit/device.inc.php`, if it was obvious from the initial request.Release is 24.4.13510.

          mcslc Matthew Clancy added a comment - Diffed file is `html/pages/device/edit/device.inc.php`, if it was obvious from the initial request.Release is 24.4.13510.
          bot Observium Bot made changes -
          Status Original: Open [ 1 ] New: Pending Response [ 10000 ]
          mcslc Matthew Clancy created issue -

          General questions and device support can be discussed in our Discord channel, click here to join.


          Please make and attach additional information about the device:

          • full snmp dump from device:

            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1 > myagent.snmpwalk
            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk

            If device not support SNMP version 2c, replace -v2c with -v1.

          • If you have problems with discovery or poller processes, please do and attach these debugs:

            ./discovery.php -d -h <device>
            ./poller.php -d -h <device>

          • additionally attach device and/or vendor specific MIB files

          This comment is added automatically.

          bot Observium Bot added a comment - General questions and device support can be discussed in our Discord channel, click here to join . Please make and attach additional information about the device: full snmp dump from device: snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1 > myagent.snmpwalk snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk If device not support SNMP version 2c, replace -v2c with -v1. If you have problems with discovery or poller processes, please do and attach these debugs: ./discovery.php -d -h <device> ./poller.php -d -h <device> additionally attach device and/or vendor specific MIB files This comment is added automatically.

          People

            adama Adam Armstrong
            mcslc Matthew Clancy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: