A Django reusable application that performs remote configurations on multiple devices, distributing the operations using Celery.
django-knob is available on PyPi and can be downloaded using pip
pip install django-knob
Add "knob" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'knob', )
Include the knob URLconf in your project urls.py like this:
knob requires you to add email configurations to your settings.py, make sure you at least set the variables EMAIL_BACKEND, EMAIL_HOST, and EMAIL_PORT to proper values.
You will need to setup Celery environment as explained in http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
Visit http://<domain>:<port>/knob/ to start the configurations.
- Probes each IP for SSH and Telnet support and uses SSH if available, else falls back to Telnet.
- A wizard that accepts common credentials, a list of IPs, and a list of commands to be executed on every device on the list.
- Sends a log email to the system admin, indicating both the errors and success operations.
- Providing an option to use a full Python environment. That makes it easy to perform more complex operations like doing regex operations and conditional decisions on the output.
How to Use
- Specify admin username, password and list of IP addresses then click next.
- In this step you have the option to either use a "fire and forget" approach where you throw commands to the devices without further processing, which can be useful in a case like modifying Access Control Lists (ACLs) with the same entry for a lot of devices. Here is an example of shutting down a Cisco device port.
- Or, you can turn the "Full Python Shell" button on and use the power of python to process the output of the commands and take conditional actions based on some or all of the outputs. You are provided with an object called device that has a method called execute, it's how you interact with the remote device. You can use regex library, use loops, conditions, and so forth. Here is an example of changing the directory on a linux machine, and creating 10 subdirectories named using python's string interpolation.
- Specify an email in order to send a log with all the succeeded and failed destinations along with the failure reason.
- Confirm and wait for the log email.
- Ability to provide external files as input.
- Ability to log custom output from remote operations.