Skip to content

Latest commit

 

History

History
227 lines (205 loc) · 6.94 KB

grafana.md

File metadata and controls

227 lines (205 loc) · 6.94 KB

Grafana Dashboard Generation Option

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. This feature is currently in a work-in-progress (WIP) stage. When using this option, it is important to note the following specifics:

Grafana

Features

  • Ports are showing up and down (red/green)
  • Links are showing it's bandwidth + colors for utilization
    • All trafic is outgoing metric

Compatibility

  • Grafana Version: This option is tailored to work optimally with Grafana version 10.3.5. Buggy from 10.4 upwords
  • Plugin Requirement: It requires the Flowcharting plugin version 1.0.0.e, which is available via a specific fork maintained by skyfrank on GitHub. This plugin is essential for rendering the custom visualizations generated by the script. Lower version also work, but this one is recommended

Usage

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.

Current Limitations

  • 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"

Future Enhancements

  • 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.

Contributing

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.