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] generate_dashboards fail jinja2.exceptions.UndefinedError: 'GF_LOKI_DATASOURCE_NAME' is undefined #71

Open
zcola opened this issue Dec 1, 2021 · 1 comment

Comments

@zcola
Copy link

zcola commented Dec 1, 2021

./scripts/generate_dashboards.sh http://localhost:9090 pulsar-19990
Setting PULSAR_PROMETHEUS_URL from script input.
PULSAR_PROMETHEUS_URL set to: http://localhost:9090
Setting PULSAR_CLUSTER from script input.
PULSAR_CLUSTER set to: pulsar-19990
Using existing PULSAR_CUSTOM_PROMETHEUS environment variable.
PULSAR_CUSTOM_PROMETHEUS set to:
Using existing GF_LOKI_URL environment variable.
GF_LOKI_URL set to:
Using existing GF_LOKI_DATASOURCE_NAME environment variable.
GF_LOKI_DATASOURCE_NAME set to:
Generating Datasources ...
Traceback (most recent call last):
File "/usr/local/bin/j2", line 10, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 206, in main
sys.argv[1:]
File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 186, in render_command
result = renderer.render(args.template, context)
File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 87, in render
.render(context)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/mnt/h/apache-pulsar-grafana-dashboard/target/datasources.yml", line 68, in top-level template code
url: "{{ GF_LOKI_URL }}"
jinja2.exceptions.UndefinedError: 'GF_LOKI_DATASOURCE_NAME' is undefined

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants