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

Control functionality question #2

Open
corndog2000 opened this issue Mar 8, 2021 · 10 comments
Open

Control functionality question #2

corndog2000 opened this issue Mar 8, 2021 · 10 comments

Comments

@corndog2000
Copy link

Hi, I am considering using your plugin for a user interface in my grafana dashboard. I'm confused as to how database queries can be used for dashboard controls.

@speakyourcode
Copy link
Owner

Hi, here an example with postgres:
#1 (comment)
Which datasource are you using?

@corndog2000
Copy link
Author

corndog2000 commented Mar 8, 2021

I am using InfluxDB. I don't understand how the other person in that closed issue was able to get grafana to run scripts with this plugin.

@speakyourcode
Copy link
Owner

Here is an example to create a database with InfluxDB:

{
  "query": "create database \"foo\"",
  "rawQuery": true,
  "resultFormat": "time_series"
}

And to delete it:

{
  "query": "drop database \"foo\"",
  "rawQuery": true,
  "resultFormat": "time_series"
}

@CocoJumbA
Copy link

Good afternoon,
Could you be so kind and make an example of a query with inserting some value to an InfluxDB measurement?
Regards

@speakyourcode
Copy link
Owner

speakyourcode commented Mar 21, 2021

Hi,
InfluxDB has three endpoints: /api/v2/query, /api/v2/write and /health, and Grafana always uses query. AFAIK the only way to use the write endpoint is with a custom datasource.

@angellee99
Copy link

Hi,
InfluxDB has three endpoints: /api/v2/query, /api/v2/write and /health, and Grafana always uses query. AFAIK the only way to use the write endpoint is with a custom datasource.

Hi, how should we add queries to insert values into the influxdb database?

@speakyourcode
Copy link
Owner

Hi, you can only insert values with the endpoint /api/v2/write. Grafana's InfluxDB Datasource only supports /api/v2/query, so you can't unless you use a custom datasource implementing the write endpoint (see https://grafana.com/tutorials/build-a-data-source-plugin/).

@AmmarAhmed
Copy link

Hello, I am on grafana version 6.7.3, I am trying to add speakyourcode-button-panel but I have an error "Error loading panel plugin: speakyourcode-button-panel TypeError: v.setPanelOptions is not a function"
Do you have an idea ?

@speakyourcode
Copy link
Owner

The plugin requires Grafana 7 or higher, can you upgrade and try again?

@PapaRoach25
Copy link

PapaRoach25 commented Dec 9, 2022

Hello, @speakyourcode
Is it possible to delete series of data from InfluxDB using your plugin?
My query is:

{
  "query": "drop series from \"jmeter\" where \"application\" = \"$test_name\"",
  "rawQuery": true,
  "resultFormat": "time_series"
}

$test_name - grafana variable

After clicking on the button I received:
Button: 500 (Internal Server Error) An error occurred within the plugin

Using your example I was able to create a database.

Updates: my bad I've missed space after where clause: where"application". (already edited in this comment)
After that 500 error disappeared, but the query itself couldn't drop the series from DB. (in the dev tools I'm observing 200 OK)
Do you have any suggestions on how it can be done using your plugin?
Thanks.

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

No branches or pull requests

6 participants