error executing template service-discovery and targets in prometheus - Stack Overflow

I installed Prometheus from Debian Repo. I get the following error when I click on Status->Tagrget

I installed Prometheus from Debian Repo.
I get the following error when I click on Status->Tagrget menu:

error executing template targets.html: template: targets.html:131:51: executing "content" at <.Labels.Map>: wrong number of args for Labels: want 1 got 0`

And when I click on Status->Service Discovery I get the following error:

error executing template service-discovery.html: template: service-discovery.html:134:38: executing "content" at <.Labels.Map>: wrong number of args for Labels: want 1 got 0

How can I solve the given problems?

UPDATE:

root@debian:~# uname -r
6.11.9-amd64
root@debian:~# cat /etc/issue
Debian GNU/Linux trixie/sid \n \l
root@debian:~# prometheus --version
prometheus, version 2.53.3+ds1 (branch: debian/sid, revision: 2.53.3+ds1-1)
  build user:       [email protected]
  build date:       20250216-17:31:36
  go version:       go1.24.0
  platform:         linux/amd64
  tags:             unknown

root@debian:~# dpkg -l prometheus-node-exporter |grep ^ii
ii  prometheus-node-exporter 1.9.0-1      amd64        Prometheus exporter for machine metrics

root@debian:~# ps ax |grep prome
  91965 ?        Ssl   35:24 /usr/bin/prometheus-node-exporter
  99573 ?        Ssl    0:00 /usr/bin/prometheus-blackbox-exporter --config.file /etc/prometheus/blackbox.yml
 184666 ?        Ssl   13:20 /usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml
 943473 pts/2    S+     0:00 grep prome

BTW, I‌ install from debian repo.

I installed Prometheus from Debian Repo.
I get the following error when I click on Status->Tagrget menu:

error executing template targets.html: template: targets.html:131:51: executing "content" at <.Labels.Map>: wrong number of args for Labels: want 1 got 0`

And when I click on Status->Service Discovery I get the following error:

error executing template service-discovery.html: template: service-discovery.html:134:38: executing "content" at <.Labels.Map>: wrong number of args for Labels: want 1 got 0

How can I solve the given problems?

UPDATE:

root@debian:~# uname -r
6.11.9-amd64
root@debian:~# cat /etc/issue
Debian GNU/Linux trixie/sid \n \l
root@debian:~# prometheus --version
prometheus, version 2.53.3+ds1 (branch: debian/sid, revision: 2.53.3+ds1-1)
  build user:       [email protected]
  build date:       20250216-17:31:36
  go version:       go1.24.0
  platform:         linux/amd64
  tags:             unknown

root@debian:~# dpkg -l prometheus-node-exporter |grep ^ii
ii  prometheus-node-exporter 1.9.0-1      amd64        Prometheus exporter for machine metrics

root@debian:~# ps ax |grep prome
  91965 ?        Ssl   35:24 /usr/bin/prometheus-node-exporter
  99573 ?        Ssl    0:00 /usr/bin/prometheus-blackbox-exporter --config.file /etc/prometheus/blackbox.yml
 184666 ?        Ssl   13:20 /usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml
 943473 pts/2    S+     0:00 grep prome

BTW, I‌ install from debian repo.

Share Improve this question edited Mar 7 at 12:48 PersianGulf asked Mar 3 at 12:22 PersianGulfPersianGulf 2,8857 gold badges50 silver badges71 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

TL;DR run

sudo /usr/share/prometheus/install-ui.sh

I had the exact same error message on a Debian system freshly upgraded from bookworm to trixie. Apparently, the default (classic) UI is broken.

To understand what's going on, click on the "New UI" menu entry. You'll then see this message:

This Debian package of Prometheus does not include the modern React web UI, due to the complexity of packaging it without violating Debian policy.

Although the classic web UI was removed in Prometheus v2.34.0, it has been carried over to subsequent Debian packages for a limited time. Since the classic web UI is no longer maintained by upstream, and since it lacks the full set of features that the modern React UI offers, the classic UI will be removed in a future Debian package.

  • Use classic web UI

Alternatively, you can deploy the React web UI yourself with the assistance of the /usr/share/prometheus/install-ui.sh helper script.

Running the helper script and switching to the official REACT-based prometheus UI fixes the problem.

More information is needed:

  • Which version of Debian are you running? (run uname -a to check)
  • Which version of Prometheus have you downloaded? (prometheus --version gives that info, if you're unsure)

Have you also installed prometheus-node-exporter, along with Prometheus?

Since your Prometheus installation is broken, it would be easiest to remove the version you got, as you haven't really used it yet, and start over.

Your options are:

Option 1: Use the version from the official Debian repo

In this case, run the following:

sudo apt update
sudo apt install prometheus prometheus-node-exporter

And then check that everything is working:

sudo systemctl is-enabled prometheus
sudo systemctl status prometheus
sudo systemctl is-enabled prometheus-node-exporter
sudo systemctl status prometheus-node-exporter

This page explains the whole process of setting up Prometheus properly, together with its needed components, for Debian 12 (the current stable version).

Option 2: Use a Docker image

This is by far the easiest option, if you can use Docker images. Just do:

docker run -p 9090:9090 prom/prometheus

This starts Prometheus with a sample configuration and exposes it on port 9090. Follow the instructions in the official installation documentation for further steps.

Option 3: Use a precompiled binary

Download the latest .tar.gz archive from the downloads page, unzip it and try it out. You can follow the instructions in this page for setting everything up. The instructions are for Debian 11, but they are applicable for all versions.

Option 4: Compile it yourself

This is the hardest option, and you really don't need to compile everything on your own if you are OK with the options above. You can find instructions for compiling a version yourself in the README found in the Prometheus github page.

Getting started

After choosing an option from above, check out the Prometheus getting started page for next steps.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745094919a4610917.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信