Open taabest6 opened 2 years ago
It would be helpful if you could show how you load the environment variables before starting the exporter. An educated guess of mine is that you probably didnt load the environment variables in the correct way.
The behavior of the exporter is working perfectly fine, as you have demonstrated yourself with the systemd file. The line of code is also the canon way to retrieve environment variables: https://pkg.go.dev/os#Getenv. So its highly unlikely that something is wrong in the code and my suspicion stands that the handover/loading of the environment variables is incorrect.
Here a few tips to help you debug/fix it:
MAXSCALE_USERNAME=maxctrl_exporter MAXSCALE_PASSWORD=MySecurePwd /opt/prometheus/maxctrl_exporter/maxctrl_exporter
export
other wise. If not inline
export MAXSCALE_USERNAME=maxctrl_exporter
export MAXSCALE_PASSWORD=MySecurePwd
/opt/prometheus/maxctrl_exporter/maxctrl_exporter
os.Getenv
and print it out. Then try to see which method of env variable setting works for it.
Hi there
We are trying to setup multiple maxctrl_exporters on one host using systemd template unit files.
Therefore we are using environmentfiles like this:
Actual behavior (after systemctl restart): Exporter is scraping MaxScale JSON API at the default port: 127.0.0.1:8989
Log:
Expected behavior: MaxScale JSON API should be scraping the MaxScale JSON API at 127.0.0.1:8990.
Interestingly enough:
This issue is reffering to line 321: https://github.com/vbezgachev/maxctrl_exporter/blob/dad90f843a17796bac10370fa1ffcdfafc9a096f/maxctrl_exporter.go#L321