This file is indexed.

/usr/share/netdisco/html/reports.html is in netdisco-frontend 1.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
% $m->comp('SELF:pickreport');
% if ($report && defined($title{$report})) {
%  $m->comp('SELF:report_' . $report);
% }
<h1 class="pagehead"><%$title{$report}%></h1>
% if ($report && (!defined($results) || @$results == 0)) {
No results returned.
% } else {
<TABLE>
<TR>
% foreach my $column (@$columns) {
<TH><%$column->[0]%></TH>
% }
</TR>
% foreach my $row (@$results) {
<TR CLASS="match-<%++$odd%2%>">
%  foreach my $column (@$columns) {
%   $row->{$column->[1]} =~ s/\Q$netdisco::CONFIG{domain}\E// if ($column->[1] eq 'name');
<TD><%$row->{$column->[1]} or '[none]'%>
%  }
</TR>
% }
% }
</TABLE>
<%args>
$report => undef
</%args>
<%shared>
my $results = undef;
my $columns = [];
my %title;
my $odd = 1;
my $arg_report;
</%shared>
<%init>
%title = (
        device_inventory => "Device Inventory",
        radio_power => "Access Point Channels and Power",
        dns_mismatch => "Device Name / DNS mismatches",
        ap_clients => "Clients per Access Point",
        poe_status => "PoE Status",
        radio_mac_location => "Radio MAC address and location",
        radio_speed_ssid => "Wireless client speeds by SSID",
);
$arg_report = $report;
</%init>
<%method pickreport>
<h1 class="pagehead">Pick a Report</h1>
<FORM ACTION="<%$r->uri%>" METHOD=GET>
<SELECT NAME="report">
% foreach my $key (sort keys %title) {
<OPTION VALUE="<%$key%>"<%$arg_report eq $key ? ' SELECTED' : ''%>><%$title{$key}%></OPTION>
% }
</SELECT>
<INPUT TYPE="submit" CLASS="navbutton" VALUE="View Report">
</FORM>
</%method>
<%method report_device_inventory>
<%perl>
$columns = [
        [ 'Name', 'name' ],
        [ 'Location', 'location' ],
        [ 'Serial No', 'serial' ],
        [ 'Vendor', 'vendor' ],
        [ 'Model', 'model' ],
        [ 'OS Rev', 'os_ver' ]
           ];
$results = sql_rows('device', ['*']);
$results = [ sort { $a->{name} cmp $b->{name} } @$results ];
</%perl>
</%method>
<%method report_dns_mismatch>
<%perl>
$columns = [
        [ 'Device Name', 'name' ],
        [ 'DNS Name', 'dns' ],
        [ 'IP Address', 'ip' ]
           ];
my $alldev = sql_rows('device', ['name', 'dns', 'ip']);
$results = [];
foreach my $dev (@$alldev) {
        my $name = $dev->{name};
        my $dns = $dev->{dns};
        $name =~ s/\Q$netdisco::CONFIG{domain}\E//;
        $dns =~ s/\Q$netdisco::CONFIG{domain}\E//;
        push(@$results, $dev) if (lc($name) ne lc($dns));
}
</%perl>
</%method>
<%method report_ap_clients>
<%perl>
$columns = [
        [ 'Name', 'name' ],
        [ 'Location', 'location' ],
        [ 'Port', 'port' ],
        [ '# Clients', 'count' ]
           ];
$results = sql_rows('device,node', ['device.name','device.location','node.port','count(node.port) as count'],
        { 'device.ip' => \'node.switch',
                'device.name' => '%ap%',
                'node.active' => 't',
                'node.time_last' => \\'>= device.last_macsuck' },
        0,
        'group by device.name,device.location,node.port');
$results = [ sort { $b->{count} <=> $a->{count} } @$results ];
</%perl>
</%method>
<%method report_radio_power>
<%perl>
$columns = [
        [ 'Name', 'name' ],
        [ 'Model', 'model' ],
        [ 'Location', 'location' ],
        [ 'Port', 'port' ],
        [ 'Channel', 'channel' ],
        [ 'Tx Power (mW)', 'power' ],
        [ 'Tx Power (dBm)', 'power2' ]
           ];
