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.
Pulling the "interface description" field dynamically
Re: Pulling the "interface description" field dynamically
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
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.
You do not have the required permissions to view the files attached to this post.
Re: Pulling the "interface description" field dynamically
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.
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
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
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.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.
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.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
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.
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
Thank you for the input, we appreciate tips like this greatlyatlantic 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.
Re: Pulling the "interface description" field dynamically
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.
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
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!