Page 1 of 1

Adjusting Network Switch / Router wizard

Posted: Mon Sep 14, 2015 1:04 pm
by CFT6Server
I have been working on adjusting the switch wizard so that it uses ifAlias instead of ifDescr. So when we run the wizard, we can use the Alias field when we choose to use Port Name. I've found the lines where this is done, but it doesn't seem to work. My understanding is that cfgmaker creates a temp cfg file and the wizard populates this. However, after making the changes below, cfgmaker is still using ifDescr instead of ifAlias.

Here are my changes:
Edit the file /usr/local/nagiosxi/html/includes/configwizards/switch/switch.inc.php and in switch_configwizard_get_cfgmaker_cmd I added extra argument to use ifAlias.

Code: Select all

$args[] = "--ifdesc=alias";
I checked the script and it grabs description from "/MRTG_INT_DESCR=".

But checking the temp mrtg cfg file looks like it is still using the ifdesrc value. For example:
"GigabitEthernet1/1"

If you scroll down a bit, the <description> part has the alias as part of the description.
<td>GigabitEthernet1/1 HPC OBA1 </td>

This means that at some point, it grabbed the alias. Perhaps I am not looking at the right spot and looking for some guidance to see how we can use ifAlias instead of fiDescr for port names.

Here's the data to help:
snmpwalk
IF-MIB::ifDescr.1 = STRING: GigabitEthernet1/1
IF-MIB::ifAlias.1 = STRING: HPC OBA1

Re: Adjusting Network Switch / Router wizard

Posted: Mon Sep 14, 2015 1:12 pm
by CFT6Server
To add to this, it seems like for that example, the wizard picked it up, but here's another example...
portname.JPG
IF-MIB::ifDescr.110 = STRING: TenGigabitEthernet4/1
IF-MIB::ifAlias.110 = STRING: "UCS Domain #2 FI-A po101 Eth1/17-20"

Re: Adjusting Network Switch / Router wizard

Posted: Mon Sep 14, 2015 3:58 pm
by ssax
The reason why this is failing is because you have a # in it, it fails on mine as well with that, I'm looking for a solution.

Re: Adjusting Network Switch / Router wizard

Posted: Mon Sep 14, 2015 4:06 pm
by ssax
Edit switch.inc.php (around line 1026) change this from:

Code: Select all

            // skip comments
            $pos=strpos($buf,"#");
            if($pos!==false)
                continue;
To:

Code: Select all

            // skip comments
            if (substr(trim($buf), 0, 1) == '#')
                continue;
That should get you up and running.