App-Netdisco

 view release on metacpan or  search on metacpan

lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm  view on Meta::CPAN

use base 'DBIx::Class::Core';

__PACKAGE__->table_class('DBIx::Class::ResultSource::View');

__PACKAGE__->table('cidr_ips');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<'ENDSQL');
  SELECT net as subnet,
         power(2, (32 - masklen(net))) as subnet_size,
         count(DISTINCT ip) as active,
         round(100 * count(DISTINCT ip) / (power(2, (32 - masklen(net))))) as percent
    FROM (
      SELECT DISTINCT net, ni.ip
        FROM subnets s1, node_ip ni
        WHERE s1.net <<= ?::cidr
              AND ni.ip <<= s1.net
              AND ((
                ni.time_first IS null
                AND ni.time_last IS null
              ) OR (
                ni.time_last >= ?

lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm  view on Meta::CPAN

              AND s1.last_discover >= ?
      UNION
      SELECT DISTINCT net, di.alias as ip
        FROM subnets s2, device_ip di JOIN device d USING (ip)
        WHERE s2.net <<= ?::cidr
              AND di.alias <<= s2.net
              AND s2.last_discover >= ?
              AND d.last_discover >= ?
    ) as joined
    GROUP BY net
    ORDER BY percent ASC
ENDSQL

__PACKAGE__->add_columns(
  "subnet",
  { data_type => "cidr", is_nullable => 0 },
  "subnet_size",
  { data_type => "integer", is_nullable => 0 },
  "active",
  { data_type => "integer", is_nullable => 0 },
  "percent",
  { data_type => "integer", is_nullable => 0 },
);

1;

share/public/javascripts/jquery.floatThead.js  view on Meta::CPAN

        $sizerRow.outerHeight(headerHeight);
        $sizerCells.outerHeight(headerHeight);
      }


      function setFloatWidth(){
        var tableWidth = $table.outerWidth();
        var width = $scrollContainer.width() || tableWidth;
        $floatContainer.width(width - scrollbarOffset.vertical);
        if(locked){
          var percent = 100 * tableWidth / (width - scrollbarOffset.vertical);
          $floatTable.css('width', percent+'%');
        } else {
          $floatTable.outerWidth(tableWidth);
        }
      }

      function updateScrollingOffsets(){
        scrollingTop = (util.isFunction(opts.scrollingTop) ? opts.scrollingTop($table) : opts.scrollingTop) || 0;
        scrollingBottom = (util.isFunction(opts.scrollingBottom) ? opts.scrollingBottom($table) : opts.scrollingBottom) || 0;
      }

share/public/swagger-ui/swagger-ui-bundle.js.map  view on Meta::CPAN

{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 396b8c743e9ffbc09e47","webpack:///./node_modules/react/react.js","webpack:///./node_modules/prop-types/index.js","webpack:///./node_modules/babel-run...

share/views/ajax/report/subnets.tt  view on Meta::CPAN

      <th class="nd_center-cell">Percent Utilization</th>
    </tr>
  </thead>
  <tbody>
    [% FOREACH row IN results %]
    <tr>
      <td class="nd_center-cell"><a href="[% uri_for('/report/ipinventory') | none %]?subnet=[% row.subnet | uri %]&daterange=[% params.daterange | uri %]&age_invert=[% params.age_invert | uri %]&limit=[% row.subnet_size | uri %]">
               [% row.subnet | html_entity %]</a></td>
      <td class="nd_center-cell">[% row.subnet_size | format_number %]</td>
      <td class="nd_center-cell">[% row.active | format_number %]</td>
      <td class="nd_center-cell">[% row.percent | html_entity %]</td>
    </tr>
    [% END %]
  </tbody>
</table>

<script>
$(document).ready(function() {
  $('#data-table').dataTable({
    "order": [[ 3, 'desc' ]],
    "columnDefs": [

share/views/ajax/report/subnets_csv.tt  view on Meta::CPAN

[% USE CSV %]
[% CSV.dump([ 'Subnet' 'Size' 'Number of Active Nodes' 'Percent Utilization' ]) %]

[% FOREACH row IN results %]
  [% mylist = [] %]
  [% mylist.push(row.subnet) %]
  [% mylist.push(row.subnet_size) %]
  [% mylist.push(row.active) %]
  [% mylist.push(row.percent) %]
  [% CSV.dump(mylist) %]

[% END %]




( run in 0.589 second using v1.01-cache-2.11-cpan-05162d3a2b1 )