diff --git a/app/Http/Controllers/Table/FdbTablesController.php b/app/Http/Controllers/Table/FdbTablesController.php index 4d60a24466..1aa081f33f 100644 --- a/app/Http/Controllers/Table/FdbTablesController.php +++ b/app/Http/Controllers/Table/FdbTablesController.php @@ -45,7 +45,7 @@ class FdbTablesController extends TableController return [ 'port_id' => 'nullable|integer', 'device_id' => 'nullable|integer', - 'serachby' => 'in:mac,vlan,dnsname,ip,description', + 'serachby' => 'in:mac,vlan,dnsname,ip,description,first_seen,last_seen', 'dns' => 'nullable|in:true,false', ]; } @@ -137,6 +137,14 @@ class FdbTablesController extends TableController ->orderBy('ports.ifDescr', $sort['description']); } + if (isset($sort['last_seen'])) { + $query->orderBy('updated_at', $sort['last_seen']); + } + + if (isset($sort['first_seen'])) { + $query->orderBy('created_at', $sort['first_seen']); + } + return $query; } @@ -152,7 +160,17 @@ class FdbTablesController extends TableController 'vlan' => $fdb_entry->vlan ? $fdb_entry->vlan->vlan_vlan : '', 'description' => '', 'dnsname' => $ip_info['dns'], + 'first_seen' => 'unknown', + 'last_seen' => 'unknown' ]; + + // diffForHumans and doDateTimeString are not safe + if ($fdb_entry->updated_at) { + $item['last_seen'] = $fdb_entry->updated_at->diffForHumans(); + } + if ($fdb_entry->created_at) { + $item['first_seen'] = $fdb_entry->created_at->toDateTimeString(); + } if ($fdb_entry->port) { $item['interface'] = Url::portLink($fdb_entry->port, $fdb_entry->port->getShortLabel()); diff --git a/app/Models/PortsFdb.php b/app/Models/PortsFdb.php index 4a5c6cabf7..aa816b4245 100644 --- a/app/Models/PortsFdb.php +++ b/app/Models/PortsFdb.php @@ -6,7 +6,7 @@ class PortsFdb extends PortRelatedModel { protected $table = 'ports_fdb'; protected $primaryKey = 'ports_fdb_id'; - public $timestamps = false; + public $timestamps = true; // ---- Define Relationships ---- diff --git a/daily.php b/daily.php index be9229c4e9..798bac1e2b 100644 --- a/daily.php +++ b/daily.php @@ -90,6 +90,11 @@ if ($options['f'] === 'syslog') { } } +if ($options['f'] === 'ports_fdb') { + $ret = lock_and_purge('ports_fdb', 'updated_at < DATE_SUB(NOW(), INTERVAL ? DAY)'); + exit($ret); +} + if ($options['f'] === 'eventlog') { $ret = lock_and_purge('eventlog', 'datetime < DATE_SUB(NOW(), INTERVAL ? DAY)'); exit($ret); diff --git a/daily.sh b/daily.sh index 79b26d6f61..4a885b0fd0 100755 --- a/daily.sh +++ b/daily.sh @@ -273,6 +273,7 @@ main () { "bill_data" "alert_log" "rrd_purge" + "ports_fdb" "ports_purge"); call_daily_php "${options[@]}"; ;; diff --git a/database/migrations/2019_02_10_220000_add_dates_to_fdb.php b/database/migrations/2019_02_10_220000_add_dates_to_fdb.php new file mode 100644 index 0000000000..ef864d63e7 --- /dev/null +++ b/database/migrations/2019_02_10_220000_add_dates_to_fdb.php @@ -0,0 +1,39 @@ +timestamps(); + }); + + // Let's get a value for existing PortsFdb data : + DB::table('ports_fdb')->update(array('created_at' => \Carbon\Carbon::now())); + DB::table('ports_fdb')->update(array('updated_at' => \Carbon\Carbon::now())); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('ports_fdb', function (Blueprint $table) { + $table->dropColumn('created_at'); + $table->dropColumn('updated_at'); + }); + } +} diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index b7bbe22b87..a47caa21da 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -629,9 +629,11 @@ $config['eventlog_purge'] = 30; $config['authlog_purge'] = 30; $config['perf_times_purge'] = 30; $config['device_perf_purge'] = 7; +$config['alert_log_purge'] = 365; +$config['port_fdb_purge'] = 10; $config['rrd_purge'] = 90;// Not set by default ``` -These options will ensure data within LibreNMS over X days old is automatically purged. You can alter these individually, +These options will ensure data within LibreNMS over X days old is automatically purged. You can alter these individually. values are in days. > NOTE: Please be aware that `$config['rrd_purge']` is _NOT_ set by default. This option will remove any old data within diff --git a/doc/Support/Discovery Support.md b/doc/Support/Discovery Support.md index 565a3f4753..b16d9f4152 100644 --- a/doc/Support/Discovery Support.md +++ b/doc/Support/Discovery Support.md @@ -143,6 +143,8 @@ $config['os']['linux']['discovery_modules']['discovery-arp'] = true; `arp-table`: Detection of the ARP table for the device. +`fdb-table`: Detection of the Forwarding DataBase table for the device, with history data. + `discovery-arp`: Auto discovery via ARP. `junose-atm-vp`: Juniper ATM support. diff --git a/doc/Support/Features.md b/doc/Support/Features.md index 00c9b09e4e..c2d6cf9eb4 100644 --- a/doc/Support/Features.md +++ b/doc/Support/Features.md @@ -5,11 +5,13 @@ path: blob/master/doc/ Here's a brief list of supported features, some might be missing. If you think something is missing, feel free to ask us. +* Auto discovery * Alerting -* API -* Auto Updating +* Multiple environnement sensors support +* Multiple protocols data collection (STP, OSPF, BGP etc) +* VLAN, ARP and FDB table collection * Customizable Dashboards -* Device Backup (Oxidized, RANCID) +* Device Backup integration (Oxidized, RANCID) * Distributed Polling * Multiple Authentication Methods (MySQL, LDAP, Active Directory, HTTP) * NetFlow, sFlow, IPFIX (NfSen) @@ -17,6 +19,8 @@ If you think something is missing, feel free to ask us. * Syslog (Integrated, Graylog) * Traffic Billing (Quota, 95th Percentile) * Two Factor Authentication +* API +* Auto Updating ### Vendors Here's a brief list of supported vendors, some might be missing. @@ -34,6 +38,7 @@ If you are unsure of whether your device is supported or not, feel free to ask u * Areca * Arista * Aruba +* Audiocodes * Avaya * Avocent * AVTECH @@ -42,6 +47,7 @@ If you are unsure of whether your device is supported or not, feel free to ask u * BCM963 * BDCom * Bintec +* Bluecat * BNT * Brocade * Brother @@ -62,7 +68,9 @@ If you are unsure of whether your device is supported or not, feel free to ask u * Dell * Delta Power Solutions * DEVELOP +* DKT Comega * Eaton +* EDS * EMC * Engenius * Enterasys @@ -70,6 +78,7 @@ If you are unsure of whether your device is supported or not, feel free to ask u * Extreme Networks * F5 * Fastback Networks +* Fiberstore * FiberHome * Force10 * Fortinet @@ -108,6 +117,7 @@ If you are unsure of whether your device is supported or not, feel free to ask u * Netopia * NetVision * NetWare +* Nokia * NRG * OKI * OpenBSD diff --git a/html/pages/device/port/fdb.inc.php b/html/pages/device/port/fdb.inc.php index 4df7ede518..5f2bcbd9c0 100644 --- a/html/pages/device/port/fdb.inc.php +++ b/html/pages/device/port/fdb.inc.php @@ -9,6 +9,8 @@ $no_refresh = true;