apache-pulsar-grafana-dashboard icon indicating copy to clipboard operation
apache-pulsar-grafana-dashboard copied to clipboard

[BUG] The generate script can not generate datasources

Open zymap opened this issue 5 years ago • 3 comments

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

zymap avatar Jun 20 '20 08:06 zymap

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.

jharris- avatar Jul 10 '20 18:07 jharris-

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

tuteng avatar Dec 01 '21 04:12 tuteng