NetBox Zero To Hero - Video 11 - Custom Scripts

preview_player
Показать описание

Now it's time for the Brisbane office to 'go live', so Eric is going to use a custom script to Update the status of the Site, and all Locations, Racks, Devices, Clusters and VMs at the site from `Planned` to `Active`. Using a script to do this will be much quicker and more convenient than having to go into each section of the NetBox UI to update the status of all the objects. He can simply run the script to update everything in a couple of seconds!

Eric's boss has also just informed him that a new branch office is planned for Stockholm, Sweden and that he should plan for this also. As the company has standardized on the same network equipment for all branch office locations, Eric is going to use another Custom Script to create the planned site, as well as the network devices that he is planning to deploy there.

By the end of this module you will be able to:
- Describe what Custom Scripts are in NetBox and what kind of tasks they can be used to accomplish
- Understand the basics of writing Custom Scripts and also where to find documentation to help you develop your own scripts
- Kick start your own Custom Scripts collection, with two example scripts to get you up and running

Get Hands On
If you'd like to follow along with the examples used in this course, it's super easy to do, and you have a few options:

Join the Discussion

Useful Links
Рекомендации по теме
Комментарии
Автор

Wow, thank you! Now I understand the value of custom scripts. It was great to see them put into action, thank you for providing the sample code.

seand
Автор

Thank you so much for doing these easy-to-follow videos! This is the first I've seen, but I'm going to check out your other videos as well. I'm still new at python but I figure playing around with custom scripts in netbox will be a good learning opportunity for me - as I have a few good usecases I want to be implemented

CupcakePWR
Автор

Thanks for the example scripts they are very helpful.

I've noticed a slight error on the new branch script.

When creating the AP's and Servers, the log message is outputting the name of the routers.
this is due to self.log_success(f"Created new AP: {router}") on lines 94 and 107.

This should be: self.log_success(f"Created new AP: {ap}") and self.log_success(f"Created new server: {server}")

louisroyce
Автор

How I can see a decrypt secret in my custom script? My session has a session key, but secret.plaintext is None. I am try use secret.decrypt method with arg cookie but take error.

kazulka