diff --git a/lib/App/Netdisco/Util/Statistics.pm b/lib/App/Netdisco/Util/Statistics.pm index 2e4e4d9f..8046ce15 100644 --- a/lib/App/Netdisco/Util/Statistics.pm +++ b/lib/App/Netdisco/Util/Statistics.pm @@ -34,6 +34,7 @@ sub update_stats { my $schema = schema('netdisco'); eval { require SNMP::Info }; my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION); + my $postgres_ver = pretty_version($schema->storage->dbh->{pg_server_version}, 2); # TODO: (when we have the capabilities table?) # $stats{waps} = sql_scalar('device',['COUNT(*)'], {"model"=>"AIR%"}); @@ -47,10 +48,11 @@ sub update_stats { device_ip_count => $schema->resultset('DeviceIp')->count_rs->as_query, device_link_count => + ( $postgres_ver =~ m/^8\./ ? 0 : $schema->resultset('Virtual::DeviceLinks')->search(undef, { select => [ { coalesce => [ { sum => 'aggports' }, 0 ] } ], as => ['totlinks'], - })->get_column('totlinks')->as_query, + })->get_column('totlinks')->as_query ), device_port_count => $schema->resultset('DevicePort')->count_rs->as_query, device_port_up_count => @@ -70,8 +72,7 @@ sub update_stats { snmpinfo_ver => $snmpinfo_ver, schema_ver => $schema->schema_version, perl_ver => pretty_version($], 3), - pg_ver => - pretty_version($schema->storage->dbh->{pg_server_version}, 2), + pg_ver => $postgres_ver, }, { key => 'primary' }); }); diff --git a/share/views/ajax/statistics.tt b/share/views/ajax/statistics.tt index d8bd1d3b..99caf531 100644 --- a/share/views/ajax/statistics.tt +++ b/share/views/ajax/statistics.tt @@ -17,9 +17,11 @@ of which [% stats.device_port_up_count | format_number %] are up + [% IF stats.device_link_count %] [% stats.device_link_count| format_number %] layer 2 links between devices + [% END %] [% stats.node_table_count | format_number %] nodes logged, of which [% stats.node_active_count | format_number %] are active