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_modelAPIModel - Inject a Grafana API model object that includes all necessary values and information
Attributes:
grafana_api_modelAPIModel - 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_querystringstr - Specify the custom querystring (default None)
Raises:
ValueError- Missed specifying a necessary valueException- Unspecified error by executing the API call
Returns:
api_calllist - 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_idslist - Specify the list of dashboard ids
Raises:
ValueError- Missed specifying a necessary valueException- Unspecified error by executing the API call
Returns:
api_calllist - 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:
idint - Specify the id of the legacy alert
Raises:
ValueError- Missed specifying a necessary valueException- Unspecified error by executing the API call
Returns:
api_calldict - 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:
idint - Specify the id of the legacy alertpausedbool - Specify the pause/ unpause parameter (default True)
Raises:
ValueError- Missed specifying a necessary valueException- Unspecified error by executing the API call
Returns:
None