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

How to use the plugin. #5

Open
arodrime opened this issue Apr 22, 2020 · 1 comment
Open

How to use the plugin. #5

arodrime opened this issue Apr 22, 2020 · 1 comment

Comments

@arodrime
Copy link

Hello @DifferentialOrange. I'm testing this plugin, without luck so far. Maybe is there something I'm doing wrong, would you guide me on how to use those plugins? If you can't, please let me know so I ask on 'grafonnet-lib' side.

I've followed: https://github.com/grafana/grafonnet-lib#user-content-adding-plugins-to-grafonnet

The overview.jsonnet is as follows:

local grafana = (import 'grafonnet/grafana.libsonnet')
              + (import 'grafonnet-status-panel/plugin.libsonnet')
              + (import 'grafonnet-polystat-panel/plugin.libsonnet');

The import is failing as follows:

grafonnet_1           | Generating overview.jsonnet
grafonnet_1           | RUNTIME ERROR: couldn't open import "grafonnet-status-panel/plugin.libsonnet": no match locally or in the Jsonnet library paths.
grafonnet_1           |        /input/overview.jsonnet:2:18-66 thunk <grafana>
grafonnet_1           |        /input/overview.jsonnet:4:19-26 thunk <dashboard>
grafonnet_1           |        /input/overview.jsonnet:33:1-10 
dashboards_grafonnet_1 exited with code 1

Here is the structure in the container:

/ # ls -al grafonnet-lib/
total 140
drwxr-xr-x    1 root     root          4096 Apr 22 14:43 .
drwxr-xr-x    1 root     root          4096 Apr 22 14:43 ..
drwxr-xr-x    2 root     root          4096 Apr 22 14:38 .circleci
drwxr-xr-x    8 root     root          4096 Apr 22 14:38 .git
-rw-r--r--    1 root     root            34 Apr 22 14:38 .gitignore
-rw-r--r--    1 root     root           268 Apr 22 14:38 CODE_OF_CONDUCT.md
-rw-r--r--    1 root     root         11357 Apr 22 14:38 LICENSE
-rw-r--r--    1 root     root          6062 Apr 22 14:38 README.md
drwxr-xr-x    3 root     root          4096 Apr 22 14:38 docs
drwxr-xr-x    2 root     root          4096 Apr 22 14:38 examples
drwxr-xr-x    2 root     root          4096 Apr 22 14:38 grafonnet
drwxr-xr-x    4 root     root          4096 Apr 22 14:43 grafonnet-polystat-panel
drwxr-xr-x    4 root     root          4096 Apr 22 14:43 grafonnet-status-panel
-rw-r--r--    1 root     root           134 Apr 22 14:38 mkdocs.yml
-rw-r--r--    1 root     root           610 Apr 22 14:38 plugins.md
-rw-r--r--    1 root     root         58712 Apr 22 14:38 screenshot.png
drwxr-xr-x   23 root     root          4096 Apr 22 14:38 tests
-rwxr-xr-x    1 root     root           933 Apr 22 14:38 tests.sh
grafonnet-lib/grafonnet-status-panel:
total 48
drwxr-xr-x    4 root     root          4096 Apr 22 14:43 .
drwxr-xr-x    1 root     root          4096 Apr 22 14:43 ..
drwxr-xr-x    8 root     root          4096 Apr 22 14:43 .git
-rw-r--r--    1 root     root            19 Apr 22 14:43 .gitignore
-rw-r--r--    1 root     root         11357 Apr 22 14:43 LICENSE
-rw-r--r--    1 root     root          1436 Apr 22 14:43 README.md
-rw-r--r--    1 root     root          4723 Apr 22 14:43 plugin.libsonnet
drwxr-xr-x    2 root     root          4096 Apr 22 14:43 tests
-rwxr-xr-x    1 root     root           528 Apr 22 14:43 tests.sh

I'm importing the library here:

#!/usr/bin/env sh

set -e
echo "Generating dashboards"

for fp in $(ls /input); do
    echo "Generating $fp"
    export JSONNETPATH="/grafonnet-lib:/grafonnet-lib/grafonnet-polystat-panel:/grafonnet-lib/grafonnet-status-panel"
    /usr/local/bin/jsonnet /input/$fp -o /output/${fp%net}
done

I have the wish of building a similar plugin and sharing it for the polystatPanel Grafana chart: https://grafana.com/grafana/plugins/grafana-polystat-panel. Doing the work here: https://github.com/thelastpickle/grafonnet-polystat-panel. As you can see it's inspired/copied from yours, but I'm not sure how to use it.

You seem to be the first one in building a plugin extension for Grafonnet. Would you please help me understanding this one? I'd like to have this working and contribute with a working plugin as well :).

Thanks!

@arodrime
Copy link
Author

I can push a branch if you want to investigate and what I shared isn't enough.

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

1 participant