tb_pulumi.monitoring¶
Common code related to monitoring patterns.
- class tb_pulumi.monitoring.AlarmGroup(pulumi_type: str, name: str, monitoring_group: MonitoringGroup, project: ThunderbirdPulumiProject, resource: Resource, opts: ResourceOptions = None, tags: dict = {})¶
Bases:
ThunderbirdComponentResource
A collection of alarms set up to monitor a particular single resource. For example, there are multiple metrics to alarm on pertaining to a load balancer. An
AlarmGroup
would collect all of those alarms under one object. This class should be considered a base class for building more sophisticated alarm groups.- Parameters:
pulumi_type (str) – The “type” string (commonly referred to in docs as just
t
) of the component as described by Pulumi’s docs.name (str) – The name of the
AlarmGroup
resource.monitoring_group (MonitoringGroup) – The
MonitoringGroup
that thisAlarmGroup
belongs to. This is how configuration overrides are delivered from the YAML config file to the individual alarm groups.project (tb_pulumi.ThunderbirdPulumiProject) – The
ThunderbirdPulumiProject
whose resources are being monitored.resource (pulumi.Resource) – The Pulumi
Resource
object thisAlarmGroup
is building alarms for.opts (pulumi.ResourceOptions, optional) – Additional
pulumi.ResourceOptions
to apply to this resource. Defaults to None.tags (dict, optional) – Key/value pairs to merge with the default tags which get applied to all resources in this group. Defaults to {}.
- property overrides: dict¶
If the user has configured any overrides for alarms related to this resource, this function returns them.
- class tb_pulumi.monitoring.MonitoringGroup(pulumi_type: str, name: str, project: ThunderbirdPulumiProject, type_map: dict, config: dict = {}, opts: ResourceOptions = None, tags: dict = {})¶
Bases:
ThunderbirdComponentResource
A broad-scope approach to aggregate resource monitoring. A
MonitoringGroup
is a very thin class that should be extended to provide specific monitoring solutions for the resources contained in the specifiedproject
.- Parameters:
pulumi_type (str) – The “type” string (commonly referred to in docs as just
t
) of the component as described by Pulumi’s type docs.name (str) – The name of the
MonitoringGroup
resource.project (tb_pulumi.ThunderbirdPulumiProject) – The
ThunderbirdPulumiProject
to build monitoring resources for.type_map (dict[type, type]) – A dict where the keys are
pulumi.Resource
derivatives representing types of resources this monitoring group recognizes, and where the values aretb_pulumi.monitoring.AlarmGroup
derivatives which actually declare those monitors. For example, anaws.cloudfront.Distribution
key might map to atb_pulumi.cloudwatch.CloudFrontDistributionAlarmGroup
value.config (dict, optional) –
A configuration dictionary. The specific format and content of this dictionary is defined in part by classes extending this class. However, the dictionary should be configured in the following broad way, with downstream monitoring groups defining the specifics of the monitor configs (shown here as YAML):
1--- 2alarms: 3 name-of-the-resource-being-monitored: 4 monitor_name: 5 enabled: False 6 # Downstream monitoring groups tell you what else goes right here
This config defines override settings for alarms whose default configurations are insufficient for a specific use case. Since each resource can have multiple alarms associated with it, the
"alarm"
dict’s keys should be the names of Pulumi resources being monitored. Their values should also be dictionaries, and those keys should be the names of the alarms as defined in the documentation for those alarm groups.All alarms should respond to a boolean
"enabled"
value such that the alarm will not be created if this isFalse
. Beyond that, configure each alarm as described in its alarm group documentation. Defaults to {}.opts (pulumi.ResourceOptions, optional) – Additional
pulumi.ResourceOptions
to apply to this resource. Defaults to None.tags (dict, optional) – Key/value pairs to merge with the default tags which get applied to all resources in this group. Defaults to {}.
- all_outputs¶
All Pulumi Outputs in the project
- all_resources¶
All items in the project which are already-resolved pulumi resources
- abstractmethod classmethod monitor(outputs)¶
This function gets called after all of a project’s outputs have been recursively unpacked and resolved, and after this class’s post-apply construction has completed.
This is an abstract method which must be implemented by an inheriting class. That function should construct all monitors for the supported resources in this project within this function. This function is essentially a hand-off to an implementing class, an indicator that the project has been successfully parsed, and monitors can now be built.
Because this works as an extension of
__init__
, thefinish
call for downstream monitoring groups should be made from within this function instead of the constructor.- Parameters:
outputs (list) – A list of resolved outputs discovered in the project.
- supported_resources¶
All resources in the project which have an entry in the type_map; this may contain Outputs, which will be resolved by the time
tb_pulumi.monitoring.MonitoringGroup.monitor()
is invoked.