Table of Contents
- model
- APIEndpoints
- RequestsMethods
- APIModel
- DatasourceQuery
- DatasourceRuleQuery
- DatasourcePermission
- Alert
- AlertRuleQueryModelCondition
- AlertRuleQueryModel
- AlertQuery
- AlertRule
- EmbeddedContactPoint
- MatchType
- Matcher
- Route
- TimeRange
- TimeInterval
- MuteTimeInterval
- Silence
- AlertmanagerConfig
- AlertmanagerReceivers
- RulerRule
- UserObject
- PlaylistObject
- PlaylistItemObject
- TeamObject
- QueryDatasourceObject
- QueryObject
- CorrelationObject
- FindAnnotationObject
- AnnotationObject
- AnnotationGraphiteObject
- GlobalUser
- RolePermission
- CustomRole
- DatasourceCache
- PublicDashboard
- SSOSetting
- DashboardSchema
- Report
- ReportBrandingSettings
model
APIEndpoints Objects
class APIEndpoints(Enum)
The class includes all necessary API endpoint strings to connect the Grafana API
RequestsMethods Objects
class RequestsMethods(Enum)
The class includes all necessary method values to establish an HTTP/ HTTPS connection to the Grafana API endpoints
APIModel Objects
@dataclass
class APIModel()
The class includes all necessary variables to establish a connection to the Grafana API endpoints
Arguments:
hoststr - Specify the host of the Grafana systemtokenstr - Specify the access token of the Grafana systemusernamestr - Specify the username of the Grafana systempasswordstr - Specify the password of the Grafana systemtimeoutfloat - Specify the timeout of the Grafana systemheadersdict - Specify the headers of the Grafana systemhttp2_supportbool - Specify if you want to use HTTP/2ssl_contextssl.SSLContext - Specify the custom ssl context of the Grafana systemnum_poolsint - Specify the number of the connection poolretriesany - Specify the number of the retries. Please use False as parameter to disable the retriesfollow_redirectsbool - Specify if redirections should be followed (default True)
DatasourceQuery Objects
@dataclass
class DatasourceQuery()
The class includes all necessary variables to specify a query for the datasource search endpoint
Arguments:
datasource_idint - Specify the id of the data sourceraw_sqlstr - Specify the raw SQL string to search inside the Grafana systemref_idstr - Specify a reference id of the search command (default A)interval_msint - Specify the time interval in milliseconds of output format (default 1000)max_data_pointsint - Specify maximum amount of data points that dashboard panel can render (default 100)output_formatstr - Specify the output format of the query (default time_series)
DatasourceRuleQuery Objects
@dataclass
class DatasourceRuleQuery()
The class includes all necessary variables to specify a query for the datasource rule search endpoint
Arguments:
datasource_uidstr - Specify the uid of the data sourcemodeldict - Specify the model of the search commandquery_typestr - Specify the query time of the search commandref_idstr - Specify a reference id of the search commandrelative_time_rangedict - Specify the related time range of the search command
DatasourcePermission Objects
@dataclass
class DatasourcePermission()
The class includes the necessary variables to generate a datasource permission object that is necessary to communicate with the Grafana datasource permissions endpoint
Arguments:
permissionUnion[str, None] - Specify the datasource permission. Can be query, edit, admin or None. To remove a permission, set the permission value to None
Raises:
ValueError- Missed specifying a necessary value
Returns:
permissionstr - Returns the datasource permission
Alert Objects
@dataclass
class Alert()
The class includes all necessary variables to generate an alert object that is necessary to communicate with the Grafana alert endpoint
Arguments:
starts_atstr - Specify the start date of the alertends_atstr - Specify end date of the alertannotationsdict - Specify the annotations of the alertgenerator_urlstr - Specify the url of the generator endpointlabelsdict - Specify labels of the alert
AlertRuleQueryModelCondition Objects
@dataclass
class AlertRuleQueryModelCondition()
The class includes all necessary variables to generate an alert rule query model condition object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
evaluator_paramslist - Specify the evaluator parametersevaluator_typestr - Specify the evaluator typeoperator_typestr - Specify the operator typequery_paramslist - Specify the query parametersreducer_paramslist - Specify the reducer parametersreducer_typestr - Specify the reducer typetypestr - Specify the type
AlertRuleQueryModel Objects
@dataclass
class AlertRuleQueryModel()
The class includes all necessary variables to generate an alert rule query model object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
conditionslist - Specify the conditions list based on the AlertRuleQueryModelCondition objectsdatasourcedict - Specify the datasource dictionaryexpressionstr - Specify the expression stringhidebool - Specify the if the query should be hidedinterval_msint - Specify the interval in msmax_data_pointsint - Specify the max data pointsref_idstr - Specify the unique identifier of the alert rule query modeltypestr - Specify the corresponding type
AlertQuery Objects
@dataclass
class AlertQuery()
The class includes all necessary variables to generate an alert query object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
datasource_uidstr - Specify the datasource uidmodelAlertRuleQueryModel - Specify the model as AlertRuleQueryModelquery_typestr - Specify the query typeref_idstr - Specify the unique identifier of the alert queryrelative_time_range_fromint - Specify the relative from time rangerelative_time_range_toint - Specify the relative to time range
AlertRule Objects
@dataclass
class AlertRule()
The class includes all necessary variables to generate an alert rule object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
conditionstr - Specify the conditiondatalist - Specify the data as AlertQuery listexec_err_statestr - Specify the execution error statefolder_uidstr - Specify the folder uidno_data_statestr - Specify the no data stateorg_idint - Specify the org idrule_groupstr - Specify the rule group of the alert ruletitlestr - Specify the title of the alert ruleuidstr - Specify the uid of the alert rulefor_timeint - Specify the for duration as integerannotationsdict - Specify the annotations dictionary (default None)updatedstr - Specify the updated date time as string (default None)provenancestr - Specify the provenance (default None)idint - Specify the alert rule id (default 0)labelsdict - Specify the labels as dictionary (default None)
EmbeddedContactPoint Objects
@dataclass
class EmbeddedContactPoint()
The class includes all necessary variables to generate an embedded contact point object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
namestr - Specify the name of the embedded contact pointtypestr - Specify the type of the embedded contact pointsettingsdict - Specify the settings of the embedded contact pointdisable_resolve_messagebool - Specify if the resolve message should be disabled (default None)provenancestr - Specify the provenance (default None)uidstr - Specify the uid of the embedded contact point (default None)
MatchType Objects
class MatchType(Enum)
The class includes all necessary values to set the corresponding match type
Matcher Objects
@dataclass
class Matcher()
The class includes all necessary variables to generate an alert rule route matcher object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
namestr - Specify the name of the matchertypeMatchType - Specify the type of the matchervaluestr - Specify the value of the matcher
Route Objects
@dataclass
class Route()
The class includes all necessary variables to generate an alert rule route that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
continue_parameterbool - Specify the continue parametergroup_by_strList[str] - Specify the list of group by stringsreceiverstr - Specify the receiverprovenancestr - Specify the provenanceobject_matchersList[Matcher] - Specify the list of object matchers (default None)group_intervalstr - Specify the group time interval (default None)group_waitstr - Specify the group wait time (default None)repeat_intervalstr - Specify the repeat interval (default None)routesList[Route] - Specify the list of routes (default None)mute_time_intervalsList[str] - Specify the mute time interval as list (default None)
TimeRange Objects
@dataclass
class TimeRange()
The class includes all necessary variables to generate a time range object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
start_timestr - Specify the start time e.g. 14:00start_timestr - Specify the end time e.g. 15:00
TimeInterval Objects
@dataclass
class TimeInterval()
The class includes all necessary variables to generate a time interval object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
days_of_monthList[str] - Specify the days of month list (default None)monthsList[str] - Specify the months list (default None)timesTimeRange - Specify the times list (default None)weekdaysList[str] - Specify the weekdays list (default None)yearsList[str] - Specify the year range list (default None)
MuteTimeInterval Objects
@dataclass
class MuteTimeInterval()
The class includes all necessary variables to generate a mute time interval object that is necessary to communicate with the Grafana alert provisioning endpoint
Arguments:
namestr - Specify the name of the mute time interval.time_intervalsList[TimeInterval] - Specify the list of time interval objects
Silence Objects
@dataclass
class Silence()
The class includes all necessary variables to generate a silence object that is necessary to communicate with the Grafana silence endpoint
Arguments:
starts_atstr - Specify the start date of the silencecreated_bystr - Specify the name of the silence creatorends_atstr - Specify end date of the silencecommentstr - Specify a custom comment for the silenceidstr - Specify an id for the silencematchersdict - Specify matchers for the silence
AlertmanagerConfig Objects
@dataclass
class AlertmanagerConfig()
The class includes all necessary variables to generate an Alertmanager config object that is necessary to communicate and set up the Grafana Alertmanager endpoint
Arguments:
global_configUnion[dict, None] - Specify the global config of the Alertmanagerinhibit_rulesUnion[list, None] - Specify the inhibit rules of the Alertmanagermute_time_intervalsUnion[list, None] - Specify the mute time intervals of the Alertmanagerreceiverslist - Specify the receiver's of the Alertmanagerroutedict - Specify the route of the AlertmanagertemplatesUnion[list, None] - Specify an Alertmanager template
AlertmanagerReceivers Objects
@dataclass
class AlertmanagerReceivers()
The class includes all necessary variables to generate an Alertmanager receiver's object that is necessary to communicate and set up the Grafana Alertmanager receivers endpoint
Arguments:
namestr - Specify the name of the receiveremail_configsUnion[list, None] - Specify the email configuration of the receiver'sgrafana_managed_receiver_configslist - Specify the Grafana managed receiver configuration of the receiver'sopsgenie_configsUnion[list, None] - Specify the ops genie configuration of the receiver'spagerduty_configsUnion[list, None] - Specify the pager duty configuration of the receiver'spushover_configsUnion[list, None] - Specify the push over configuration of the receiver'sslack_configsUnion[list, None] - Specify the Slack configuration of the receiver'ssns_configsUnion[list, None] - Specify the SNS configuration of the receiver'svictorops_configsUnion[list, None] - Specify the victor ops configuration of the receiver'swebhook_configsUnion[list, None] - Specify the webhook configuration of the receiver'swechat_configsUnion[list, None] - Specify the wechaty configuration of the receiver's
RulerRule Objects
@dataclass
class RulerRule()
The class includes all necessary variables to generate a Ruler rule object that is necessary to communicate and set up a Grafana Ruler rule
Arguments:
alertstr - Specify the name of the ruleannotationsdict - Specify the annotations of the ruleexprstr - Specify the expression of the rulegrafana_alertdict - Specify the Grafana alert of the rulelabelsdict - Specify labels of the rulerecordstr - Specify recode value of the rulefor_idint - Specify the id of the rule if you update an existing rule (default 0)
UserObject Objects
@dataclass
class UserObject()
The class includes all necessary variables to generate a User object that is necessary to update a Grafana User
Arguments:
emailstr - Specify the name of the rulenamestr - Specify the annotations of the ruleloginstr - Specify the expression of the rulethemestr - Specify the Grafana alert of the rule
PlaylistObject Objects
@dataclass
class PlaylistObject()
The class includes all necessary variables to generate a playlist object
Arguments:
namestr - Specify the name of the playlistintervalstr - Specify the interval of the playlistitemslist - Specify a list of PlaylistItemObjects
PlaylistItemObject Objects
@dataclass
class PlaylistItemObject()
The class includes all necessary variables to generate a playlist item object that is necessary to update a playlist
Arguments:
typestr - Specify the type of the playlist itemvaluestr - Specify the value of the playlist itemorderint - Specify the order of the playlist itemtitlestr - Specify the title of the playlist item
TeamObject Objects
@dataclass
class TeamObject()
The class includes all necessary variables to generate a team object that is necessary to create a team
Arguments:
namestr - Specify the name of the teamemailstr - Specify the email of the teamorg_idint - Specify the org_id of the team
QueryDatasourceObject Objects
@dataclass
class QueryDatasourceObject()
The class includes all necessary variables to generate a query datasource object that is necessary to create a query history object
Arguments:
typestr - Specify the type of the datasource queryuidstr - Specify the uid of the datasource query
QueryObject Objects
@dataclass
class QueryObject()
The class includes all necessary variables to generate a query object that is necessary to create a query history
Arguments:
ref_idstr - Specify the ref_id of the query historykeystr - Specify the key of the query historyscenario_idstr - Specify the scenario_id of the query historydatasourceQueryDatasourceObject - Specify the datasource of the type QueryDatasourceObject
CorrelationObject Objects
@dataclass
class CorrelationObject()
The class includes all necessary variables to generate a find annotation object
Arguments:
source_datasource_uidstr - Specify the source datasource uid (default None)target_datasource_uidstr - Specify the target datasource uid (default None)labelstr - Specify the label (default 100)descriptionstr - Specify the description (default None)config_typestr - Specify the config type (default None)config_fieldstr - Specify the config field (default None)config_targetstr - Specify the config target (default None)
FindAnnotationObject Objects
@dataclass
class FindAnnotationObject()
The class includes all necessary variables to generate a find annotation object
Arguments:
from_valueint - Specify the optional from value (default None)to_valueint - Specify the optional to value (default None)limitint - Specify the optional limit (default 100)alert_idint - Specify the optional alert id (default None)dashboard_idint - Specify the optional dashboard id (default None)panel_idint - Specify the optional panel_id (default None)user_idint - Specify the optional user id (default None)typestr - Specify the optional type e.g. alert or annotation (default None)tagslist - Specify the optional tags (default None)
AnnotationObject Objects
@dataclass
class AnnotationObject()
The class includes all necessary variables to generate an annotation object
Arguments:
timeint - Specify the time as number in millisecondstime_endint - Specify the end time as number in millisecondstagslist - Specify the organization annotation tags from a data source that are not connected specifically to a dashboard or paneltextstr - Specify the annotation description messagedashboard_uidstr - Specify the optional dashboard_uid (default None)panel_idint - Specify the optional panel_id (default None)
AnnotationGraphiteObject Objects
@dataclass
class AnnotationGraphiteObject()
The class includes all necessary variables to generate a Graphite annotation object
Arguments:
whatstr - Specify the event of the annotationtagslist - Specify the organization annotation tags from a data source that are not connected specifically to a dashboard or panelwhenint - Specify the optional time as number in millisecondsdatastr - Specify the optional annotation description message
GlobalUser Objects
@dataclass
class GlobalUser()
The class includes all necessary variables to generate a global user object
Arguments:
namestr - Specify the name of the useremailstr - Specify the email of the userloginstr - Specify the login type of the userpasswordstr - Specify the password of the userorg_idint - Specify the optional org id of the user (default None)
RolePermission Objects
@dataclass
class RolePermission()
The class includes all necessary variables to generate a role permission object
Arguments:
actionstr - Specify the custom role action definitionscopestr - Specify the scope definition. If not present, no scope will be mapped to the permission (default None)
CustomRole Objects
@dataclass
class CustomRole()
The class includes all necessary variables to generate a custom role object
Arguments:
namestr - Specify the name of the roleuidstr - Specify the optional uid of the role (default None)global_rolebool - Specify the if the role is global or not. If set to False, the default org id of the authenticated user will be used from the request (default False)versionint - Specify the optional version of the role (default None)descriptionstr - Specify the optional description of the role (default None)display_namestr - Specify the optional display_name of the role (default None)groupstr - Specify the optional org group of the role (default None)hiddenbool - Specify whether the role is hidden or not. If set to True, then the role does not show in the role picker. It will not be listed by API endpoints unless explicitly specified (default False)permissionslist - Specify the optional permissions of the role as a list of the RolePermission objects (default None)
DatasourceCache Objects
@dataclass
class DatasourceCache()
The class includes all necessary variables to generate a datasource cache object
Arguments:
datasource_idint - Specify the datasource iddatasource_uidstr - Specify the datasource uidenabledbool - Specify if caching should be enabled for the datasourceuse_default_ttlbool - Specify if the configured default TTL (Time-To-Live) should be used for both query and resource caching, instead of the user-specified valuesttl_queries_msint - Specify the TTL to use for query caching, in millisecondsttl_resources_msint - Specify the TTL to use for resource caching, in milliseconds
PublicDashboard Objects
@dataclass
class PublicDashboard()
The class includes all necessary variables to generate a public dashboard object
Arguments:
uidstr - Specify the optional unique identifier when creating a public dashboard. If it’s none, it will generate a new uid (default None)access_tokenstr - Specify the optional unique access token. If it’s none, it will generate a new access token (default None)time_selection_enabledbool - Specify the optional enablement of the time picker inside the public dashboard (default False)is_enabledbool - Specify the optional enablement of the public dashboard (default False)annotations_enabledbool - Specify the optional enablement of the annotations inside the public dashboard (default False)sharestr - Specify the optional share mode of the public dashboard (default public)
SSOSetting Objects
@dataclass
class SSOSetting()
The class includes all necessary variables to generate an SSO setting object
Arguments:
api_urlstr - Specify the SSO api urlclient_idstr - Specify the SSO client idclient_secretstr - Specify the SSO client secretenabledbool - Specify if the SSO provider is enabled or notscopesstr - Specify the SSO scopes
DashboardSchema Objects
@dataclass
class DashboardSchema()
The class includes all necessary variables to generate a dashboard schema object that is used for the reporting functionality
Arguments:
dashboard_uidstr - Specify the dashboard uidtime_range_fromstr - Specify the dashboard time range fromtime_range_tostr - Specify the dashboard time range toreport_variablesdict - Specify the key-value pairs containing the template variables for this report, in dict format. If the value is None, the template variables from the reports dashboard will be used (default None)
Report Objects
@dataclass
class Report()
The class includes all necessary variables to generate a report object
Arguments:
namestr - Specify the name of the report that is used as an email subjectrecipientsstr - Specify the comma-separated list of emails to which to send the report toreply_tostr - Specify the comma-separated list of emails used in a reply-to field of the report emailmessagestr - Specify the text message used for the body of the report emailstart_datestr - Specify the distribution starts from this dateend_datestr - Specify the distribution end from this datetime_zonestr - Specify the time zone used to schedule report executionorientationstr - Specify if the orientation should be portrait or landscapelayoutstr - Specify if the layout should be grid or simpleenable_dashboard_urlstr - Specify if the dashboard url should be added to the bottom of the report emaildashboardsList[DashboardSchema] - Specify the dashboards for which the reports should be generatedfrequencystr - Specify how often the report should be sent. Can be once, hourly, daily, weekly, monthly, last or custom. The value last schedules the report for the last day of the month. The value custom schedules the report to be sent on a custom interval. It requires interval_frequency and interval_amount to be specified e.g. every 2 weeks, where 2 is an interval_amount and weeks is an interval_frequency (default last)interval_frequencystr - Specify the type of the custom interval hours, days, weeks, months (default None)interval_amountint - Specify the interval amount of the custom type (default 0)workdays_onlybool - Specify if the report only on Monday-Friday should be sent. Applicable to hourly and daily types of schedule (default None)formatsList[str] - Specify what kind of attachment to generate for the report. Available report formats are csv, pdf and image. The type csv attaches a CSV file for each table panel and the type image embeds an image of a dashboard into the emails body (default List["pdf"])
ReportBrandingSettings Objects
@dataclass
class ReportBrandingSettings()
The class includes all necessary variables to generate a report branding settings object
Arguments:
report_logo_urlstr - Specify the url of an image used as a logo on every page of the reportemail_logo_urlstr - Specify the url of an image used as a logo in the emailemail_footer_modestr - Specify the email footer mode. Can be sent-by or none. The value sent-by adds a 'Sent by email footer text' footer link to the email. Requires specifying values in the email_footer_text and email_footer_link fields. The value none suppresses adding a 'Sent by' footer link to the emailemail_footer_textstr - Specify the text of a URL added to the email 'Sent by' footer (default None)email_footer_linkstr - Specify the url address value added to the email 'Sent by' footer (default None)