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

Adding custom groups of ports in addition to peering, transit etc

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • None
    • None
    • Web Interface
    • Linux observium01 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux
      Observium svn revision : 3992

    Description

      We have different groups of ports that we wanted to see under the ports nav drop down at the top in addition to 'customer','peering' etc. We wanted groups like Management, DRAC, and iSCSI.

      We can specify these at the beginning of the port description on the switch using the standard naming types described here : http://www.observium.org/wiki/Interface_Description_Parsing

      e.g.

      EsxMgmt: ESX133-4
      EsxMgmt: ESX134-4
      Mgmt: PDU111
      Inter: sw111-inter

      You then specify an ordered list of the headings expected (so we only get what we want) in config.php as per the below.

      $config['int_groups'] = array("EsxData","EsxMgmt","EsxiSCSI","EQL","Mgmt","LAGs","PI","DRAC");

      I've patched the navbar.inc.php to pull out this list from the config and populate the drop down, see screenshot. Everything else is already done by the existing code.

      I'm happy to edit the wiki page above and add some documentation if this gets approved.

      Attachments

        1. navbar.inc.php.patch
          1 kB
          Paul Orrock
        2. observium-ports.png
          95 kB
          Paul Orrock

        Activity

          [OBS-299] Adding custom groups of ports in addition to peering, transit etc

          Might be trivial and unusable by some, but thought I would share.

          If you change $config['int_groups'] to be an array of key value arrays allows you to be a little more customisable
          Then changes in the custom_port_parser in port-descr-parser.inc.php as such'
          foreach ($config['int_groups'] as $custom_type)
          {
          if (is_array($custom_type))

          { $types[] = strtolower(trim($custom_type['type'])); //newer style allows adding a "type", "title" and "icon" key value pair. }

          else

          { $types[] = strtolower(trim($custom_type)); //assume old flat array style and lob it in }

          }

          and in navbar.inc.php as such'
          foreach ($config['int_groups'] as $int_type)

          { $navbar['ports']['entries'][] = array('url' => generate_url(array('page' => 'iftype', 'type' => is_array($int_type) ? $int_type['type'] : $int_type )), 'image' => is_array($int_type) ? $int_type['icon'] : "images/16/brick_link.png", 'title' => is_array($int_type) ? $int_type['title'] : $int_type); $ifbreak = 1; }

          and define in the config like;
          $config['int_groups'] = array(array('type' => 'intercap','icon' => 'images/16/connect.png','title' => 'Intercap'), array('type' => 'regionalbh','icon' => 'images/16/transmit_blue.png','title' => 'Regional Backhaul')); // Enable Custom Port Types

          Lets you have a bit more control on the front end while still being compatible with the old style.

          steven.white Steven White added a comment - Might be trivial and unusable by some, but thought I would share. If you change $config ['int_groups'] to be an array of key value arrays allows you to be a little more customisable Then changes in the custom_port_parser in port-descr-parser.inc.php as such' foreach ($config ['int_groups'] as $custom_type) { if (is_array($custom_type)) { $types[] = strtolower(trim($custom_type['type'])); //newer style allows adding a "type", "title" and "icon" key value pair. } else { $types[] = strtolower(trim($custom_type)); //assume old flat array style and lob it in } } and in navbar.inc.php as such' foreach ($config ['int_groups'] as $int_type) { $navbar['ports']['entries'][] = array('url' => generate_url(array('page' => 'iftype', 'type' => is_array($int_type) ? $int_type['type'] : $int_type )), 'image' => is_array($int_type) ? $int_type['icon'] : "images/16/brick_link.png", 'title' => is_array($int_type) ? $int_type['title'] : $int_type); $ifbreak = 1; } and define in the config like; $config ['int_groups'] = array(array('type' => 'intercap','icon' => 'images/16/connect.png','title' => 'Intercap'), array('type' => 'regionalbh','icon' => 'images/16/transmit_blue.png','title' => 'Regional Backhaul')); // Enable Custom Port Types Lets you have a bit more control on the front end while still being compatible with the old style.

          r4004.

          Feel free to improve to allow setting of icons and the like in the config.

          adama Adam Armstrong added a comment - r4004. Feel free to improve to allow setting of icons and the like in the config.

          People

            adama Adam Armstrong
            paul.orrock Paul Orrock
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: