That's the correct way to do it - and I've just tested with prometheus 
2.45.0 to be sure.

Therefore, if it's not working, it means you're not applying this option 
correctly. 

Use "ps auxwwww | grep prometheus" to see what actual command line options 
you're passing.

If this is in a .service file, you will need to run "systemctl 
daemon-reload" to get systemd to re-read your modified file, before 
"systemctl restart prometheus"

I prefer to do it like this:

--------
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target

[Service]
User=prometheus
Restart=on-failure
RestartSec=5
TimeoutStopSec=300
WorkingDirectory=/opt/prometheus
EnvironmentFile=/etc/default/prometheus
ExecStart=/opt/prometheus/prometheus $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
--------

where /etc/default/prometheus contains

OPTIONS='--web.enable-admin-api 
--config.file=/etc/prometheus/prometheus.yml 
--storage.tsdb.path=/var/lib/prometheus/data/ 
--storage.tsdb.wal-compression --log.level=info 
--storage.tsdb.retention.time=366d --web.enable-remote-write-receiver'

When you change the options here, no "daemon-reload" is necessary, just a 
restart.

On Wednesday, 16 August 2023 at 14:21:15 UTC+1 Abhishek Kurmi wrote:

> How to change a default port of Prometheus?
> I all ready tried some steps but those are not working.
> I tried to change a port form prometheus.service file 
> --web.listen-address=:9500
> but it is not working , even after that it is running on the default port.
>
> please suggest me how can i can a port?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/0789a6af-8b23-4967-b0a2-b4242980e601n%40googlegroups.com.

Reply via email to