rozetko
2 years ago
3 changed files with 62 additions and 59 deletions
@ -1,79 +1,82 @@
|
||||
# Grafana app plugin template |
||||
# Grafana Data Exporter App |
||||
|
||||
This template is a starting point for building an app plugin for Grafana. |
||||
Grafana plugin for exporting data from Grafana panels as CSV. |
||||
|
||||
## What are Grafana app plugins? |
||||
Supported datasources: |
||||
- MySQL |
||||
- PostgreSQL |
||||
|
||||
App plugins can let you create a custom out-of-the-box monitoring experience by custom pages, nested datasources and panel plugins. |
||||
## Prerequisites |
||||
- [Grafana 9.0.0+](https://grafana.com/grafana/download) |
||||
- [Grafana Data Exporter](https://code.corpglory.net/corpglory/grafana-data-exporter) |
||||
- set Grafana `app_mode` as `development` (it won't be necessary after we sign the plugin): |
||||
- find the configuration file: [https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#configuration-file-location](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#configuration-file-location) |
||||
- change `app_mode = production` to `app_mode = development` |
||||
|
||||
## Getting started |
||||
## Plugin installation |
||||
|
||||
### Frontend |
||||
The easiest way to install plugins is by using the `grafana-cli` tool which is bundled with Grafana. See [Using grafana-cli](#using-grafana-cli) paragraph. |
||||
|
||||
1. Install dependencies |
||||
If there is no `grafana-cli` tool in your system, plugins can be installed [manually](#manual-installation). |
||||
|
||||
```bash |
||||
yarn install |
||||
``` |
||||
### Table of contents |
||||
- [Using grafana-cli](#using-grafana-cli) |
||||
- [Install plugin](#install-update-plugin) |
||||
- [Manual installation](#manual-installation) |
||||
- [Docker installation](#docker-installation) |
||||
|
||||
2. Build plugin in development mode or run in watch mode |
||||
### Using grafana-cli |
||||
|
||||
```bash |
||||
yarn dev |
||||
Grafana docs about plugin installation: [https://grafana.com/docs/plugins/installation/#installing-plugins](https://grafana.com/docs/plugins/installation/#installing-plugins). |
||||
|
||||
# or |
||||
#### Install / update plugin |
||||
```bash |
||||
grafana-cli --pluginUrl "https://code.corpglory.net/attachments/89ae5865-2ae7-474c-a6f0-f29d19e6b1dd" plugins install corpglory-dataexporter-app |
||||
sudo systemctl restart grafana-server |
||||
``` |
||||
|
||||
yarn watch |
||||
``` |
||||
### Manual installation |
||||
|
||||
3. Build plugin in production mode |
||||
- Navigate to Grafana plugins directory: |
||||
- For Grafana installed from `.deb`/`.rpm` package: |
||||
- `/var/lib/grafana/plugins` |
||||
- For Grafana installed using Standalone Linux Binaries or source: |
||||
- `<GRAFANA_PATH>/data/plugins` |
||||
|
||||
```bash |
||||
yarn build |
||||
``` |
||||
- Download corpglory-dataexporter-app |
||||
```bash |
||||
wget http://code.corpglory.net/attachments/5f1c5e28-544b-416a-a425-7cdf49fa60ac -O corpglory-dataexporter-app.tar.gz |
||||
``` |
||||
|
||||
4. Run the tests (using Jest) |
||||
- Unpack downloaded files |
||||
```bash |
||||
tar -zxvf corpglory-dataexporter-app.tar.gz |
||||
``` |
||||
|
||||
```bash |
||||
# Runs the tests and watches for changes |
||||
yarn test |
||||
|
||||
# Exists after running all the tests |
||||
yarn lint:ci |
||||
``` |
||||
- Restart Grafana |
||||
- For Grafana installed from `.deb`/`.rpm` package: |
||||
- `systemctl restart grafana-server` |
||||
- For Grafana installed using Standalone Linux Binaries or source: |
||||
- Stop any running instances of grafana-server |
||||
- Start grafana-server: `cd <GRAFANA_PATH> && ./bin/grafana-server` |
||||
|
||||
5. Spin up a Grafana instance and run the plugin inside it (using Docker) |
||||
### Docker installation |
||||
|
||||
```bash |
||||
yarn server |
||||
``` |
||||
You can install Data Exporter App to Grafana in Docker passing it as the environment variable. |
||||
|
||||
6. Run the E2E tests (using Cypress) |
||||
```bash |
||||
docker run \ |
||||
-p 3000:3000 \ |
||||
-e "GF_INSTALL_PLUGINS=https://code.corpglory.net/attachments/89ae5865-2ae7-474c-a6f0-f29d19e6b1dd;corpglory-dataexporter-app" \ |
||||
grafana/grafana |
||||
``` |
||||
|
||||
```bash |
||||
# Spin up a Grafana instance first that we tests against |
||||
yarn server |
||||
|
||||
# Start the tests |
||||
yarn e2e |
||||
``` |
||||
#### Useful links |
||||
- Grafana docs about Docker installation: [https://docs.grafana.org/installation/docker/#installing-plugins-from-other-sources](https://docs.grafana.org/installation/docker/#installing-plugins-from-other-sources) |
||||
|
||||
7. Run the linter |
||||
## Support and Consulting |
||||
|
||||
```bash |
||||
yarn lint |
||||
|
||||
# or |
||||
Commercial support, professional services **or any help** — send us your inquiry at ping@corpglory.com |
||||
|
||||
yarn lint:fix |
||||
``` |
||||
|
||||
|
||||
|
||||
## Learn more |
||||
|
||||
Below you can find source code for existing app plugins and other related documentation. |
||||
|
||||
- [Basic app plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/app-basic#readme) |
||||
- [Plugin.json documentation](https://grafana.com/docs/grafana/latest/developers/plugins/metadata/) |
||||
- [How to sign a plugin?](https://grafana.com/docs/grafana/latest/developers/plugins/sign-a-plugin/) |
||||
## About CorpGlory Inc. |
||||
Grafana Data Exporter is developed by [CorpGlory Inc.](https://corpglory.com/), a company which provides high quality software development, data visualization, Grafana and monitoring consulting. |
||||
|
Loading…
Reference in new issue