Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Jon_Dyke
Contributor

Bulk rename of host objects

I have a few hundred host objects that I need to rename.  The hosts are called site2_xxx_xxx  but need to be site3_xxx_xxx.  What would be the best way of doing this?  I am assuming the API is an option given I am on 80.10.

Thanks

Jon

5 Replies
Maik
Advisor

Hey,

Just add the necessary information to a csv file, set up the csv like this:

name, new-name

site2_xxx_xxx, site3_xxx_xxx

site2_xxx_yyy site3_xxx_yyy

site2_xxx_zzz, site3_xxx_zzz

and so on...

(Use quotation marks if the object names contain spaces)

Afterwards place the csv file on your SMS (or the management PC, which is used to access the SMS via the SmartConsole) and execute either

mgmt_cli set-host -b ./path/to/the/csv/file         => locally on the SMS

or

mgmt_cli.exe -m <ip_of_SMS> set-host -b ./path/to/the/csv/file    => from the client which has the SmartConsole installed, the mgmt_cli.exe can be found within the SmartConsole install directory. You can open it via cmd or PowerShell.

And that's basically it. If your SMS isn't the best regarding the hw itself (under 4GB of RAM) you will need to activate the API server first. This can be done via the SmartConsole itself or the cli ~ "api start". If you have 4GB+ of RAM it should be automatically enabled.

More information regarding the mentioned api command can be picked up here.

Hope that helps you Smiley Happy

Regards,

Maik

Jon_Dyke
Contributor

Thanks for that - I will give it a try.

Jon

0 Kudos
Rickard_K
Participant

I would test using the show-hosts API command to find and filter out all hosts with the name site2_xxx_xxx . Then I would run the edit-host API command and update each host in that list with it's new name site3_xxx_xxx. There is no need to build a CSV or similar with this approach if you just want to replace "site2" with "site3". 

0 Kudos
Maik
Advisor

Well of course you can use show-hosts in order to search for specific strings in the name and therefore build a list for the second command.

It's 'set-host' and not 'edit-host' to change a existing host object. The csv is used to change a bigger amount of hosts (which is the reason for this thread) instead of writing the command x times, where each one is used to change one object. The csv approach saves some work and gives a better overall overview.

Travis_Poole
Explorer

so is there something I'm missing I tried the csv example but when I ran it I got the following error

code: "generic_err_invalid_parameter_name"
message: "Unrecognized parameter  [site3]"

I tried playing around with the csv format comma, no comma; space , no space; quotes, no quotes;, etc.....  but always get pretty much the same error

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events