Hi Guys (and Gals),
Due to a recent change in our network we need to rename all of our cisco switches with a new naming convention. Our current convention goes like this:
This is spread across the whole campus so new switches have more recent numbers, but can be located in ANY building. So we have decided to change the naming convention so we know where a switch is based on the hostname.
So the new convention goes something like this:
BA45-002 - All for building A
BG150-002 - All for building G
The numbers represent the final two octets of the IP address of the switch, the first two are predefined. So for example BA45-001 has an IP of 10.15.45.1 and BG150-003 would have a IP of 10.15.150.3
At the moment I have to rename them manually and after about an hour change the IP address, this is because it takes a while for the hostname to update on the system.
Is there an easier way to do this?
Solved! Go to Solution.
There sure is an easy way. Export custom properties including nodeid and caption as excel. Do a find and replace for everything. So if C12 becomes BA150 just do the replace. It's excel so you can get as complicated as you want. Then do an index match to the new ip addresses. After that just write a SQL update statement in a formula like ="update nodes set ip_address='"&A1&"' where nodeid ="&B1
Copy that formula for every row and put the resulting update statements into SMSS.
Keep in mind that modifying the database can trash your whole system so take care. The entire change would take a few hours using this process. Let me know if you want some help
This changes the name in Orion, but doesn't affect the nodes themselves. As I read the original question, I believe Euan wants to change the actual hostname on the device.
I have the same need based on similar criteria. I have a change where all the switches need one letter changed due to a naming standards "realignment". I have access switches that are named ANxxxxx-## or APxxxxx-## that now need to be ABxxxxx-##.
Can this be scripted in NCM?
First you need to get the new names into a custom property (use excel) and then just use a config change template to apply the name. This may be possible with a standard NCM script, but I personally only use those for things without variables. You could even extract your 3rd and 4th octets into custom proprieties and build the name within the config change template, but that may be more hassle than it is worth since you would have to take steps to ensure that names weren't used twice, but if the information is already in your custom properties it may save you time. Below is a config change template that passes validation that may do what you need (please test and verify everything before using as this was made with the basic information your provided). If you remove the string manipulation you could easily have it just push what is in a custom property. Custom properties I used below are: Campus, Building, Octet3, Octet4. Please let me know if this helps.
This change template changes the device name in a specific way.
cisco, eigrp, ios, netflow, routing
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.
script ChangeName (
string @NewName = @ContextNode.Campus + @ContextNode.Building
@NewName = @NewName + @ContextNode.Octet3
@NewName = @NewName + '-'
@NewName = @NewName + @ContextNode.Octet4
I wanted to update my response with how I did my name update back in 2018.
A couple of points:
All in all it was very easy (if a bit tedious) and was an interesting challenge.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process. Learn more today by joining now.