mqtt-panel icon indicating copy to clipboard operation
mqtt-panel copied to clipboard

Not compatible with Grafana 8

Open Webbeh opened this issue 3 years ago • 19 comments

This plugin doesn't seem to be working with the new Grafana version.

Upon choosing "MQTT Panel" as dashboard type, whether you already set datasources/properties or not, Grafana soft crashes with the following error :


An unexpected error happened
TypeError: can't access property "emit", this.events is undefined

At@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:223:4131
k@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:70367
div
div
div
t@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:706837
p@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:5437:30832
div
div
_t@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:223:6370
div
div
sn@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:294:35
div
t@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:327:1556
div
t@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:327:3509
Bn@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:327:9018
div
div
Zn@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:354:1866
k@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:70367
div
W@https://grafana.glassey.dev/public/build/DashboardPage.30c57922b07f39c21f37.js:405:667
DashboardPage
k@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:70367
n@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:462198
$a@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:5612:2987
t@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:1206670
t@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:1208715
div
t@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:1203275
div
Ge@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:3076:891
t/ct/p<@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:5435:18983
ts@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:3726:355
ns@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:3726:639
l@https://grafana.glassey.dev/public/build/vendors~app.30c57922b07f39c21f37.js:2:68273
oi@https://grafana.glassey.dev/public/build/app.30c57922b07f39c21f37.js:5625:91

EDIT: Possibly related to #28

Webbeh avatar Jun 19 '21 08:06 Webbeh

same issue with yours when using V8.0.2 with https for grafana. Using V 8.0.1 with http working just fine.

TJChong92 avatar Jun 25 '21 06:06 TJChong92

Confirmed that is cause only on HTTPS use (works fine on HTTP) on Grafana 8.1.

hildogjr avatar Aug 11 '21 15:08 hildogjr

