Hello,
For a while I’ve had an issue with interface parsing. I’ve written a custom interface parser and tested it successfully:
<?php
$str_teste = '\<CORE> descriptive/string/0/0 [10G] (NOTES GO HERE) {CIRCUIT GOES HERE}';
list(,$type, $descr) = preg_split('/[\<\>\[]/', $str_teste);
list(,$circuit) = preg_split('/[\{\}]/', $str_teste);
list(,$notes) = preg_split('/[\(\)]/', $str_teste);
list(,$speed) = preg_split('/[\[\]]/', $str_teste);
$descr = trim($descr);
echo "type: " . $type . "\</br>";
echo "descr: " . $descr . "\</br>";
echo "circuit: " . $circuit . "\</br>";
echo "speed: " . $speed . "\</br>";
echo "notes: " . $notes . "\</br>";
d_echo($port_ifAlias);
?>
This correctly outputs:
type: CORE</br>
descr: descriptive/string/0/0</br>
circuit: CIRCUIT GOES HERE</br>
speed: 10G</br>
notes: NOTES GO HERE</br>
My config.php contains the following line:
$config['port_descr_parser'] = "includes/custom/port-descr-parser.inc.php";
The file’s content is:
<?php
list(,$type, $descr) = preg_split('/[\<\>\[]/', $str_teste);
list(,$circuit) = preg_split('/[\{\}]/', $str_teste);
list(,$notes) = preg_split('/[\(\)]/', $str_teste);
list(,$speed) = preg_split('/[\[\]]/', $str_teste);
$descr = trim($descr);
echo "type: " . $type . "\</br>";
echo "descr: " . $descr . "\</br>";
echo "circuit: " . $circuit . "\</br>";
echo "speed: " . $speed . "\</br>";
echo "notes: " . $notes . "\</br>";
d_echo($port_ifAlias);
However for device 1, I can see that no parsing is being done, f I run the following query:
SELECT hostname, ifDescr, ifName, ifAlias, port_descr_type AS 'Type', port_descr_descr AS 'Description', port_descr_circuit AS 'Circuit', port_descr_speed AS 'Speed', port_descr_notes AS 'Notes' FROM ports, devices WHERE ports.device_id = devices.device_id AND devices.hostname LIKE '%erm-mse2%';
The snipped output is:
| devices.hostname | TenGigE0/0/0/3 | TenGigE0/0/0/3 | <CORE> text:Te2/1/0 [10G] (more text) | NULL | NULL | NULL | NULL | NULL |
Can anyone point me in the right direction for debugging this please?
Thank you