Send netdisco-users mailing list submissions to
netdisco-users@lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/netdisco-users
or, via email, send a message with subject or body 'help' to
netdisco-users-requ...@lists.sourceforge.net
You can reach the person managing the list at
netdisco-users-ow...@lists.sourceforge.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of netdisco-users digest..."
Today's Topics:
1. neighbor map database errors: "cannot take logarithm of zero"
(Chris Stromsoe)
--- Begin Message ---
Neighbor maps are failing for my install. I'm currently running 2.39.20.
I first noticed the failure with 2.39.17 and then upgraded. I'm not sure
when they were last working.
~/logs/netdisco-web.log has:
[13811] 2018-04-03 18:36:16 error request to GET /ajax/data/device/netmap crashed:
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute
failed: ERROR: cannot take logarithm of zero [for Statement "SELECT me.ip,
me.creation, me.dns, me.description, me.uptime, me.contact, me.name, me.location,
me.layers, me.ports, me.mac, me.serial, me.model, me.ps1_type, me.ps2_type,
me.ps1_status, me.ps2_status, me.fan, me.slots, me.vendor, me.os, me.os_ver, me.log,
me.snmp_ver, me.snmp_comm, me.snmp_class, me.vtp_domain, me.last_discover,
me.last_macsuck, me.last_arpnip, to_char(me.creation, 'YYYY-MM-DD HH24:MI'),
to_char(last_arpnip, 'YYYY-MM-DD HH24:MI'), to_char(last_discover, 'YYYY-MM-DD
HH24:MI'), to_char(last_macsuck, 'YYYY-MM-DD HH24:MI'), extract(epoch from
(age(now(), me.creation))), extract(epoch from (age(now(), last_arpnip))),
extract(epoch from (age(now(), last_discover))), extract(epoch from (age(now(),
last_macsuck))), replace(age(timestamp 'epoch!
' + uptime / 100 * interval '1 second', timestamp '1970-01-01
00:00:00-00')::text, 'mon', 'month'), floor(log(throughput.total)) FROM device
me JOIN ( SELECT ip,
sum( COALESCE(dpp.raw_speed,1) ) as total
FROM device_port
LEFT OUTER JOIN device_port_properties dpp USING (ip, port)
WHERE port !~* 'vlan'
AND (type IS NULL OR type !~*
'^(53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)$')
AND (name IS NULL OR name !~* 'vlan')
GROUP BY ip
ORDER BY total DESC, ip ASC
) throughput ON throughput.ip = me.ip"] at
/opt/netdisco/perl5/lib/perl5/App/Netdisco/Web/Plugin/Device/Neighbors.pm line 195
The problem is caused by a handful of devices returning a value of 0 for
dpp.raw_speed causing the COALESCE() to return 0 and the log() to fail.
Modifying line 14 in
perl5/lib/perl5/App/Netdisco/DB/Result/Virtual/DevicePortSpeed.pm
as below with GREATEST(1, ...) around the sum() to ensure a minimum value
of 1 for the value of total solves the problem for me:
12 __PACKAGE__->result_source_instance->view_definition(<<ENDSQL
13 SELECT ip,
14 GREATEST(1, sum( COALESCE(dpp.raw_speed,1) )) as total
15 FROM device_port
16 LEFT OUTER JOIN device_port_properties dpp USING (ip, port)
17 WHERE port !~* 'vlan'
18 AND (type IS NULL OR type !~*
'^(53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)\$')
19 AND (name IS NULL OR name !~* 'vlan')
20 GROUP BY ip
21 ORDER BY total DESC, ip ASC
22 ENDSQL
-Chris
--- End Message ---
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Netdisco mailing list - Digest Mode
netdisco-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/netdisco-users