No immediate answers, but working with what is already available, have you had a look at the inventory API? Inventory - LibreNMS Docs
Depending on your model/vendor you can sniff enough info sometimes - for example a Cisco C9300 with C9300-NM-8X module:
RJ45 port - cevPortBaseTEther
:
{
"entPhysical_id": 2041,
"device_id": 58,
"entPhysicalIndex": 1064,
"entPhysicalDescr": "Gi1\/0\/3",
"entPhysicalClass": "port",
"entPhysicalName": "Gi1\/0\/3",
"entPhysicalHardwareRev": "",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "false",
"entPhysicalModelName": "",
"entPhysicalVendorType": "cevPortBaseTEther",
"entPhysicalSerialNum": "",
"entPhysicalContainedIn": 1060,
"entPhysicalParentRelPos": 2,
"entPhysicalMfgName": "",
"ifIndex": 11
},
An SFP slot cevContainerSFP
:
"entPhysical_id": 2064,
"device_id": 58,
"entPhysicalIndex": 1087,
"entPhysicalDescr": "Te1\/1\/1 Container",
"entPhysicalClass": "container",
"entPhysicalName": "Te1\/1\/1 Container",
"entPhysicalHardwareRev": "",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "false",
"entPhysicalModelName": "",
"entPhysicalVendorType": "cevContainerSFP",
"entPhysicalSerialNum": "",
"entPhysicalContainedIn": 1086,
"entPhysicalParentRelPos": 0,
"entPhysicalMfgName": "",
"ifIndex": 0
},
What is in that SFP slot cevSFPH10GBCU1M
"entPhysical_id": 3045,
"device_id": 58,
"entPhysicalIndex": 1095,
"entPhysicalDescr": "SFP-10GBase-CX1",
"entPhysicalClass": "port",
"entPhysicalName": "Te1\/1\/1",
"entPhysicalHardwareRev": "V02",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "true",
"entPhysicalModelName": "SFP-H10GB-CU1M",
"entPhysicalVendorType": "cevSFPH10GBCU1M",
"entPhysicalSerialNum": "Gxxxxxxx-1",
"entPhysicalContainedIn": 1087,
"entPhysicalParentRelPos": 1,
"entPhysicalMfgName": "FS",
"ifIndex": 37
},
Granted you have to know what you’re looking at - to your point, this is a 10Gbit RJ45 port in an SFP slot cevSFP10GSR
:
{
"entPhysical_id": 4081,
"device_id": 58,
"entPhysicalIndex": 1127,
"entPhysicalDescr": "SFP-10GBase-SR",
"entPhysicalClass": "port",
"entPhysicalName": "Te1\/1\/8",
"entPhysicalHardwareRev": "V03",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "true",
"entPhysicalModelName": "SFP-10G-SR",
"entPhysicalVendorType": "cevSFP10GSR",
"entPhysicalSerialNum": "F2010380208",
"entPhysicalContainedIn": 1094,
"entPhysicalParentRelPos": 1,
"entPhysicalMfgName": "FS",
"ifIndex": 44
},