Coder Social home page Coder Social logo

squidpickles / grafana-windrose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spectraphilic/grafana-windrose

0.0 0.0 0.0 1.34 MB

Grafana Widnrose panel plugin

License: GNU General Public License v3.0

JavaScript 14.72% Dockerfile 2.59% TypeScript 82.51% Shell 0.19%

grafana-windrose's Introduction

This Grafana plugin looks like:

Image of Windrose Grafana plugin

Disclaimer

This plugin has been tested with Grafana 10.x but there's still work to do before submitting to Grafana. New versions may require changes to the query or configuration.

Usage

Install:

$ sudo su -
# cd /var/lib/grafana/plugins
# git clone https://github.com/spectraphilic/grafana-windrose.git

Allow loading this plugin, in /etc/grafana/grafana.ini:

[plugins]
allow_loading_unsigned_plugins = spectraphilic-windrose-panel

Restart Grafana service.

Add a panel to your dashboard with the Windrose visualization type. Set up the query to provide data with speed and direction fields. The speed can be in the unit of your choice (can be set in the settings), while the direction is always in degrees.

PostgreSQL

Example query for PostgreSQL:

SELECT
  time,
  field1 AS speed,
  field2 AS direction
FROM table
WHERE $__unixEpochFilter("time")
ORDER BY time

ClickHouse

Example for ClickHouse:

SELECT
  $timeSeries as time,
  field1 AS speed,
  field2 AS direction
FROM table
WHERE $timeFilter
ORDER BY time

Prometheus

This is valid as well for prometheus-compatible data sources such as VictoriaMetrics.

Set a query for speed:

  • Metrics browser: meteo_ws_mean{location="$location"}
  • Legend: speed

Set another query for direction:

  • Metrics browser: meteo_wd_mean{location="$location"}
  • Legend: direction

This information was provided by @newrushbolt ; for further details see spectraphilic#18 (comment)

Flux

Example for InfluxDB v2 filled from SignalK.

from(bucket: "bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "environment.wind.speedTrue" or r["_measurement"] == "environment.wind.directionTrue")
  |> filter(fn: (r) => r["_field"] == "value")
  |> pivot(rowKey:["_time"], columnKey: ["_measurement"], valueColumn: "_value") // put dir and speed values into the same row based on timestamps
  |> filter(fn: (r) => exists r["environment.wind.directionTrue"] and exists r["environment.wind.speedTrue"]) // drop rows that don't have both values
  |> rename(columns: {"environment.wind.directionTrue": "directionRad", "environment.wind.speedTrue": "speedMps"})
  |> map(fn: (r) => ({ r with  direction: r.directionRad / 3.14 * 180.0 })) // convert to degrees from radians
  |> map(fn: (r) => ({ r with  speed: r.speedMps / 0.514 })) // convert to knots from m/s
  |> aggregateWindow(every: v.windowPeriod, fn: first, column: "direction", createEmpty: false) // sample the first row for each window (real aggregation would show fake values in gusty winds)

Development

Install:

$ npm run dev
$ docker-compose up

grafana-windrose's People

Contributors

jdavid avatar squidpickles avatar orymate avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.