-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
99 changed files
with
6,912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
CISCO SAMPLE CODE LICENSE | ||
Version 1.1 | ||
Copyright (c) 2021 Cisco and/or its affiliates | ||
|
||
These terms govern this Cisco Systems, Inc. ("Cisco"), example or demo | ||
source code and its associated documentation (together, the "Sample | ||
Code"). By downloading, copying, modifying, compiling, or redistributing | ||
the Sample Code, you accept and agree to be bound by the following terms | ||
and conditions (the "License"). If you are accepting the License on | ||
behalf of an entity, you represent that you have the authority to do so | ||
(either you or the entity, "you"). Sample Code is not supported by Cisco | ||
TAC and is not tested for quality or performance. This is your only | ||
license to the Sample Code and all rights not expressly granted are | ||
reserved. | ||
|
||
1. LICENSE GRANT: Subject to the terms and conditions of this License, | ||
Cisco hereby grants to you a perpetual, worldwide, non-exclusive, non- | ||
transferable, non-sublicensable, royalty-free license to copy and | ||
modify the Sample Code in source code form, and compile and | ||
redistribute the Sample Code in binary/object code or other executable | ||
forms, in whole or in part, solely for use with Cisco products and | ||
services. For interpreted languages like Java and Python, the | ||
executable form of the software may include source code and | ||
compilation is not required. | ||
|
||
2. CONDITIONS: You shall not use the Sample Code independent of, or to | ||
replicate or compete with, a Cisco product or service. Cisco products | ||
and services are licensed under their own separate terms and you shall | ||
not use the Sample Code in any way that violates or is inconsistent | ||
with those terms (for more information, please visit: | ||
www.cisco.com/go/terms). | ||
|
||
3. OWNERSHIP: Cisco retains sole and exclusive ownership of the Sample | ||
Code, including all intellectual property rights therein, except with | ||
respect to any third-party material that may be used in or by the | ||
Sample Code. Any such third-party material is licensed under its own | ||
separate terms (such as an open source license) and all use must be in | ||
full accordance with the applicable license. This License does not | ||
grant you permission to use any trade names, trademarks, service | ||
marks, or product names of Cisco. If you provide any feedback to Cisco | ||
regarding the Sample Code, you agree that Cisco, its partners, and its | ||
customers shall be free to use and incorporate such feedback into the | ||
Sample Code, and Cisco products and services, for any purpose, and | ||
without restriction, payment, or additional consideration of any kind. | ||
If you initiate or participate in any litigation against Cisco, its | ||
partners, or its customers (including cross-claims and counter-claims) | ||
alleging that the Sample Code and/or its use infringe any patent, | ||
copyright, or other intellectual property right, then all rights | ||
granted to you under this License shall terminate immediately without | ||
notice. | ||
|
||
4. LIMITATION OF LIABILITY: CISCO SHALL HAVE NO LIABILITY IN CONNECTION | ||
WITH OR RELATING TO THIS LICENSE OR USE OF THE SAMPLE CODE, FOR | ||
DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO DIRECT, INCIDENTAL, | ||
AND CONSEQUENTIAL DAMAGES, OR FOR ANY LOSS OF USE, DATA, INFORMATION, | ||
PROFITS, BUSINESS, OR GOODWILL, HOWEVER CAUSED, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGES. | ||
|
||
5. DISCLAIMER OF WARRANTY: SAMPLE CODE IS INTENDED FOR EXAMPLE PURPOSES | ||
ONLY AND IS PROVIDED BY CISCO "AS IS" WITH ALL FAULTS AND WITHOUT | ||
WARRANTY OR SUPPORT OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY | ||
LAW, ALL EXPRESS AND IMPLIED CONDITIONS, REPRESENTATIONS, AND | ||
WARRANTIES INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OR | ||
CONDITION OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON- | ||
INFRINGEMENT, SATISFACTORY QUALITY, NON-INTERFERENCE, AND ACCURACY, | ||
ARE HEREBY EXCLUDED AND EXPRESSLY DISCLAIMED BY CISCO. CISCO DOES NOT | ||
WARRANT THAT THE SAMPLE CODE IS SUITABLE FOR PRODUCTION OR COMMERCIAL | ||
USE, WILL OPERATE PROPERLY, IS ACCURATE OR COMPLETE, OR IS WITHOUT | ||
ERROR OR DEFECT. | ||
|
||
6. GENERAL: This License shall be governed by and interpreted in | ||
accordance with the laws of the State of California, excluding its | ||
conflict of laws provisions. You agree to comply with all applicable | ||
United States export laws, rules, and regulations. If any provision of | ||
this License is judged illegal, invalid, or otherwise unenforceable, | ||
that provision shall be severed and the rest of the License shall | ||
remain in full force and effect. No failure by Cisco to enforce any of | ||
its rights related to the Sample Code or to a breach of this License | ||
in a particular situation will act as a waiver of such rights. In the | ||
event of any inconsistencies with any other terms, this License shall | ||
take precedence. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<div align="center"> | ||
<img width="300" src="images/logo/johann-logo-full.png"> | ||
</div> | ||
<p align="center"> | ||
<a href="https://developer.cisco.com/codeexchange/github/repo/flopach/johann-network-device-monitoring"> | ||
<img src="https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-published.svg" alt="DevNet Published"> | ||
</a> | ||
</p> | ||
|
||
**johann** is a web-based network device monitoring tool for **Cisco IOS XE devices**. Collect configuration and operational data of your networking devices in a structured way in one single database! | ||
|
||
![](images/johann-teaser.png) | ||
|
||
**Get an Overview in this [YouTube Video](https://www.youtube.com/watch?v=MLNEQePZyKs)!** | ||
|
||
## Features | ||
|
||
* Add single or multiple devices (.csv file) at once to the johann SQLite database | ||
* Show device information on a structured web-dashboard | ||
* Update all device information | ||
* Show simple report graphs | ||
* Export database as .xlsx | ||
* Toolset: | ||
* Enable RESTCONF on a single IOS XE device | ||
* Test RESTCONF: Get current configuration in JSON format | ||
* Show logs | ||
|
||
### Supported Devices | ||
|
||
* ASR 1000 | ||
* ASR 900 RSP2/RSP3, ASR 920, NCS 520 and NCS 4200 | ||
* Catalyst 9200,9300,9400,9500,9600,9800 | ||
* Catalyst 8000V | ||
* CSR 1000v | ||
* ESS 3x00 | ||
* IR 1101 | ||
* IE 3x00 | ||
* ISR 1000 | ||
* ISR 4000 | ||
|
||
## Installation | ||
|
||
johann is easy installable with Docker Compose! Just copy & paste into terminal: | ||
|
||
``` | ||
git clone https://github.com/flopach/johann-network-device-monitoring && | ||
cd johann-network-device-monitoring/docker/ && | ||
docker-compose up | ||
``` | ||
|
||
After nginx has started, you can access the web-dashboard via [http://localhost](http://localhost). | ||
|
||
## Demo GIF | ||
|
||
![](images/johann-0.1.0-gif.gif) | ||
|
||
*(size: 11MB)* | ||
|
||
## Screenshots | ||
|
||
| | | | | ||
|:-------------------------:|:-------------------------:|:-------------------------:| | ||
|![](images/scr_add.png) | ![](images/scr_all.png) | ![](images/scr_detail.png) | | ||
|![](images/scr_detail2.png) | ![](images/scr_report.png) |![](images/scr_json.png) | | ||
|
||
## FAQs | ||
|
||
**Are only IOS XE devices supported?** - For now, yes only IOS XE devices. | ||
|
||
**What YANG modules do you use?** - Cisco IOS-XE native YANG models only. | ||
|
||
**johann does not get _______ operational/configuration data!** - Feel free to add it or send a feature request. | ||
|
||
**Why is some information empty in the johann database?** - The RESTCONF interface of the device did not provide this information. | ||
|
||
**What is the password for Database admin?** - You can set the Django superuser in the ./docker/johann/Dockerfile. The default is admin/admin123 to acess the database. | ||
|
||
**johann does not support ______ !** - Please put in a feature request of feel free to add this feature! | ||
|
||
**When stopping Docker, what data will be saved? And where?** - The whole SQLite database and .log file will be saved in `docker/johann/stickydata/`. | ||
|
||
## Known Limitations | ||
|
||
* Currently, only timezone UTC is supported | ||
* Devices can only be deleted via Django Database Manager | ||
* Passwords are not encrypted in the database | ||
|
||
## Technical Deep-Dive | ||
|
||
**High-level architecture** | ||
|
||
![](images/high-level-architecture.png) | ||
|
||
**Sequence diagram for adding devices** | ||
|
||
![](images/sequencediagram_add_device.png) | ||
|
||
## Built With | ||
|
||
* Django + Django Channels | ||
* Redis | ||
* [Cisco UI Kit](https://developer.cisco.com/site/uiux/) | ||
* jQuery | ||
* Featured Python Libraries: Requests, Netmiko (just for enabling RESTCONF), Matplotlib | ||
|
||
## Versioning | ||
|
||
**0.1.0** - Initial Release | ||
|
||
## Authors | ||
|
||
* **Florian Pachinger** - *Initial work* - [flopach](https://github.com/flopach) | ||
|
||
## License | ||
|
||
This project is licensed under the Cisco Sample Code License 1.1 - see the [LICENSE.md](LICENSE.md) file for details | ||
|
||
## Further Links | ||
|
||
* [Cisco DevNet Website](https://developer.cisco.com) | ||
* [YouTube Video](https://www.youtube.com/watch?v=MLNEQePZyKs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
johann: Network Device Monitoring | ||
===================================== | ||
|
||
**johann** is a web-based network device monitoring tool for **Cisco IOS XE devices**. Collect configuration and operational data of your networking devices in a structured way in one single database! | ||
|
||
![](images/johann-teaser.png) | ||
|
||
**Get a more detailed overview in this [YouTube Video](https://www.youtube.com/watch?v=MLNEQePZyKs)!** | ||
|
||
## Demo GIF | ||
|
||
![](images/johann-0.1.0-gif.gif) | ||
|
||
## High Level Architecture | ||
|
||
![](images/high-level-architecture.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# CISCO SAMPLE CODE LICENSE | ||
# Version 1.1 | ||
# Copyright (c) 2021 Cisco and/or its affiliates | ||
|
||
version: '3.8' | ||
services: | ||
|
||
redis: | ||
image: redis:6.2.3-alpine | ||
restart: always | ||
|
||
johann: | ||
build: ${PWD}/johann/. | ||
restart: on-failure | ||
volumes: | ||
- static_content:/opt/johann/static/ #shared volume for static files | ||
- ./johann/stickydata:/opt/johann/stickydata #for saving tmp files | ||
depends_on: | ||
- redis | ||
|
||
celery_worker: | ||
build: ${PWD}/johann/. | ||
command: celery -A johann worker -l INFO | ||
restart: on-failure | ||
volumes: | ||
- ./johann/stickydata:/opt/johann/stickydata #for saving tmp files | ||
depends_on: | ||
- redis | ||
|
||
nginx: | ||
build: ${PWD}/nginx/. | ||
restart: always | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- static_content:/static #shared volume for static files | ||
depends_on: | ||
- johann | ||
- redis | ||
|
||
volumes: | ||
static_content: | ||
stickydata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# CISCO SAMPLE CODE LICENSE | ||
# Version 1.1 | ||
# Copyright (c) 2021 Cisco and/or its affiliates | ||
|
||
# Dockerfile for johann Django app | ||
|
||
FROM python:3.9-slim | ||
|
||
RUN mkdir -p /opt/johann/ | ||
COPY . /opt/johann/ | ||
|
||
WORKDIR /opt/johann | ||
|
||
RUN mkdir -p ./stickydata | ||
|
||
ENV PYTHONUNBUFFERED=0 | ||
ENV SECRET_KEY=cFRXsdHd2K20lRewWXV5vjbxOWousmGE | ||
ENV DJANGO_SETTINGS_MODULE=johann.settings_production | ||
ENV [email protected] | ||
ENV DJANGO_SUPERUSER_USERNAME=admin | ||
ENV DJANGO_SUPERUSER_PASSWORD=admin123 | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install -r requirements.txt | ||
|
||
RUN chmod +x ./start_johann.sh | ||
CMD ./start_johann.sh | ||
|
||
EXPOSE 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .celery import app as celery_app | ||
|
||
__all__ = ('celery_app',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
ASGI config for johann project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from channels.routing import ProtocolTypeRouter, URLRouter | ||
from django.core.asgi import get_asgi_application | ||
asgi_application = get_asgi_application() | ||
|
||
from channels.auth import AuthMiddlewareStack | ||
from channels.security.websocket import AllowedHostsOriginValidator | ||
import main.routing | ||
|
||
application = ProtocolTypeRouter({ | ||
"http": asgi_application, | ||
"websocket": AllowedHostsOriginValidator( | ||
AuthMiddlewareStack( | ||
URLRouter( | ||
main.routing.websocket_urlpatterns | ||
) | ||
) | ||
), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
from celery import Celery | ||
|
||
# set the default Django settings module for the 'celery' program. | ||
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'johann.settings_production') | ||
|
||
app = Celery('johann') | ||
|
||
# Celery settings are in settings.py using a `CELERY_` prefix. | ||
app.config_from_object('django.conf:settings', namespace='CELERY') | ||
|
||
# Load task modules from all registered Django app configs. | ||
app.autodiscover_tasks() | ||
|
||
|
||
@app.task(bind=True) | ||
def debug_task(self): | ||
print(f'Request: {self.request!r}') |
Oops, something went wrong.