@TJChong92 @hildogjr @geeks-r-us Hello guys! I installed in my grafana 8.1, enabled unsigned plugins but I cant create new panel button :(

What I need to do? I really need this plugin to clients send commands over mqtt! I using grafana 8.1 in ubuntu 20.04, VerneMQ with WSS enabled. I need https to!

Update: It's really work without HTTPS, I can create button and send commands over WSS. When I acess this dashboard with button create OVER HTTPS, works nice. However, if I try to create new mqtt panel, show this error above.

The error is only when creating new panel over https.

urbanze avatar Aug 21 '21 14:08 urbanze

Interesting, so the error is just when creating... I haven't debug to this workflow and I am using same Ubuntu with Grafana in Docker.

@urbanze, is it possible to export the dashboard with the mqtt plugin and import in Grafana HTTPS mode? (The error when placing the plugin into the dashboard happens only in the manual creation?)

Can I edit other add plugin (graph) in the dashboard over HTTPS without trigger the error? (If I edit the already added mqtt plugin, the error is triggered?)

I am trying to understanding what procedure trigger this error: the instantiation of the plugin it self, the event of the Grafana interface when including it into its database registry, ...

hildogjr avatar Aug 21 '21 16:08 hildogjr

@hildogjr I test and got this results:

All tests I made with HTTPS.

  1. Export and import again, works perfectly. I can import and send command with sucess.
  2. The error appears only when I click to create new panel. "Add new panel -> click in mqtt panel (show error here)"
  3. Yes, I can edit already created panel.

The trick is SSH tunneling over 3000 to acess grafana without HTTPS, create panel and quit, to edit normally over HTTPS

urbanze avatar Aug 21 '21 17:08 urbanze

@geeks-r-us, is there some function/method that is called on the drag-drop of the creation of the MQTT dashboard? I was looking for it but I don't understand too much JavaScript.

hildogjr avatar Aug 23 '21 20:08 hildogjr

@urbanze , I used same tunnel process to my tests. Is it possible to allow HTTP+HTTPS on Grafana as workaround (unencrypted for maintenance under SSH and TLS still for worldweb, through my firewall)?

I use:

      - GF_SERVER_PROTOCOL=https
      - GF_SERVER_HTTP_PORT=3000
      - GF_SERVER_CERT_FILE=certificate.cer
      - GF_SERVER_CERT_KEY=mykey.key

hildogjr avatar Aug 23 '21 20:08 hildogjr

@hildogjr Yes, you can.

My Grafana use port 3000 too, but I use NGINX as reverse proxy/ssl/etc (routing "foo.com" to "foo.com:3000" internally)

You can use UFW Firewall to block external access from port 3000 and keep 80 open to users. When you do this, you can use SSH TUNNELING to access from your PC, internal port 3000 of your server.

ssh -L 3000:localhost:3000 [email protected]

Now, when you type in your browser "localhost:3000", your computer will access port 3000 from you server.

urbanze avatar Aug 23 '21 22:08 urbanze

It is also sufficient to replace mqttProtocol: 'ws', with mqttProtocol: 'wss', in module.js after installing the plugin. Now i'm able to create a new mqqt-panel when using https via a reverse-proxy.

zoltan0907 avatar Apr 15 '22 07:04 zoltan0907

It is also sufficient to replace mqttProtocol: 'ws', with mqttProtocol: 'wss', in module.js after installing the plugin. Now i'm able to create a new mqqt-panel when using https via a reverse-proxy.

Will try that, thanks

Webbeh avatar Apr 15 '22 07:04 Webbeh

Could someone propose (is it possible to include) a automatic validation into the code?

hildogjr avatar Apr 16 '22 16:04 hildogjr

Maybe like this:

mqttProtocol: (window.location.protocol === 'https:') ? 'wss' : 'ws',

i created a pull-request https://github.com/geeks-r-us/mqtt-panel/pull/43

zoltan0907 avatar Apr 16 '22 18:04 zoltan0907

Hi all,

I'm using docker in order to test mqtt-panel plugin : docker run -d -p 3000:3000 -e "GF_INSTALL_PLUGINS=https://github.com/geeks-r-us/mqtt-panel/releases/download/v1.0.7/geeksrus-mqtt-panel-1.0.7.zip;mqtt-panel" --name=grafana grafana/grafana

I don't see the plugin in grafana, never ....

Someone could help me please ?

using : v8.5.0 grafana

Thanks

FlorianMESSINA avatar Jun 21 '22 16:06 FlorianMESSINA

Works fine for me:

GF_INSTALL_PLUGINS=https://github.com/geeks-r-us/mqtt-panel/releases/download/v1.0.7/geeksrus-mqtt-panel-1.0.7.zip;mqtt-panel

hildogjr avatar Jun 21 '22 16:06 hildogjr

i have the same code.... in my container, i see the plugin correctly downloaded...

which version of grafana ?

FlorianMESSINA avatar Jun 21 '22 17:06 FlorianMESSINA

v8.1.5 online here https://labrei.dsce.fee.unicamp.br:3000/login

hildogjr avatar Jun 21 '22 17:06 hildogjr

Err, isn't this plugin unsigned ? If so, you'll need to add it to the "enable unsigned plugins" list.

Correct me if I'm wrong.

Webbeh avatar Jun 21 '22 17:06 Webbeh

Yes, true and you need to point the name of the unsigned plugin at last Grafana versions. My "grafana.ini" file have the entry:

[plugins]
allow_loading_unsigned_plugins = geeksrus-mqtt-panel
plugin_admin_enabled = true

hildogjr avatar Jun 21 '22 17:06 hildogjr

i found my problem ...... missing a "s" in allow_loading_unsigned_plugins = geeksrus-mqtt-panel

docker run -d -p 3000:3000 -e "GF_INSTALL_PLUGINS=https://github.com/geeks-r-us/mqtt-panel/releases/download/v1.0.7/geeksrus-mqtt-panel-1.0.7.zip;mqtt-panel" -e "GF_PLUGINS_PLUGIN_ADMIN_ENABLED=true" -e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=geekrus-mqtt-panel" --name=grafana grafana/grafana

wrong : geekrus-mqtt-panel good : geeksrus-mqtt-panel

Thanks you very much @hildogjr and @Webbeh for you help !

FlorianMESSINA avatar Jun 21 '22 17:06 FlorianMESSINA