-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContactPoints: incorrect substitution of enviroment values in yaml config #69950
Comments
We have confirmed the bug. The substitution works for e.g. |
The issue is in the https://github.com/grafana/grafana/tree/main/pkg/services/provisioning package |
@armandgrillet I was able to reproduce the issue but I'm not sure how to fix this: The alerting.AlertingFileV1
but it's transformed to string in transformInterface() how do you suggest to catch this case? is there a reason that the |
Did you manage to solve the problem? |
With this commit, the ChatID and MessageThreadID configuration of the Telegram notifier now can be configured either with a string or an integer, without any breaking changes for anyone consuming this library or the end users using it in their configuration files. Fixes grafana/grafana#69950
I have this issue in grafana 11.0.0 and managed to handle using this syntax:
where $TELEGRAM_CHAT_ID is actual chat id (including starting |
It's work for me too. Thanks |
With this commit, the ChatID and MessageThreadID configuration of the Telegram notifier now can be configured either with a string or an integer, without any breaking changes for anyone consuming this library or the end users using it in their configuration files. Fixes grafana/grafana#69950
With this commit, the ChatID and MessageThreadID configuration of the Telegram notifier now can be configured either with a string or an integer, without any breaking changes for anyone consuming this library or the end users using it in their configuration files. Fixes grafana/grafana#69950
What went wrong?
What happened:
In configuration file
etc/grafana/provisioning/alerting/default.yml
the Point of Contact for the telegram is declared, the ChatId value is taken from the environment variables.
env variable value
TELEGRAM_CHAT_ID="-808008888"
When starting grafana, an error pops up:
Error: ✗ failure to map file default.yml: failure parsing contact points: Telegram: failed to validate receiver of type "telegram": failed to unmarshal settings: json: cannot unmarshal number into Go struct field Config.chatid of type string
The problem is not solved, even if you wrap the value in quotes:
chatid: "$TELEGRAM_CHAT_ID"
The problem was solved temporarily through a crutch:
env variable value
TELEGRAM_CHAT_ID="808008888"
in config:
The problem is that when substituting a value from an environment variable, it is interpreted as a negative number, and not as a string, which the structure expects.
How do we reproduce it?
In configuration file
etc/grafana/provisioning/alerting/default.yml
where
$TELEGRAM_CHAT_ID
is number.What Grafana version are you using?
v9.5.2
Optional Questions:
Is the bug inside a Dashboard Panel?
Copy the panel's "get-help" data here
Grafana Platform?
Docker
User's OS?
No response
User's Browser?
No response
Is this a Regression?
None
Are Datasources involved?
No response
Anything else to add?
No response
The text was updated successfully, but these errors were encountered: