Hi
I am having trouble with custom Interface Description Parsing.
I created my own parser:
librenms:/opt/librenms/includes/custom# ls -la
total 12
d-wx–x–x 2 nobody nogroup 4096 Apr 11 12:06 .
drwxr-xr-x 1 nobody nogroup 4096 Apr 11 12:06 .
-rw-r–r-- 1 nobody nogroup 746 Apr 11 22:55 my-port-descr-parser.inc.php
Next, in the config.php file, I specified where to look for my parser:
# custom int_descr_parsing
$config[‘port_descr_parser’] = “includes/custom/my-port-descr-parser.inc.php”;
The parser code is shown below.
<?php
// Parser should populate $port_ifAlias array with type, descr, circuit, speed and notes
unset($port_ifAlias);
echo $this_port['ifAlias'];
$split = preg_split('[#]', $this_port['ifAlias']);
$descr = isset($split[0]) ? trim($split[0], '/n/t') : null;
$type = isset($split[1]) ? trim($split[1], '/n/t') : null;
$circuit = "";
$notes = "";
$speed = "";
if ($type && $descr) {
$type = strtolower($type);
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = $speed;
$port_ifAlias['notes'] = $notes;
d_echo($port_ifAlias);
}
unset($type, $descr, $circuit, $notes, $speed, $split);
Description on the hardware has the following look:
xe-2/2/0.0 up up ISP #UPLINK#
I also did a comparison in WebGUI
But it still doesn’t display anything in the WebGUI.
Please tell me what I can do wrong.
Thank you!