librenms / librenms-agent

LibreNMS Agent & Scripts
GNU General Public License v2.0
116 stars 187 forks source link

SMART Application URLs Broken when Slashes are in Device Names #499

Open bnerickson opened 7 months ago

bnerickson commented 7 months ago

@VVelox for visibility

When the SMART application is used to parse MegaRAID devices, the device names returned are in the format bus/x,y where I believe x is number designated to the RAID card on Linux and y is the attachment point number of an HDD on said card assigned by Linux. Here's partial output of /etc/snmp/smart -g on a system with a single attached RAID card with 6 hard drives connected to the card.

...
bus/0,0 /dev/bus/0 -d sat+megaraid,18
bus/0,1 /dev/bus/0 -d sat+megaraid,19
bus/0,2 /dev/bus/0 -d sat+megaraid,20
bus/0,3 /dev/bus/0 -d sat+megaraid,21
bus/0,4 /dev/bus/0 -d sat+megaraid,22
bus/0,5 /dev/bus/0 -d sat+megaraid,23

Everything is parsed by the application appropriately, however, the individual URLs for the bus devices are broken. Here's a sample URL to load the bus/0,0 device: https://librenms/device/device=73/tab=apps/app=smart/disk=bus%2F0%2C0/

There might need to be some logic handling the case where device names have forward-slashes or weird characters in their names.

VVelox commented 7 months ago

@bnerickson Ohh! Thanks. Not seen them show up like that before. Thanks!

I'll get that updated to convert / to _.

Setting useSN=1 should also fix this, will double check that later.