Open permission denied while accessing the prometheus consoles

I recently installed Prometheus server manually by downloading the tar.gz file from the official website and extracting its contents into the appropriate directories.

The Prometheus server systemd unit file looks as below:

[Unit]
Description=Prometheus Monitoring
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--storage.tsdb.retention=60d \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.config.file=/etc/prometheus/server_web.yml
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

The service is up and running without any errors.
When I tried to access the consoles section of the web UI at “http://192.168.1.1:9090/consoles/index.html

I get the following error:

open /etc/prometheus/consoles/index.html: permission denied

I checked the directory and file permissions and they looks fine.

# ls -lha /etc/prometheus/consoles
total 48K
drw-r-xr-x 2 prometheus prometheus 4.0K Sep 24 20:32 .
drwxr-xr-x 4 prometheus prometheus 4.0K Sep 24 15:36 ..
-rw-r-xr-x 1 prometheus prometheus  616 Sep 24 20:32 index.html
-rw-r-xr-x 1 prometheus prometheus  616 Sep  3 19:24 index.html.example
-rw-r-xr-x 1 prometheus prometheus 2.7K Sep  3 19:24 node-cpu.html
-rw-r-xr-x 1 prometheus prometheus 3.5K Sep  3 19:24 node-disk.html
-rw-r-xr-x 1 prometheus prometheus 1.5K Sep  3 19:24 node.html
-rw-r-xr-x 1 prometheus prometheus 5.7K Sep  3 19:24 node-overview.html
-rw-r-xr-x 1 prometheus prometheus 1.4K Sep  3 19:24 prometheus.html
-rw-r-xr-x 1 prometheus prometheus 4.1K Sep  3 19:24 prometheus-overview.html

AND

# ls -lha /etc/prometheus/console_libraries/
total 20K
drw-r-xr-x 2 prometheus prometheus 4.0K Sep 24 20:40 .
drwxr-xr-x 4 prometheus prometheus 4.0K Sep 24 15:36 ..
-rw-r-xr-x 1 prometheus prometheus 2.9K Sep  3 19:24 menu.lib
-rw-r-xr-x 1 prometheus prometheus 6.1K Sep  3 19:24 prom.lib

I even tried to enabling the debug mode for logging using the start-up parameter:

–log.level=debug

But it doesn’t added any detailed information on the permission error as well.

Would like to know what would be the next step to figure out the issue with the permissions and get the consoles section working.

do you have selinux enabled?

Hello @roidelapluie

Apologies for the late reply.

Regarding the SELinux status. It’s disabled. I’m running on CentOS 7.

# getenforce
Disabled

Is there any log files or command-line flags that can help debug this issue?

Thanks in advance.

drw-r-xr-x 2 prometheus prometheus 4.0K Sep 24 20:32

You need to do:

chmod +x /etc/prometheus/consoles /etc/prometheus

Somehow the permissions on your filesystem are not correct.