streamnative / apache-pulsar-grafana-dashboard

Apache Pulsar Grafana Dashboard
Apache License 2.0
91 stars 93 forks source link

[BUG] generate_dashboards fail `jinja2.exceptions.UndefinedError: 'GF_LOKI_DATASOURCE_NAME' is undefined` #71

Open zcola opened 2 years ago

zcola commented 2 years ago

./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 commented 2 years ago

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