Yes, there is a management REST API call to do this:
https://prometheus.io/docs/prometheus/latest/management_api/#reload
which you need to enable with "--web.enable-lifecycle"

Alternatively, you can send a HUP to the process (although you'll need 
permissions to do this, i.e. run your script as the same user as 
prometheus, or as root).

With systemd I use

[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

and then "systemctl reload prometheus" will reload the config (without 
doing a full restart)

On Friday, 17 September 2021 at 17:58:55 UTC+1 [email protected] wrote:

> I'm using the Prometheus community.
>
> I am creating my custom python script. It can generate the rules and 
> update them and store them as a YAML file that will be read by Prometheus 
> in the server. but when I am running my python script and update the rule 
> but in the Prometheus server does not reload the rules automatically. It is 
> possible?
> Thank you
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/d849f29a-c6be-493d-849e-4839196265a2n%40googlegroups.com.

Reply via email to