Skip to content

Prometheus web.yml file generator for basic authentication

License

Notifications You must be signed in to change notification settings

bgelov/prometheus-web-yml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

What kind of script is this?

The script generates a web.yml file with a password hash using bcrypt, which is necessary to enable basic authentication for Prometheus.

How does it work?

The script prompts for username and password. When you enter username and password, you need waiting 10 seconds timeout for bcrypt processing.

  • If there is a web.yml file, you will be prompted to either recreate it or add credentials to the end of the file.
  • If there is no web.yml file, a new file will be generated.

After, you need add web.yml to Prometheus configuration:

--web.config.file=/etc/prometheus/web.yml

Prometheus documentations about basic auth: https://prometheus.io/docs/guides/basic-auth/

Example of a generated file

basic_auth_users:
  test: $2y$17$Ac2deeUOLKZSP2L81awluuTAiisMp46T4NTJ0MX3tpfPXC3MUVl8G

Why is it necessary?

Read the article by JFrog: Don’t let Prometheus Steal your Fire

Add rights for executing .sh file

chmod u+x generate_web_yml.sh