Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.replace is not a function #661

Closed
janey-day opened this issue Jan 8, 2019 · 11 comments
Closed

t.replace is not a function #661

janey-day opened this issue Jan 8, 2019 · 11 comments
Labels
Milestone

Comments

@janey-day
Copy link

janey-day commented Jan 8, 2019

I used well zabbix in Grafana, I needed to add some more graphs.
I tried to add a Zabbix datasource but it didn't work
Another datasources still work, also if I add the same zabbix datasource in the other Grafana server that works well as a datasource.
What's the problem?

I tried but t.replace is not a function came out
ss

I tried it as a $datasource but same errors came out
datasource

Error messages
error

Software versions
Zabbix 4.0
Grafana 5.4.0
plugin 3.9.1

I'll wait for your help.

@hlyazid
Copy link

hlyazid commented Jan 9, 2019

Hello,

I have the same problem, all my existing dashboard function correctly, but I can't create neam items.

Regards

@janey-day
Copy link
Author

I don't know what is the problem, which I mean can't solve this. So I just add zabbix datasource to another Grafana server and it worked but, I want to figure it out what's the problem and its solution

@Moss-CG
Copy link

Moss-CG commented Jan 24, 2019

I had this issue as well when I went to convert a pre-existing panel from using a MySQL datasource to using a Zabbix API datasource. I was able to delete the panel and create a new one using a Zabbix API datasource from the start and it seemed to work fine.

@mammuthus
Copy link
Contributor

The same issue!

Moved from: grafana/grafana#15319

What Grafana version are you using?

It was Grafana v5.4.2 (commit: d812109) but updating to Grafana v5.4.3 (commit: 6539180) didn't fix the issue

What datasource are you using?

Zabbix api (Zabbix plugin by Alexander Zobnin, Version 3.9.1) @alexanderzobnin

What OS are you running grafana on?

CentOS Linux release 7.6.1810 (Core)
Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

What did you do?

I try to create new dashboard with widget or add new widget (Table for example) in existing board.

What was the expected result?

Creating new board and adding new widget

What happened instead?

I get an arror after choosing "zabbix api" in Data Source section: t.replace is not a function

Pic 1: normal situation with "Grafana" datasource:
image

Pic 2: error after switching to "zabbix api" source
image

Pic 3: try to create Graph widget and getting the same error. Adding more queries after that:
I can create B and C etc queries, but A is broken
Hide and Remove buttons dont' work with A query
image

Pic 4: Open already existing widget with zabbix source, made ~3 mouths ago, all is OK:
New queries creates OK too
image

Pic 5: Zabbix datasource config:
image

Include raw network request & response: get by opening Chrome Dev Tools (F12, Ctrl+Shift+I on windows, Cmd+Opt+I on Mac), go the network tab.

image

@mammuthus
Copy link
Contributor

As a temporary measure you can goto JSON model, find "group" value of broken widget
and change [] to {}

image

image

@alexanderzobnin alexanderzobnin added this to the 3.10 milestone Feb 12, 2019
@alexanderzobnin
Copy link
Collaborator

Yes, looks like a bug, maybe related to default metric template change in grafana.

@alexanderzobnin
Copy link
Collaborator

@mammuthus thanks for the detailed report! Unfortunately, I can't replicate this issue doing the same steps. If I change target.group to [] in panel, I get the same error. But I can't understand why group changes. Could you provide some additional info? For instance, add new panel, get error and paste panel json here.

@alexanderzobnin
Copy link
Collaborator

Got it. It seems it caused by MySQL and Postgres datasource editor. It sets default target.group to []:
https://github.com/grafana/grafana/blob/f348acccf3c178c16cf36cbb30224d6bd7731ba9/public/app/plugins/datasource/mysql/mysql_query.ts#L18
https://github.com/grafana/grafana/blob/f348acccf3c178c16cf36cbb30224d6bd7731ba9/public/app/plugins/datasource/postgres/postgres_query.ts#L18
So I have to take it into account and do some extra check for this field. Until it fixed workaround from @mammuthus (change [] to {} in panel json) should work.

@alexanderzobnin
Copy link
Collaborator

Guess, this appears if you have MySQL or Postgres datasource set as default. Can you confirm this?
@hlyazid @janeunbi @Stack0verflow @mammuthus

@mammuthus
Copy link
Contributor

mammuthus commented Feb 13, 2019

Yes, it is
image

After unchecking and changing default source to Zabbix api it works normally

image

image

JSON is fine too

@alexanderzobnin
Copy link
Collaborator

Ok, seems, it's a reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants