How to migrate PrometheusAlert

Today, I received my Racknerd invoice, which told me my server will be expired at 08/23/2024. However, I have enough servers and I don’t want to renew this one in order to save money. So I need to migrate all service possible before it expired. Tonight is for PrometheusAlert. Let us start it!

How to migrate PrometheusAlert

1
2
scp root@old.server:/etc/prometheusalert-center/app.conf ./
scp ./app.conf root@new.server:/etc/prometheusalert-center/app.conf

Now login to your new server as root.

1
2
3
4
5
6
vim /etc/prometheusalert-center/app.conf #Edit it if you need to change something such as mail server information.
docker run -d -p 8081:8080 -v /etc/prometheusalert-center:/app/conf --name prometheusalert-center feiyu563/prometheus-alert:v4.9.1
684 cat /etc/nginx/sites-available/aka.cy
sudo certbot certonly --nginx -d alert.new.server
ln -s /etc/nginx/sites-available/alert.new.server /etc/nginx/sites-enabled/
vim /etc/nginx/sites-available/alert.new.server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
server {
listen 80;
listen [::]:80;
server_name alert.new.server;

# Redirect all HTTP requests to HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/alert.new.server/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/alert.new.server/privkey.pem;
server_name alert.new.server;
location / {
proxy_pass http://localhost:8081/;
}
}
1
service nginx restart

Then go to your PrometheusAlert webpage on old server to migrate template.

Screenshot 2024-08-09 at 22.18.28

Click export button on the right then you will get a backup file. Then go to your new webpage, choose your file and click import. All done.

Reference

  1. https://github.com/feiyu563/PrometheusAlert/blob/master/doc/readme/base-install.md