$results = sql_rows('device d, device_port_wireless w',
        [ 'distinct d.name', 'd.model', 'd.location', 'w.port', 'w.channel', 'w.power' ],
        { 'd.ip' => \'w.ip' });
$results = [ sort sortportname @$results ];
foreach $r (@$results) {
        next unless defined($r->{power}) && $r->{power};
        $r->{power2} = sprintf("%.1f", 10.0*CORE::log($r->{power})/CORE::log(10));
}

sub sortportname {
        sort_port($a,$b) or $a->{name} cmp $b->{name};
}
</%perl>
</%method>
<%method report_poe_status>
<%perl>
$columns = [
        [ 'Name', 'name' ],
        [ 'Model', 'model' ],
        [ 'Location', 'location' ],
        [ 'PoE<br>Module', 'module' ],
        [ 'Power<br>(W)', 'power' ],
        [ 'Supply', 'status' ],
        [ 'Capable<br>Ports', 'ports' ],
        [ 'Supplied<br>Ports', 'on' ],
        [ 'Disabled<br>Ports', 'disabled' ],
        [ 'Power<br>Errors', 'err' ],
        [ 'Committed<br>(W)', 'committed' ],
           ];
$results = sql_rows('device d, device_power p',
        [ 'd.ip', 'd.name', 'd.model', 'd.location', 'p.module', 'p.status', 'p.power' ],
        { 'd.ip' => \'p.ip' }, 0,
        'order by d.name, p.module');
foreach my $poe (@$results) {
    $m->comp('device.html:poe_stats', poe => $poe);
    foreach my $k (keys %{$poe->{stats}}) {
        $poe->{$k} = $poe->{stats}->{$k};
    }
}
</%perl>
</%method>
<%method report_radio_mac_location>
<%perl>
$columns = [
        [ 'MAC', 'mac' ],
        [ 'Location', 'location' ],
           ];
$results = sql_rows('device d, device_port p',
        [ 'distinct p.mac', 'd.location' ],
        { 'd.ip' => \'p.ip', 'p.port' => '%Dot11Radio%' }, 0,
        'order by d.location, p.mac');
</%perl>
</%method>
<%method report_radio_speed_ssid>
<%perl>
$columns = [
        [ 'SSID', 'ssid' ],
        [ 'Technology', 'type' ],
        [ 'Count', 'count' ],
           ];
$results = sql_rows('node_wireless nw, node n, device_port_ssid s, device d',
        [ 'maxrate', 'count(maxrate) as count', 'n.port', 's.ssid' ],
        { 'n.mac' => \'nw.mac', 's.ip' => \'n.switch', 's.port' => \'n.port',
          'n.active' => 't', 'd.ip' => \'n.switch',
          'n.time_last' => \\'>= d.last_macsuck', }, 0,
        'group by nw.maxrate,n.port,s.ssid order by count desc' );

# Strip the subinterface, if any, from the port; then convert to a
# technology.  This continues the assumption that Dot11Radio0 is
# 802.11b/g and Dot11Radio1 is 802.11a.
# N rates are not currently exposed via SNMP so there's no way to
# tell between g and n(2.4), or between a and n(5).
my %map = ( 'Dot11Radio0/11' => '802.11b', 'Dot11Radio0/54' => '802.11g',
            'Dot11Radio1/54' => '802.11a' );
foreach my $res (@$results) {
    my $port = $res->{port};
    $port =~ s/\.[0-9]+$//;
    my $info = sprintf("%s/%d", $port, $res->{maxrate});
    $res->{type} = $map{ $info } || $info;
}
</%perl>
</%method>
<%method title>
- Reporting \
</%method>
%# $Id: reports.html,v 1.9 2009/06/11 00:22:33 maxbaker Exp $
%# vim:syntax=mason