grafana / mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Apache License 2.0
171 stars 51 forks source link

Plugin unavailable #12

Closed HenrikRolandHansen closed 3 years ago

HenrikRolandHansen commented 3 years ago

Sorry if this is not the right place for this issue. But I'm not able to make the mqtt-datasource plugin working. after compile(yarn install and Yarn build) and setup the "allow_loading_unsigned_plugins = grafana-mqtt-datasource" in the ini file I get Plugin unavailable when saving "Save and test" in grafana.

I do have a problem with build that might create this problem, but lack of skills cant solve what's the issue. During compile I get error code 127

✔ Compiling... /bin/sh: 1: mage: not found error Command failed with exit code 127.

Grafana interface image

Complete compile log (raspberry pi 4)

############################################## Yarn install ###################################### root@pi4:/var/lib/grafana/plugins/mqtt-datasource-main# yarn install yarn install v1.22.11 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... warning Pattern ["@grafana/ui@next"] is trying to unpack in the same destination "/usr/local/share/.cache/yarn/v6/npm-@grafana-ui-8.0.0-beta.3-2b293c3824b22fbca3a1d64d74893f1f27f75eb8-integrity/node_modules/@grafana/ui" as pattern ["@grafana/ui@8.0.0-beta.3","@grafana/ui@8.0.0-beta.3"]. This could result in non-deterministic behavior, skipping. warning Pattern ["@types/lodash@latest"] is trying to unpack in the same destination "/usr/local/share/.cache/yarn/v6/npm-@types-lodash-4.14.170-0d67711d4bf7f4ca5147e9091b847479b87925d6-integrity/node_modules/@types/lodash" as pattern ["@types/lodash@^4.14.146"]. This could result in non-deterministic behavior, skipping. info fsevents@1.2.13: The platform "linux" is incompatible with this module. info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@2.3.2: The platform "linux" is incompatible with this module. info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning "@grafana/ui > @visx/gradient@1.0.0" has incorrect peer dependency "react@^15.0.0-0 || ^16.0.0-0". warning "@grafana/ui > @visx/shape@1.4.0" has incorrect peer dependency "react@^16.3.0-0". warning "@grafana/ui > @visx/tooltip@1.7.2" has incorrect peer dependency "react@^16.8.0-0". warning "@grafana/ui > @visx/tooltip@1.7.2" has incorrect peer dependency "react-dom@^16.8.0-0". warning "@grafana/ui > rc-cascader@1.0.1" has incorrect peer dependency "react@^15.0.0 || ^16.0.0". warning "@grafana/ui > rc-cascader@1.0.1" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0". warning "@grafana/ui > react-beautiful-dnd@13.0.0" has incorrect peer dependency "react@^16.8.5". warning "@grafana/ui > react-beautiful-dnd@13.0.0" has incorrect peer dependency "react-dom@^16.8.5". warning "@grafana/ui > react-custom-scrollbars@4.2.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0". warning "@grafana/ui > react-custom-scrollbars@4.2.1" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0". warning "@grafana/ui > react-highlight-words@0.16.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0-0". warning "@grafana/ui > react-storybook-addon-props-combinations@1.1.0" has incorrect peer dependency "react@^15.x || ^16.x". warning "@grafana/ui > react-table@7.0.0" has incorrect peer dependency "react@^16.8.3". warning "@grafana/runtime > @grafana/ui > @emotion/css > @emotion/babel-plugin@11.3.0" has unmet peer dependency "@babel/core@^7.0.0". warning "@grafana/runtime > @grafana/ui > @grafana/slate-react > slate-react-placeholder@0.2.9" has unmet peer dependency "slate-react@>=0.22.0". warning "@grafana/runtime > @grafana/ui > @visx/shape > @visx/group@1.0.0" has incorrect peer dependency "react@^15.0.0-0 || ^16.0.0-0". warning "@grafana/runtime > @grafana/ui > @visx/tooltip > @visx/bounds@1.7.0" has incorrect peer dependency "react@^15.0.0-0 || ^16.0.0-0". warning "@grafana/runtime > @grafana/ui > @visx/tooltip > @visx/bounds@1.7.0" has incorrect peer dependency "react-dom@^15.0.0-0 || ^16.0.0-0". warning "@grafana/runtime > @grafana/ui > @emotion/css > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.12.13" has unmet peer dependency "@babel/core@^7.0.0-0". warning "@grafana/runtime > @grafana/ui > rc-cascader > rc-trigger > rc-motion@1.1.2" has incorrect peer dependency "react@^16.0.0". warning "@grafana/runtime > @grafana/ui > rc-cascader > rc-trigger > rc-motion@1.1.2" has incorrect peer dependency "react-dom@^16.0.0". [5/5] Building fresh packages... Done in 367.92s.

################################ Build ####################################################

root@pi4:/var/lib/grafana/plugins/mqtt-datasource-main# yarn build yarn run v1.22.11 $ rm -rf dist && grafana-toolkit plugin:build && mage build:backend Using Node.js v14.17.2 Using @grafana/toolkit v8.0.0-beta.3 ✔ Preparing ✔ Linting ts-jest[config] (WARN) The option tsConfig is deprecated and will be removed in ts-jest 27, use tsconfig instead PASS src/handleEvent.test.ts

Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 2 passed, 2 total Time: 3.77 s Ran all test suites with tests matching "". ✔ Running tests ⠙ Compiling... Starting type checking service... Using 1 worker with 2048MB memory limit ⠋ Compiling... Hash: 6b5a018b08c2ac55e195 Version: webpack 4.41.5 Time: 21481ms Built at: 28.07.2021 19.07.52 Asset Size Chunks Chunk Names CHANGELOG.md 53 bytes [emitted] LICENSE 11.1 KiB [emitted] README.md 2.64 KiB [emitted] img/mqtt.svg 1.31 KiB [emitted] module.js 3.8 KiB 0 [emitted] module module.js.LICENSE.txt 808 bytes [emitted] module.js.map 24 KiB 0 [emitted] [dev] module plugin.json 1000 bytes [emitted] Entrypoint module = module.js module.js.map [0] external "react" 42 bytes {0} [built] [1] external "@grafana/ui" 42 bytes {0} [built] [2] external "lodash" 42 bytes {0} [built] [3] external "@grafana/data" 42 bytes {0} [built] [4] external "@grafana/runtime" 42 bytes {0} [built] [5] ./module.ts + 5 modules 14.5 KiB {0} [built] | ./module.ts 296 bytes [built] | ./datasource.ts 352 bytes [built] | ./ConfigEditor.tsx 2.78 KiB [built] | ./QueryEditor.tsx 658 bytes [built] | ../node_modules/tslib/tslib.es6.js 10 KiB [built] | ./handleEvent.ts 395 bytes [built]

✔ Compiling... /bin/sh: 1: mage: not found error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@pi4:/var/lib/grafana/plugins/mqtt-datasource-main# ^C

thanks in advance

atifali commented 3 years ago

looks like your build environment is missing mage, which handles the building of the backend. you can follow instructions here to get that on your build environment: https://magefile.org/

essentially:

git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go 

you will need golang installed for that to work.

for a general overview and pre-requisites to building a backend datasource plugin: https://grafana.com/tutorials/build-a-data-source-backend-plugin/ for a streaming backend datasource plugin (which this plugin is): https://grafana.com/tutorials/build-a-streaming-data-source-plugin/

HenrikRolandHansen commented 3 years ago

Thanks for the tip, i Will rush Home and try it out 👍

HenrikRolandHansen commented 3 years ago

it works - cheers