heanlan / grafana-chord-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grafana Chord Panel Plugin

What is Grafana Chord Panel Plugin?

Grafana Chord Panel Plugin enables users to create Chord Diagram panel in Grafana Dashboards. It is used to visualize the network connections. Connections with NetworkPolicy enforced will be highlighted. We use green color to highlight "allowed" traffic, red color to highlight "denied" traffic. Panels are the building blocks of Grafana. They allow you to visualize data in different ways. For more information about panels, refer to the documentation on Panels. An example of Chord Panel Plugin:

Chord Panel Plugin Example

Acknowledgements

The Chord Plugin is created using D3.js.

Data Source

Supported Databases:

  • ClickHouse

Queries Convention

Currently the Chord Plugin is created for restricted uses, only for visualizing network flows between the source and destination, with enforced NetworkPolicy metadata. To correctly loading data for the Chord Plugin, the query is expected to return the following fields, in arbitrary order.

  • field 1: value to group by with name or an alias of srcPod
  • field 2: value to group by with name or an alias of srcPort
  • field 3: value to group by with name or an alias of dstSvc
  • field 4: value to group by with name or an alias of dstSvcPort
  • field 5: value to group by with name or an alias of dstPod
  • field 6: value to group by with name or an alias of dstPort
  • field 7: value to group by with name or an alias of dstIP
  • field 8: the metric value field with an alias of bytes
  • field 9: the metric value field with an alias of revBytes
  • field 10: value to group by with name or an alias of egressNetworkPolicyName
  • field 11: value to group by with name or an alias of egressNetworkPolicyRuleAction
  • field 12: value to group by with name or an alias of ingressNetworkPolicyName
  • field 13: value to group by with name or an alias of ingressNetworkPolicyRuleAction

Clickhouse query example:

SELECT sourcePodName as srcPod,
destinationPodName as dstPod,
sourceTransportPort as srcPort,
destinationTransportPort as dstPort,
destinationServicePort as dstSvcPort,
destinationServicePortName as dstSvc,
destinationIP as dstIP,
SUM(octetDeltaCount) as bytes,
SUM(reverseOctetDeltaCount) as revBytes,
egressNetworkPolicyName,
egressNetworkPolicyRuleAction,
ingressNetworkPolicyName,
ingressNetworkPolicyRuleAction
from flows
GROUP BY srcPod, dstPod, srcPort, dstPort, dstSvcPort, dstSvc, dstIP, egressNetworkPolicyName, egressNetworkPolicyRuleAction, ingressNetworkPolicyName, ingressNetworkPolicyRuleAction

Installation

1. Install the Panel

Installing on a local Grafana:

For local instances, plugins are installed and updated via a simple CLI command. Use the grafana-cli tool to install sankey-panel-plugin from the commandline:

grafana-cli --pluginUrl https://downloads.antrea.io/artifacts/grafana-custom-plugins/grafana-chord-plugin-1.0.0.zip plugins install theia-grafana-sankey-plugin

The plugin will be installed into your grafana plugins directory; the default is /var/lib/grafana/plugins. More information on the cli tool.

Alternatively, you can manually download the .zip file and unpack it into your grafana plugins directory.

Download

Installing to a Grafana deployed on Kubernetes:

In Grafana deployment manifest, configure the environment variable GF_INSTALL_PLUGINS as below:

env:
- name: GF_INSTALL_PLUGINS
   value: "https://downloads.antrea.io/artifacts/grafana-custom-plugins/grafana-chord-plugin-1.0.0.zip;theia-grafana-chord-plugin"

2. Add the Panel to a Dashboard

Installed panels are available immediately in the Dashboards section in your Grafana main menu, and can be added like any other core panel in Grafana. To see a list of installed panels, click the Plugins item in the main menu. Both core panels and installed panels will appear. For more information, visit the docs on Grafana plugin installation.

Customization

This plugin is built with @grafana/toolkit, which is a CLI that enables efficient development of Grafana plugins. To customize the plugin and do local testings:

  1. Install dependencies

    cd grafana-chord-plugin
    yarn install
  2. Build plugin in development mode or run in watch mode

    yarn dev

    or

    yarn watch
  3. Build plugin in production mode

    yarn build

Learn more

About

License:Apache License 2.0


Languages

Language:TypeScript 99.2%Language:JavaScript 0.8%