Hello all. The problem is Solarwinds support will not help me because they don't feel like it. I wrote a Config Change template to find a phone number in a Cisco port description and then replace that with an updated phone number. It works great, for some devices in NCM. About 50% of our devices, it will parse the script just fine, the other 50%, it won't parse the script. My question is, could there be some sort of backend database thing going on where the data is just not accurate in the database? Just for fun, I'll place my Config Change script here.
User enters the old phone number: 800-768-5220
User enters the new phone number: 833-938-1422
/*
.CHANGE_TEMPLATE_DESCRIPTION
This template updates an interface description due to Carrier Support Phone Changes.
.CHANGE_TEMPLATE_TAGS
Cisco, interface, description, properties
.PLATFORM_DESCRIPTION
Cisco IOS
.PARAMETER_LABEL @ContextNode
NCM node
.PARAMETER_DESCRIPTION @ContextNode
The node the template will operate on. All templates require this by default. The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.
.PARAMETER_LABEL @ExistingCarrierPhone
The existing phone number of the carrier.
.PARAMETER_DESCRIPTION @ExistingCarrierPhone
What is the existing carrier support phone number? If the existing phone number matches the trigger, a change config for the selected interface will be generated.
.PARAMETER_LABEL @NewCarrierPhone
The new phone number of the carrier.
.PARAMETER_DESCRIPTION @NewCarrierPhone
What is the new carrier support phone number?
*/
script ChangeInterfaceDescriptionBasedOnUserInput (
NCM.Nodes @ContextNode,
string @ExistingCarrierPhone,
string @NewCarrierPhone
)
{
CLI
{
configure terminal
}
int @MatchFound
@MatchFound = 0
// Variables defined just under the script
string @DescPrefix
int @Index
int @IntAliasLength
int @ExistingCarrierPhoneLength
// Loop through selected interfaces
foreach (@Interface in @ContextNode.Interfaces)
{
if (@Interface.InterfaceAlias contains @ExistingCarrierPhone)
{
@IntAliasLength = strlength(@Interface.InterfaceAlias)
@ExistingCarrierPhoneLength = strlength(@ExistingCarrierPhone)
@Index = IndexOf(@Interface.InterfaceAlias, @ExistingCarrierPhone)
@DescPrefix = substring(@Interface.InterfaceAlias, 1, @Index - 2)
if (@IntAliasLength - @ExistingCarrierPhoneLength != @Index - 1)
{
// Do Nothing. This if statement is checking to be sure that the phone
// number is located at the end of the interface description. If it is
// located somewhere in the middle, then we don't change the value.
CLI
{
AliasLength is @IntAliasLength
ExistingCarrierPhoneLength is @ExistingCarrierPhoneLength
Index is @Index
exit
}
}
else
{
// Set Command
CLI
{
interface @Interface.InterfaceDescription
description @DescPrefix @NewCarrierPhone
exit
}
}
}
}
CLI
{
End
wr
}
}

