The -g, --gf_dashboard
command line option is designed to automate the generation of Grafana dashboards with all it's rules from your YAML configuration files. When using this option, it is important to note the following specifics:
- Ports are showing up and down (red/green)
- Links are showing it's bandwidth + colors for utilization
- All trafic is outgoing metric
- Grafana Version: Works optimally with Grafana version >10.0.0. Recomendation: 11.2.0.
- Plugin Requirement: It requires the Flowcplugin Flow plugin. This plugin is essential for rendering the custom visualizations generated by the script.
To generate a dashboard, execute the following command:
python clab2drawio.py -i <path_to_your_yaml_file> -g --theme grafana_dark
Ensure that you replace <path_to_your_yaml_file>
with the actual path to your YAML configuration file. Use it with grafana_dark or your own grafana compatible theme.
When the -g
flag is used, the script generates the following:
- Grafana dashboard JSON file
- Panel YAML configuration file
- draw.io diagram
To get a full guide: https://github.com/andymchugh/andrewbmchugh-flow-panel/blob/main/src/README.md#using-drawio-to-create-your-svg
- Open the generated draw.io diagram using the draw.io application with the svgdata plugin enabled, or use the online version at https://app.diagrams.net/?p=svgdata.
- Go to File -> Export -> SVG to export the diagram as an SVG file.
The generated dashboard JSON will include the panel configuration but without the SVG data. To complete the dashboard, you need to either:
- Copy and paste the SVG data into the designated SVG box in the Grafana dashboard editor.
- Upload the SVG file to a hosting service and reference the URL in the Grafana dashboard editor.
By following these steps, you can generate a complete Grafana dashboard with the diagram, panel configuration, and dashboard JSON file.
- Hardcoded Queries: Currently, the dashboard queries are hardcoded and are specifically optimized for Nokia's SRLinux and SROS platforms. This means they may not be directly applicable to other environments without modifications.
- Data Sources: The dashboard assumes specific data sources (Prometheus) are already configured in your Grafana instance that align with the hardcoded queries.
Recommended gnmic.yaml Configuration for SROS and SRL (Click to expand)
username: admin
password: *******
insecure: true
log: true
common_sros_subscriptions: &common_sros_subs
insecure: true
password: ******
subscriptions:
- sros-if-stats
- sros-bgp-stats
- sros-service-stats
common_srl_subscriptions: &common_srl_subs
port: 57400
skip-verify: true
insecure: false
password: *******
subscriptions:
- srl-if-stats
- srl-bgp
- srl-system-performance
- srl-routes
- srl-bridge
- srl-apps
- srl-net-instance
targets:
dc1-l1: *common_srl_subs
dc1-l2: *common_srl_subs
dc1-l3: *common_srl_subs
dc1-l4: *common_srl_subs
dc1-s1: *common_srl_subs
dc1-s2: *common_srl_subs
dc2-l1: *common_srl_subs
dc2-l2: *common_srl_subs
dc2-l3: *common_srl_subs
dc2-l4: *common_srl_subs
dc2-s1: *common_srl_subs
dc2-s2: *common_srl_subs
wan1: *common_sros_subs
wan2: *common_sros_subs
dc1_dcgw1: *common_sros_subs
dc2_dcgw2: *common_sros_subs
dc2_dcgw1: *common_sros_subs
dc1_dcgw2: *common_sros_subs
subscriptions:
## SROS ###
sros-if-stats:
paths:
- /state/port[port-id=*]/oper-state
- /state/port[port-id=*]/ethernet/statistics
mode: stream
stream-mode: sample
sample-interval: 1s
sros-bgp-stats:
paths:
- /state/router[router-name=*]/bgp/statistics/peers
- /state/router[router-name=*]/bgp/neighbor[ip-address=*]/statistics/session-state
- /state/router[router-name=*]/bgp/neighbor[ip-address=*]/statistics/family-prefix/ipv4
- /state/router[router-name=*]/bgp/neighbor[ip-address=*]/statistics/family-prefix/evpn
mode: stream
stream-mode: sample
sample-interval: 5s
sros-service-stats:
paths:
- /state/service/vpls[service-name=*]/oper-state
- /state/service/vprn[service-name=*]/oper-state
mode: stream
stream-mode: sample
sample-interval: 5s
srl-system-performance:
mode: stream
stream-mode: sample
sample-interval: 5s
paths:
- /platform/control[slot=*]/cpu[index=all]/total
- /platform/control[slot=*]/memory
srl-if-stats:
mode: stream
stream-mode: sample
sample-interval: 3s
paths:
- /interface[name=ethernet-1/*]/oper-state
- /interface[name=ethernet-1/*]/statistics
- /interface[name=ethernet-1/*]/traffic-rate
srl-routes:
mode: stream
stream-mode: sample
sample-interval: 5s
paths:
- /network-instance[name=*]/route-table/ipv4-unicast/statistics/
- /network-instance[name=*]/route-table/ipv6-unicast/statistics/
srl-bgp:
mode: stream
stream-mode: sample
sample-interval: 5s
paths:
- /network-instance[name=*]/protocols/bgp/statistics
srl-bridge:
mode: stream
stream-mode: sample
sample-interval: 5s
paths:
- /network-instance[name=*]/bridge-table/statistics/
srl-apps:
paths:
- /system/app-management/application[name=*]
mode: stream
stream-mode: sample
sample-interval: 5s
srl-net-instance:
paths:
- /network-instance[name=*]/oper-state
mode: stream
stream-mode: sample
sample-interval: 5s
outputs:
prom-output:
type: prometheus
#listen: "gnmic:9804"
listen: :9273
# export-timestamps: true
#service-registration:
# address: consul:8500
event-processors:
- trim-prefixes
- rename-port-sros
- rename-port-value-sros
- rename-srl-interface
- oper-state-to-int
processors:
trim-prefixes:
event-strings:
value-names:
- "^/state/.*"
transforms:
- trim-prefix:
apply-on: "name"
prefix: "/state/"
oper-state-to-int:
event-strings:
value-names:
- ".*"
transforms:
- replace:
apply-on: "value"
old: "up"
new: "1"
- replace:
apply-on: "value"
old: "down"
new: "0"
rename-port-sros:
event-strings:
tag-names:
- "^port_port-id"
transforms:
- replace:
apply-on: "name"
old: "port_port-id"
new: "interface_name"
rename-port-value-sros:
event-strings:
tag-names:
- "^interface_name"
transforms:
- replace:
apply-on: "value"
old: ".*/c(\\d+)(/\\d+)?"
new: "eth$1"
rename-srl-interface:
event-strings:
tag-names:
- "^interface_name"
transforms:
- replace:
apply-on: "value"
old: "ethernet-(\\d+)/(\\d+)"
new: "e$1-$2"
- Configurable Queries: Plans are in place to enhance this feature by allowing users to configure dashboard queries through a YAML config file. This will enable a more flexible and dynamic approach to adapting the dashboards for different environments and requirements.
Feedback and contributions are welcome to help advance this feature towards a more robust and flexible implementation. If you are interested in contributing or have suggestions, please refer to the project's contribution guidelines or submit an issue on the project's GitHub repository.