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

[BUG] The generate script can not generate datasources #45

Open
zymap opened this issue Jun 20, 2020 · 2 comments
Open

[BUG] The generate script can not generate datasources #45

zymap opened this issue Jun 20, 2020 · 2 comments

Comments

@zymap
Copy link
Member

zymap commented Jun 20, 2020

Error log:

root@c8faefc852da:/apache-pulsar-grafana-dashboard# ./scripts/generate_dashboards.sh http://172.17.0.2:9090 standaloneGenerating Datasources ...
Traceback (most recent call last):
  File "/usr/local/bin/j2", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/j2cli/cli.py", line 206, in main
    sys.argv[1:]
  File "/usr/local/lib/python3.6/dist-packages/j2cli/cli.py", line 186, in render_command
    result = renderer.render(args.template, context)
  File "/usr/local/lib/python3.6/dist-packages/j2cli/cli.py", line 87, in render
    .render(context) \
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.6/dist-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/apache-pulsar-grafana-dashboard/target/datasources.yml", line 65, in top-level template code
    - name: "{{ GF_LOKI_DATASOURCE_NAME }}"
jinja2.exceptions.UndefinedError: 'GF_LOKI_DATASOURCE_NAME' is undefined
@jharris-
Copy link
Contributor

Same problem for GF_LOKI_URL

I am not using Loki so I work around this issue by setting both to an empty string for now.

sijie pushed a commit that referenced this issue Jul 28, 2020
Main intent was to extend the JSON dashboards to support more dynamic "job" names and to be able to switch out "instance" dashboard legends with "pod" keys.

After this update most of the dashboards under dashboards/ are Jinja2 templates and the generate_dashboard.sh script
now supports checking for and prompting if missing input/env vars which also resolves issue #45

Visual verification of post rendered templates was done.
@tuteng
Copy link
Member

tuteng commented Dec 1, 2021

If the Loki module is not enabled, you can use the following configuration, remember to install the j2 module => pip install j2cli

./scripts/generate_dashboards.sh localhost:9090 standalone
GF_LOKI_DATASOURCE_NAME=test
GF_LOKI_URL=xxxx
PULSAR_CUSTOM_PROMETHEUS=http://localhost:9090 or your-prometheus-url

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

No branches or pull requests

4 participants