Skip to content

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

Open
@matagyula

Description

@matagyula

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions