Resource operations¶
grafanarmadillo.find¶
Find Grafana dashboards and folders.
- class grafanarmadillo.find.Finder(api: GrafanaApi)[source]¶
Collection of methods for finding Grafana dashboards and folders.
- create_or_get_alert(path: str) Tuple[AlertSearchResult, Folder][source]¶
Get the information about an alert or create a new “empty” alert if it does not exist.
Creating an “empty” alert in Grafana requires filling in a rule. We can fake that with a math rule that always returns 0.
- create_or_get_dashboard(path: str) Tuple[DashboardSearchResult, Folder | None][source]¶
Create a new empty dashboard if it does not exist.
Returns the search information if it does
- create_or_get_folder(name: str) Folder[source]¶
Create a new folder if it does not exist.
Returns the search information if it does.
- find_dashboards(name: str) List[DashboardSearchResult][source]¶
Find all dashboards with a name. Returns exact matches only.
- get_alert(folder_name, alert_name) AlertSearchResult[source]¶
Get an alert by its parent folder and alert name.
- get_alert_from_path(path) AlertSearchResult[source]¶
Get an alert from a string path like /folder0/alert0.
- get_dashboard(folder_name: str, dashboard_name: str) DashboardSearchResult[source]¶
Get a dashboard by its parent folder and dashboard name.
Dashboards without a parent are children of the “General” folder.
- get_dashboards_in_folders(folder_names: List[str]) List[DashboardSearchResult][source]¶
Get all dashboards in folders.
- get_folder(name) Folder[source]¶
Get a folder by name. Folders don’t nest, so this will return at most 1 folder.
- get_from_path(path) DashboardSearchResult | AlertSearchResult[source]¶
Get a dashboard from a string path like /folder0/dashboard0.
- list_alerts() List[AlertSearchResult][source]¶
List all alerts.
- list_dashboards() List[DashboardSearchResult][source]¶
List all dashboards.
grafanarmadillo.dashboarder¶
Push and pull Grafana dashboards.
- class grafanarmadillo.dashboarder.Dashboarder(api: GrafanaApi)[source]¶
Collection of methods for managing dashboards.
- export_dashboard(dashboard: DashboardSearchResult) Tuple[DashboardContent, Folder | None][source]¶
Export a dashboard from grafana, with its folder information if applicable.
- get_dashboard_content(dashboard: DashboardSearchResult) DashboardContent[source]¶
Get the contents of a Grafana dashboard.
- import_dashboard(content: DashboardContent, folder: Folder | None = None)[source]¶
Import a dashboard into Grafana, optionally into a folder.
- set_dashboard_content(dashboard: DashboardSearchResult, content: DashboardContent)[source]¶
Set the content of a Grafana dashboard.
This explicitly leaves out the identity information. That allows you to graft the contents of a dashboard into another
grafanarmadillo.alerter¶
Push and pull Grafana alerts.
- class grafanarmadillo.alerter.Alerter(api: GrafanaApi, disable_provenance=True)[source]¶
Collection of methods for managing alert rules.
- export_alert(alert: AlertSearchResult) Tuple[AlertContent, Folder | None][source]¶
Export an alert from Grafana and its folder information too.
grafanarmadillo.templator¶
Make and fill templates for dashboards.
- class grafanarmadillo.templator.Templator(make_template: ~typing.Callable[[DashboardContent], DashboardContent] = <function nop>, fill_template: ~typing.Callable[[DashboardContent], DashboardContent] = <function nop>)[source]¶
Collection of methods for filling and making templates.
- make_dashboard_from_template(dashboard_info: DashboardSearchResult, template: DashboardContent) DashboardContent[source]¶
Inflate a template.
- grafanarmadillo.templator.combine_transformers(*transformers: Callable[[DashboardContent], DashboardContent]) Callable[[DashboardContent], DashboardContent][source]¶
Chain transformers together into one big transformer.
- grafanarmadillo.templator.findreplace(context: Dict[str, str]) Callable[[DashboardContent], DashboardContent][source]¶
Make DashboardTransformer to make replacements in strings in dashboards.