Page 2 of 2

Re: Pulling the "interface description" field dynamically

Posted: Fri Feb 04, 2011 2:04 pm
by atlantic
Yes, the request you posted is exactly what I would expect.

When polling an interface, I would expect to see (for example)

GigabitEthernet1/1 as the port name and
"to server room" as a description.

Where now it would be

Port10002 as the port name and
GigabitEthernet1/1 as the description
"to server room" is dropped.

Re: Pulling the "interface description" field dynamically

Posted: Fri Feb 04, 2011 5:15 pm
by mguthrie
Ok, I'll take a look at modifying the switch wizard and post it when I get the changes made.

Re: Pulling the "interface description" field dynamically

Posted: Tue Feb 08, 2011 5:59 pm
by mguthrie
I don't have the hardware to let me custom define my port descriptions, so if you'd be willing to test this and let me know if it works I'd appreciate it.

Re: Pulling the "interface description" field dynamically

Posted: Fri Feb 11, 2011 8:29 am
by atlantic
The polling worked well. The only problem that you may want to tweak is normalize the description.

For example on the swtich I polled this is a valid descriptor.

'To->Admin Switch "

But when you reload I get this.

Error: The description string for service 'To->Admin Switch (xxxxxx) Bandwidth' on host 'swtch_test' contains one or more illegal characters.
Error: The description string for service 'To->Admin Switch (xxxxxx) Status' on host 'swtch_test' contains one or more illegal characters.

If you were to strip the invalid characters automatically that would be great.

Re: Pulling the "interface description" field dynamically

Posted: Fri Feb 11, 2011 8:47 am
by atlantic
Also, is there a way to "rediscover" interfaces after adding a switch? To look for newly added interfaces?

Re: Pulling the "interface description" field dynamically

Posted: Fri Feb 11, 2011 10:37 am
by mguthrie
For example on the swtich I polled this is a valid descriptor.

'To->Admin Switch "

But when you reload I get this.

Error: The description string for service 'To->Admin Switch (xxxxxx) Bandwidth' on host 'swtch_test' contains one or more illegal characters.
Error: The description string for service 'To->Admin Switch (xxxxxx) Status' on host 'swtch_test' contains one or more illegal characters.

If you were to strip the invalid characters automatically that would be great.
Was this the descriptor you got in the form field? Stripping the meta characters shouldn't be a big deal, I just want to make sure I'm cleaning the right data. If you could even send a screenshot that would be awesome. I don't have a switch to test on that will let me add user-defined descriptions.
Also, is there a way to "rediscover" interfaces after adding a switch? To look for newly added interfaces?
Currently we don't have this feature available, although you're not the first to request it. It's something we'll probably need to put on our TODO list.

Re: Pulling the "interface description" field dynamically

Posted: Fri Mar 11, 2011 11:37 am
by atlantic
in regards to the illegal characters.

Chaning line 362 (the line below) from
<input type="text" size="20" name="serviceargs[portname]['.$port_num.']" value="'.$port_name.'">

to

<input type="text" size="20" name="serviceargs[portname]['.$port_num.']" value="'.str_replace( array("<",">","(",")"), "", urldecode($port_name)).'">

seems to have done the trick for us if anyone else is interested.

Re: Pulling the "interface description" field dynamically

Posted: Fri Mar 11, 2011 5:46 pm
by rdedon
atlantic wrote:in regards to the illegal characters.

Changing line 362 (the line below) from
<input type="text" size="20" name="serviceargs[portname]['.$port_num.']" value="'.$port_name.'">

to

<input type="text" size="20" name="serviceargs[portname]['.$port_num.']" value="'.str_replace( array("<",">","(",")"), "", urldecode($port_name)).'">

seems to have done the trick for us if anyone else is interested.
Thank you for the input, we appreciate tips like this greatly :-)

Re: Pulling the "interface description" field dynamically

Posted: Fri Mar 18, 2011 10:33 am
by atlantic
I was digging in the switch.inc.php script a little more and the port number option you have listed may be better to use the $port_description variable there instead of the $port_number variable you use.

Actually what may be good is (if possible) to have the option of Port Number, Port Description or Both.

Here are the modifications I did to my script.

We added these lines

$short_port_description=str_replace('GigabitEthernet','GigE',$port_description);
$short_port_description=str_replace('FastEthernet','FastE',$short_port_description);

That was line 323 and 324. Which just shortens the length of the interface type.

Then modified line number 364 to read.

<input type="text" size="20" name="serviceargs[portname]['.$port_num.']" value="'.str_replace( array("<",">","(",")","&",":"), "", urldecode($short_port_description.'-'.$port_name)).'">

The end result is I am ending up with a description of the port to be something like this:

GigE2/5-To TACACS Server

So to summarize,

$port_description is a good varible to use as "Port Number"
$port_name would be good for "Port Name"
You can concantate those together and create a "Both" option.
$port _number can be dropped.

Which I feel any Networking person will agree is exactly the information they would need to see in the event of an outage.

Re: Pulling the "interface description" field dynamically

Posted: Mon Mar 21, 2011 11:22 am
by mguthrie
At some point I'll try and take a look at making these changes, we've made multiple revisions to it based on user suggestions. The $port_number variable still needs to remain as a key identifier to locate the performance data, but I'll have to dive back into that script a bit to remember how the rest of it comes together. Thanks for the input!