76 Commits

Author SHA1 Message Date
Jellyfrog 29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog 82f43cb98d Apply fixes from StyleCI (#12120) 2020-09-21 15:40:17 +02:00
PipoCanaja 6d56b9699b Fix autodiscovery vs discovery on LLDP/xDP links (#11189)
* Fix xdp autodiscovery consistency (discovery vs autodiscovery)

* Update documentation related to xDP autodiscovery
2020-03-05 13:27:20 +01:00
Michael Ducharme 902c056f62 Fix for RouterOS LLDP discovery (#10265)
* Fix for RouterOS LLDP discovery

Only the first nine neighbors were correct on RouterOS - missing hexdec() led to the remaining neighbors being linked to the wrong ports. Ex. port 10 in hex was incorrectly linked to port 10 decimal when it should be 16 in decimal

* Added test data for MikroTik RouterOS CRS317 switch
2019-05-28 08:32:51 +02:00
PipoCanaja 30537361db LLDP Discovery by IP (#10130)
* add ip polling on LLDP devices

* ipv6 support

* formatting

* codeclimate
2019-04-29 21:56:03 -05:00
Chi Hang Long 2eb5e30aa7 Modify to fix neighbours on EXOS switch problem (#10013)
https://community.librenms.org/t/modify-discovery-protocols-inc-php-to-fix-neighbours-problem-on-extreme-networks-exos-switch/7797

The bug is caused by SNMP polling switch-1 with ifIndex to DB (associate
ifIndex when adding switch), the port “1” is “1001”. Another switch-2
discover the switch-1 port “1” by LLDP is “1” (after LiberNMS get this
information). Two values are not equal (“1001” != “1”). If I change to
use ifName associate when adding device, because ifName is “1:1”, so it
can not equal to LLDP too (“1:1” != “1”).
2019-04-01 09:24:58 +02:00
Vitali Kari fcadd3ca65 Added support for LLDP on ALCATEL/NOKIA SR OS (#9298)
* add support for LLDP on ALCATEL/NOKIA SR OS

* add dest data for discovery-protocols
2018-10-17 17:06:46 +01:00
Martin Zatloukal c30a5e8977 feature: Added Mikrotik LLDP discovery (#7901)
* Add Mikrotik LLDP discovery

* Add Mikrotik LLDP discovery

* Add Mikrotik LLDP discovery
2017-12-16 22:23:06 +00:00
Tony Murray 8ab0b2bffd refactor: Replace custom queries with dbDeleteOrphans(). (#7862)
* Replace custom queries with dbDeleteOrphans().
Generalize dbDeleteOrphans() a bit more.  Allow for multiple tables and custom key pairs.

* fix whitespace
2017-12-06 22:44:23 +00:00
Tony Murray f01cf38a3a fix: lldp discovery change local port resolution (#7443)
* fix: lldp discovery change local port resolution
dot1dBasePortIfIndex seems to skip some ports in certain configurations on Cisco devices.
Add quirk for Calix devices that return different port labels than they actually are.

* bdcom uses NMS-LLDP-MIB too.

* use dot1dBasePort to look up ifIndex if we can.
2017-10-24 08:21:32 +01:00
Tony Murray f92449e637 fix: issues with recent discovery refactor (#7437)
fix find_port_id() deleting all variables when device_id was given
improve find_port_id() to find ports where only a number is given
fix orphan deletion count
fix insert and update of links with strings where int are required
2017-10-06 08:53:16 -05:00
Tony Murray c0b267b49c refactor: Discovery protocols re-write (#7380)
* refactor: discovery protocols re-write
extract more code to make it easier to read
use snmpwalk_group
walk lldpRemTable instead of lldpRemoteSystemsData
Optimize discover_device to reduce dns lookups of bad dns names
Make discovery_by_ip behavior consistent between cdp and lldp
move can_skip_discovery to discovery functions

Tested lldp, cdp, and ospf.

* always discover links even if the remote device isn't in system
Fix discover_link always updating

* fix style

* fix update, not fetching id

* increase platform length.  Most devices use sysDescr here, which is max length 255

* remove orphaned links

* update db_schema.yaml
2017-10-04 08:16:23 +01:00
Tony Murray b18c41b1a9 refactor: Use the Config class includes/discovery (#7299)
* refactor: use the Config class includes/discovery

* fix issue with $config variable not accessible in include-dir.inc.php

* improved whitespace

* Tidy up discovery_by_ip
2017-09-11 21:26:41 +01:00
Tony Murray 1d777693e1 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. (#7106)
* Refactor remove use of pear Net_IPv4 and Net_IPv6

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5

* Fix graph authorization. Uncaught exception and checking an ipv4 against an ipv6 network == fail.

* Also remove colons from hex strings.

* Fix typo in bgp polling
Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
2017-08-08 14:14:58 -05:00
Neil Lathwood bda5a4343e fix: Fixed auto discovery for lldp not adding new hosts (#6919) 2017-06-29 19:29:33 +01:00
Tony Murray 90aa485149 refactor: discovery code cleanups (#6856)
* Use foreach $key => value

* use get_port_by_ifIndex
get rid of the rest of the array_keys()

* improve hex_to_ip() function, add tests, use in more places

* Simplify can_skip_discovery logic
2017-06-22 21:08:20 +01:00
David Bell 3512b19e2b feature: Update LLDP discovery to use IP address if discovery_by_ip is enabled #5872
* Update LLDP discovery to use IP address if discovery_by_ip is enabled

* Update as per laf's suggetions

* Fix indentation

* Updated with Laf's suggestion

* Add more debugging

* Trim MAC address

* Remove debug statements
2017-02-23 22:47:58 +00:00
Neil Lathwood 21898a3c29 Disco / Poller tidy up + Added display of module mem usage (#5778)
* tidyup + added mem usage for poller modules

* tidied up discovery modules

* fix sensors
2017-02-07 22:54:30 -06:00
towster 3fb65da339 fix: Fix for issue #5525
* Update discovery-protocols.inc.php

Allow invalid hostnames if discovery by IP is true

* Update AUTHORS.md

signing

* Update AUTHORS.md

signing

* CDP discovery by IP modification

CDP would not discover devices that had invalid DNS value for cdpCacheDeviceId - modified to accept 
Also exclude adding devices whose hostname matches the IP

* Update AUTHORS.md

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
2017-01-26 22:52:13 +00:00
NetworkNub 175db1deb5 fix lldp discovery 2016-10-20 20:36:18 -04:00
NetworkNub 41a40bf6e6 fix copy paste error 2016-10-20 20:24:40 -04:00
laf 46d2f578e7 added central function and updated 2016-10-18 03:06:03 +00:00
NetworkNub 2aae3e6dff add xdp exclude device filters 2016-10-17 00:38:47 -04:00
Tony Murray edbb6ae0e3 refactor: Centralize MIB include directory specification (#4603)
* refactor: Centralize MIB include directory specification
The default is now:
```
$config['mib_dir'].'/mibdirname:'.$config['mib_dir']
```
This means we exclude OS mibs and only use ours  (we could prepend `+` if we want to include os mibs.
All snmp calls should only include the name of the subdirectory under the mibs directory.

* Remove d_echo from Proc
Fix snmpsim tests.
2016-09-28 14:19:28 +01:00
Tony Murray 9284bc60ff Update code in includes to be PSR-2 compliant (#4220)
refactor: Update code in /includes to be psr2 compliant #4220
2016-08-28 18:32:58 +01:00
Eldon Koyle f019a28d8c and a semicolon 2016-08-15 14:53:44 -06:00
Eldon Koyle 71625f6aba fix whitespace (spaces, not tabs) 2016-08-15 14:44:19 -06:00
Eldon Koyle c405c38eff Check against the proper subtype variable, initialize variable 2016-08-15 11:52:21 -06:00
Eldon Koyle 34f503afb8 Use port instead of chassis ID for port matching
Code was improperly using chassis id for port matching.

Fixes #4069 .
2016-08-15 11:40:11 -06:00
vitalisator 850c4a2f92 move pbn mibs to subdirectory 2016-08-07 11:40:37 +02:00
laf 558dfb2344 Pretty up the discovery process output 2016-06-21 00:59:43 +01:00
Dave Bell a5d0b0a306 Changed syntax of if statement for readability 2016-05-26 20:43:56 +01:00
Dave Bell 18eab48d7e Correct array name 2016-05-25 20:13:56 +01:00
Dave Bell db5d074a52 Enable discovery of CDP neighbour by IP address 2016-05-25 09:52:28 +01:00
vitalisator 4bd3b12c44 revert to fetchRow 2015-12-13 21:00:39 +01:00
vitalisator 7237c84164 change fetchRow to fetchCell 2015-12-13 20:24:08 +01:00
vitalisator 29e708819a closes #2614 2015-12-13 20:15:43 +01:00
root 8ed1a50657 Added parameter for sql query to check ifPhysAddress as thats what lldpRemPortId is 2015-12-09 20:37:15 +00:00
Mark Schouten 677a4f3f5f Remove all unneeded if($debug)-statements and replace them with d_echo . discovery dir.. 2015-08-21 16:10:01 +02:00
vitalisator 009cfdf13f ource of MIBs is www.pbnglobal.com 2015-08-17 20:44:52 +02:00
vitalisator 5fea54ca6a add NMS-LLDP-MIB discovery for PBN devices 2015-08-17 18:12:49 +02:00
laf de0f9ee697 PBN devices support CDP but does not output like Cisco so using a different function to grab the first array needed 2015-08-04 20:37:05 +00:00
laf 741742aa85 Added debug to discovery protocols + stop them running if not configured 2015-08-02 19:23:54 +00:00
Job Snijders d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
laf adb036759e Updated autodiscovery to use log_event better 2015-07-13 11:52:38 +01:00
laf ac0221f7e5 Update SQL query for ospf_nbrs lookup to use device_id 2015-05-20 13:41:23 +01:00
Paul Gear ab66b453e4 Make OSPF & ARP autodiscovery independent of xDP autodiscovery
Both OSPF & ARP discovery use discover_new_device(), but it was checking
$config[autodiscovery][xdp] internally, meaning xDP had to be enabled for the other two to work.
2015-05-18 20:32:11 +10:00
Alexander Sosna 5a7988e2e4 chmod 0644 to php files not directly executed 2015-04-28 22:58:03 +02:00
laf c8a5a90364 Updated dbFetchRows 2015-04-11 15:45:17 +01:00
laf 818cbcc731 Added ospf discovery 2015-04-11 15:01:14 +01:00