Create button to execute a batch or command file

Hi everybody,
In Grafana 8, installed in Windows 10, I would like to have the fonctionnality to stop or restart program or service.
Is it possible to create a “Button” to execute a batch file ?
thx
richard

@richardgaudin that’s not really possible directly as described. Check out these two threads for related discussions/ways to do it:

I guess what you could do is creating a plugin calling an API that will run the scripts you want

Indeed, a backend plugin would let you execute commands on the server. You could then control it from an app plugin or a panel plugin. It would require a fair amount of development work, but it’s definitely possible.

Hi,
thanks for these answers but i don’t understood how i can do it…
Could you please provide more explanantion, example ?
thx

The short explanation is that unless you feel comfortable writing Typescript or Go code, it’s not supported. If you’d like to try, you can start with the tutorial on how to Build a backend plugin.

The main issue is that for security reasons Grafana won’t let you execute custom scripts and processes on the server. If you can somehow set up a web service on the machine that lets you control your program using a REST API, you could use something like the Button panel.

1 Like

Hi there,

Maybe you found a solution for the issue already.
But I would like to share my experience.

We used Grafana to show the employee’s dashboard that there is a lot of information to show the metric performance of an employee. Then we need to press the button to export those metrics to pdf and send them as an attachment email after reviewing their performance after 6 months.

In the beginning, I decided to use the Button plugin to send GET to a server in order to receive the pdf. But I found the plugin is not enough because we need a little bit of Javascript involved.

Fortunately, you could use Text panel embedded already as built-in addons which we could make HTML along with JSX for whatever task.

Blockquote



Download

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.