1<?php
2
3/**
4 * Observium Network Management and Monitoring System
5 * Copyright (C) 2006-2015, Adam Armstrong - http://www.observium.org
6 *
7 * @package    observium
8 * @subpackage webui
9 * @author     Adam Armstrong <adama@observium.org>
10 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
11 *
12 */
13
14$box_args = array('title' => 'c6500/7600 Crossbar',
15                  'icon' => $config['icon']['crossbar'],
16                  );
17echo generate_box_open($box_args);
18
19echo('<table class="table table-condensed table-striped">');
20
21foreach ($entity_state['group']['c6kxbar'] as $index => $entry)
22{
23  if (empty($entry['']['cc6kxbarModuleModeSwitchingMode'])) { continue; }
24
25  // FIXME i'm not sure if this is the correct way to decide what entphysical index it is. slotnum+1? :>
26  $entity = dbFetchRow("SELECT * FROM entPhysical WHERE device_id = ? AND entPhysicalIndex = ?", array($device['device_id'], $index+1));
27
28  echo("<tr bgcolor=$row_colour>
29        <td colspan=5 width=200><strong>".$entity['entPhysicalName']."</strong></td>
30        <td colspan=2>");
31
32  switch ($entry['']['cc6kxbarModuleModeSwitchingMode'])
33  {
34    case "busmode":
35     # echo '<a title="Modules in this mode don't use fabric. Backplane is used for both lookup and data forwarding.">Bus</a>';
36      break;
37    case "crossbarmode":
38      echo '<a class="label label-info" title="Modules in this mode use backplane for forwarding decision and fabric for data forwarding.">Crossbar</a>';
39      break;
40    case "dcefmode":
41      echo '<a class="label label-success" title="Modules in this mode use fabric for data forwarding and local forwarding is enabled.">DCEF</a>';
42      break;
43    default:
44      echo '<span class="label">'.$entry['']['cc6kxbarModuleModeSwitchingMode'].'</span>';
45  }
46
47  echo("</td>
48      </tr>");
49
50  foreach ($entity_state['group']['c6kxbar'][$index] as $subindex => $fabric)
51  {
52    if (is_numeric($subindex))
53    {
54      if ($fabric['cc6kxbarModuleChannelFabStatus'] == "ok")
55      {
56        $fabric['mode_class'] = "success";
57      } else {
58        $fabric['mode_class'] = "warning";
59      }
60
61      $percent_in = $fabric['cc6kxbarStatisticsInUtil'];
62      $background_in = get_percentage_colours($percent_in);
63
64      $percent_out = $fabric['cc6kxbarStatisticsOutUtil'];
65      $background_out = get_percentage_colours($percent_out);
66
67      $graph_array           = array();
68      $graph_array['height'] = "100";
69      $graph_array['width']  = "210";
70      $graph_array['to']     = $config['time']['now'];
71      $graph_array['device']     = $device['device_id'];
72      $graph_array['mod']    = $index;
73      $graph_array['chan']   = $subindex;
74      $graph_array['type']   = "c6kxbar_util";
75      $graph_array['from']   = $config['time']['day'];
76      $graph_array['legend'] = "no";
77
78      $link_array = $graph_array;
79      $link_array['page'] = "graphs";
80      unset($link_array['height'], $link_array['width'], $link_array['legend']);
81      $link = generate_url($link_array);
82
83      $text_descr = $entity['entPhysicalName'] . " - Fabric " . $subindex;
84
85      $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
86
87      $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00';
88      $graph_array['style'][] = 'margin-top: -6px';
89
90      $minigraph =  generate_graph_tag($graph_array);
91
92      echo('<tr class="'.$background['class'].'">
93          <td class="state-marker"></td>
94          <td width=150><strong>Fabric '.$subindex.'</strong></td>
95          <td><span style="font-weight: bold;" class="label label-'.$fabric['mode_class'].'">'.$fabric['cc6kxbarModuleChannelFabStatus']."</span></td>
96          <td>".formatRates($fabric['cc6kxbarModuleChannelSpeed']*1000000)."</td>
97          <td>".overlib_link($link, $minigraph, $overlib_content)."</td>
98          <td width=125>".print_percentage_bar (125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right'])."</td>
99          <td width=125>".print_percentage_bar (125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right'])."</td>
100          </tr>");
101    }
102  }
103}
104
105echo("</table>");
106echo generate_box_close();
107
108// EOF
109