Table of Contents
legacy_alerting
Alerting Objects
class Alerting()
The class includes all necessary methods to access the Grafana legacy alerting API endpoints
Arguments:
grafana_api_model
APIModel - Inject a Grafana API model object that includes all necessary values and information
Attributes:
grafana_api_model
APIModel - This is where we store the grafana_api_model
get_alerts
def get_alerts(custom_querystring: str = None) -> list
The method includes a functionality to get the legacy alerts
Arguments:
custom_querystring
str - Specify the custom querystring (default None)
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
list - Returns a list of all alerts
get_alerts_by_dashboard_ids
def get_alerts_by_dashboard_ids(dashboard_ids: list) -> list
The method includes a functionality to get legacy alerts specified by the dashboard ids
Arguments:
dashboard_ids
list - Specify the list of dashboard ids
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
list - Returns a list of alerts
get_alert_by_id
def get_alert_by_id(id: int) -> dict
The method includes a functionality to get the legacy alert specified by the alert id
Arguments:
id
int - Specify the id of the legacy alert
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns an alert
pause_alert_by_id
def pause_alert_by_id(id: int, paused: bool = True)
The method includes a functionality to pause/ unpause a legacy alert specified by the alert id
Arguments:
id
int - Specify the id of the legacy alertpaused
bool - Specify the pause/ unpause parameter (default True)
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
None