New DB fields for Ports table

===========================================

Component Version
LibreNMS 23.8.2-20-g298d217a8 (2023-08-30T14:11:04-05:00)
DB Schema 2023_06_18_201914_migrate_level_to_roles (257)
PHP 8.2.3
Python 3.9.14
Database MariaDB 10.5.16-MariaDB
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.5.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
includes/definitions/discovery/iosxe.yaml
includes/discovery/ports.inc.php

Our university has a jack lookup tool for users to easily look up info about their network jack (VLAN, status, VoIP, MAC address, etc.) via a web page. There are two data points they want that Libre doesn’t provide built-in: max number of MAC addresses, and if sticky MACs is enabled. As a test I added the below lines to ports.inc.php to see if I could get the data. I was able to successfully get the data, but not surprisingly it couldn’t write to the DB during discovery because the fields don’t exist. Is there a way to add the fields to the DB without breaking validation, or does this need to be a PR? Any other recommendations are welcome.

$port_stats = snmpwalk_cache_oid($device, ‘cpsIfStickyEnable’, $port_stats, ‘CISCO-PORT-SECURITY-MIB’, ‘cisco’);

$port_stats = snmpwalk_cache_oid($device, ‘cpsIfMaxSecureMacAddr’, $port_stats, ‘CISCO-PORT-SECURITY-MIB’, ‘cisco’);

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘cpsIfStickyEnable’ in ‘field list’ (Connection: mysql, SQL: UPDATE ports set ifDescr=TenGigabitEthernet1/1,ifName=Te1/1,ifAlias=TenGigabitEthernet1/1,ifType=ethernetCsmacd,ifOperStatus=down,cpsIfStickyEnable=false,cpsIfMaxSecureMacAddr=1,ifIndex=1 WHERE port_id = 1)

You are already modifying your install, why do you care about database validation in that case?

If you really wanted you could update the file used for validation to match: misc/db_schema.yaml

It’s called testing dude. This is on a test instance of Libre. We want to have this data available in the DB, but still want to receive updates and have clean checks. That’s also why I asked if this will need to be a pull request in case this needs to be part of the official install.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.