line / promgen

Promgen is a configuration file generator for Prometheus
https://line.github.io/promgen/
MIT License
1.06k stars 150 forks source link

promgen web worker bad request #318

Open like-inspur opened 3 years ago

like-inspur commented 3 years ago

I run promgen following the docs, bootstrap, migrate, check and createsuperuser all run normally But after run web server, when I access server , it outputs Bad Request (400) the logs of promgen don't output error

root@mgt01:~# docker run --rm -p 8001:8000 -v ~/.config/promgen:/etc/promgen/ line/promgen:v0.50
[2021-03-11 08:17:57 +0000] [1] [INFO] Starting gunicorn 19.9.0
[2021-03-11 08:17:57 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2021-03-11 08:17:57 +0000] [1] [INFO] Using worker: sync
[2021-03-11 08:17:57 +0000] [8] [INFO] Booting worker with pid: 8
[2021-03-11 08:17:57 +0000] [9] [INFO] Booting worker with pid: 9
[2021-03-11 08:17:57 +0000] [10] [INFO] Booting worker with pid: 10
[2021-03-11 08:17:57 +0000] [11] [INFO] Booting worker with pid: 11
[2021-03-11 08:18:33 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:8)
[2021-03-11 08:18:33 +0000] [8] [INFO] Worker exiting (pid: 8)
[2021-03-11 08:18:33 +0000] [28] [INFO] Booting worker with pid: 28

the config of promgen is right like below

cat .config/promgen/CELERY_BROKER_URL 
redis://100.105.240.158:6379/0 

cat .config/promgen/DATABASE_URL 
mysql://root:Jya3QE7M0e@100.105.181.245/promgen

cat .config/promgen/promgen.yml 
# Prometheus settings
# These are used for Promgen to automatically trigger a reload on target changes
prometheus:
  url: http://100.105.10.77:9090/
  # Path to promtool to verify valid rules file
  promtool: /usr/local/bin/promtool
  # Output rule configuration to this path
  rules: /etc/prometheus/promgen.rule.yml
  # Output blackbox configuration to this path
  blackbox: /etc/prometheus/blackbox.json
  # Output target configuration to this path
  targets: /etc/prometheus/promgen.json

alertmanager:
  url: http://100.105.217.142:9093
  # Blacklist labels we want to filter out and prevent
  # sending alerts on
  blacklist:
    severity: ["debug", "blackhole"]

# Sender Configuration Settings
# These match the module path of the plugin itself
promgen.notification.email:
  sender: promgen@example.com
promgen.notification.ikasan:
  server: http://ikasan.example
promgen.notification.linenotify:
  server: https://notify.example

cat .config/promgen/SECRET_KEY 
123456a?
kfdm commented 3 years ago

Do you have ALLOWED_HOSTS set ? https://docs.djangoproject.com/en/3.1/ref/settings#allowed-hosts It's possible I do not have this documented well 🙇

You can set it to * to disable this check

like-inspur commented 3 years ago

yes, add it on https://github.com/line/promgen/pull/319