Skip to content
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

Question / Request for guidance on provisioning Alerting resources (rules, contact points, etc.) #104

Open
matagyula opened this issue Oct 2, 2024 · 0 comments
Labels
question Further information is requested

Comments

@matagyula
Copy link

matagyula commented Oct 2, 2024

First of all, thank you for working on this SDK! I am quite a novice when it comes to Python (and to working with REST APIs), and am having a hard time producing the simplest example for creating a new alert rule with this SDK (for what it's worth, I did manage to create a Dashboard using a JSON template).

I suppose that I am feeding the wrong kind of data/template to the function:

...
alerting: Alerting = Alerting(model)
alert_json = "JSON/alert_template.json"

with open(alert_json) as file:
    json_alert = json.load(file)

try:
    alerting.create_or_update_alertmanager_alerts(json_alert, "grafana")
...

Which throws the error message: AttributeError: 'str' object has no attribute 'starts_at'

The JSON template I am trying I got from the Grafana API overview in the Swagger Editor ... I have added the "starts_at" record to the JSON, but no luck.

Thank you for your help in advance, kind regards,
Gyuszi

EDIT: I should be using "alerting_provisioning", not just alerting, sorry about that.

@ZPascal ZPascal added the question Further information is requested label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants