aria.ops.definition.group

  1#  Copyright 2022 VMware, Inc.
  2#  SPDX-License-Identifier: Apache-2.0
  3from __future__ import annotations
  4
  5from abc import ABC
  6from collections import OrderedDict
  7from typing import Optional
  8
  9from aria.ops.definition.assertions import validate_key
 10from aria.ops.definition.attribute import Attribute
 11from aria.ops.definition.attribute import MetricAttribute
 12from aria.ops.definition.attribute import PropertyAttribute
 13from aria.ops.definition.exceptions import DuplicateKeyException
 14from aria.ops.definition.units import Unit
 15
 16
 17class GroupType(ABC):
 18    # This is only an Abstract Base Class so that it isn't initialized as a standalone object
 19    def __init__(self) -> None:
 20        self.key: str
 21        self.attributes: dict[str, Attribute] = OrderedDict()
 22        self.groups: dict[str, Group] = OrderedDict()
 23
 24    def define_group(self, key: str, label: Optional[str] = None) -> Group:
 25        """
 26        Create a new group that can hold attributes and subgroups.
 27        :param key: The key for the group.
 28        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 29        :return: The created group.
 30        """
 31        group = Group(key, label)
 32        self.add_group(group)
 33        return group
 34
 35    def define_instanced_group(
 36        self, key: str, label: Optional[str] = None, instance_required: bool = True
 37    ) -> Group:
 38        """
 39        Create a new group that can hold attributes and subgroups. This group can be 'instanced', with a value, so that
 40        its subgroups and attributes can appear multiple times, once for each instance value. For example, a group
 41        containing metrics for a network interface might be instanced for each discovered interface on the parent
 42        object.
 43        :param key: The key for the group.
 44        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 45        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
 46        created both with and without an instance. Creating an instanced group without an instance can be done to
 47        provide a location for aggregate metrics across all instances, for example.
 48        :return: The created group.
 49        """
 50        group = Group(key, label, instanced=True, instance_required=instance_required)
 51        self.add_group(group)
 52        return group
 53
 54    def add_groups(self, groups: list[Group]) -> None:
 55        """
 56        Adds a list of groups as subgroups of this group.
 57        :param groups: A list of groups.
 58        :return: None
 59        """
 60        for group in groups:
 61            self.add_group(group)
 62
 63    def add_group(self, group: Group) -> None:
 64        """
 65        Adds a group as a subgroup of this group.
 66        :param group: A group.
 67        :return: None
 68        """
 69        key = group.key
 70        if key in self.groups:
 71            raise DuplicateKeyException(
 72                f"Group with key {key} already exists in {type(self)} {self.key}."
 73            )
 74        self.groups[key] = group
 75
 76    def define_metric(
 77        self,
 78        key: str,
 79        label: Optional[str] = None,
 80        unit: Optional[Unit] = None,
 81        is_rate: bool = False,
 82        is_discrete: bool = False,
 83        is_kpi: bool = False,
 84        is_impact: bool = False,
 85        is_key_attribute: bool = False,
 86    ) -> MetricAttribute:
 87        """
 88        :param key: Used to identify the parameter.
 89        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 90        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
 91        consistent manner, and perform conversions when appropriate.
 92        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
 93        will be set automatically. Otherwise, defaults to False.
 94        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
 95        (floating point)
 96        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
 97        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
 98        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
 99        proxy to a root cause, but not the root cause itself.
100        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
101        """
102        metric = MetricAttribute(
103            key,
104            label,
105            unit,
106            is_rate,
107            is_discrete,
108            is_kpi,
109            is_impact,
110            is_key_attribute,
111            dashboard_order=len(self.attributes),
112        )
113        self.add_attribute(metric)
114        return metric
115
116    def define_string_property(
117        self,
118        key: str,
119        label: Optional[str] = None,
120        unit: Optional[Unit] = None,
121        is_rate: bool = False,
122        is_discrete: bool = False,
123        is_kpi: bool = False,
124        is_impact: bool = False,
125        is_key_attribute: bool = False,
126    ) -> PropertyAttribute:
127        """
128        :param key: Used to identify the parameter.
129        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
130        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
131        consistent manner, and perform conversions when appropriate.
132        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
133        will be set automatically. Otherwise, defaults to False.
134        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
135        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
136        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
137        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
138        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
139        proxy to a root cause, but not the root cause itself.
140        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
141        """
142        _property = PropertyAttribute(
143            key,
144            label,
145            True,
146            unit,
147            is_rate,
148            is_discrete,
149            is_kpi,
150            is_impact,
151            is_key_attribute,
152            dashboard_order=len(self.attributes),
153        )
154        self.add_attribute(_property)
155        return _property
156
157    def define_numeric_property(
158        self,
159        key: str,
160        label: Optional[str] = None,
161        unit: Optional[Unit] = None,
162        is_rate: bool = False,
163        is_discrete: bool = False,
164        is_kpi: bool = False,
165        is_impact: bool = False,
166        is_key_attribute: bool = False,
167    ) -> PropertyAttribute:
168        """
169        :param key: Used to identify the parameter.
170        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
171        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
172        consistent manner, and perform conversions when appropriate.
173        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
174        will be set automatically. Otherwise, defaults to False.
175        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
176        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
177        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
178        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
179        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
180        proxy to a root cause, but not the root cause itself.
181        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
182        """
183        _property = PropertyAttribute(
184            key,
185            label,
186            False,
187            unit,
188            is_rate,
189            is_discrete,
190            is_kpi,
191            is_impact,
192            is_key_attribute,
193            dashboard_order=len(self.attributes),
194        )
195        self.add_attribute(_property)
196        return _property
197
198    def add_attributes(self, attributes: list[Attribute]) -> None:
199        """
200        Adds a list of attributes to this group.
201        :param attributes: A list of attributes (metric or property definitions).
202        :return: None
203        """
204        for attribute in attributes:
205            self.add_attribute(attribute)
206
207    def add_attribute(self, attribute: Attribute) -> None:
208        """
209        Adds an attribute to this group.
210        :param attribute: An attribute (metric or property definition).
211        :return: None
212        """
213        key = attribute.key
214        if key in self.attributes:
215            raise DuplicateKeyException(
216                f"Attribute with key {key} already exists in {type(self)} {self.key}."
217            )
218
219        self.attributes[key] = attribute
220
221    def to_json(self) -> dict:
222        return {
223            "attributes": [
224                attribute.to_json() for attribute in self.attributes.values()
225            ],
226            "groups": [group.to_json() for group in self.groups.values()],
227        }
228
229
230class Group(GroupType):
231    def __init__(
232        self,
233        key: str,
234        label: Optional[str] = None,
235        instanced: bool = False,
236        instance_required: bool = True,
237    ) -> None:
238        """
239        Create a new group that can hold attributes and subgroups.
240        :param key: The key for the group.
241        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
242        :param instanced: If True, this group can be 'instanced' with a value, so that its subgroups and attributes can
243        appear multiple times, once for each instance value. For example, a group containing
244        metrics for a network interface might be instanced for each discovered interface on the parent object.
245        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
246        created both with and without an instance. Creating an instanced group without an instance can be done to
247        provide a location for aggregate metrics across all instances, for example. This does nothing if 'instanced' is
248        False.
249        """
250        self.key = validate_key(key, "Group")
251        self.label = label
252        if label is None:
253            self.label = key
254        self.instanced = instanced
255        self.instance_required = instance_required
256        super().__init__()
257
258    def to_json(self) -> dict:
259        return {
260            "key": self.key,
261            "label": self.label,
262            "instanced": self.instanced,
263            "instance_required": self.instance_required,
264        } | super().to_json()
class GroupType(abc.ABC):
 18class GroupType(ABC):
 19    # This is only an Abstract Base Class so that it isn't initialized as a standalone object
 20    def __init__(self) -> None:
 21        self.key: str
 22        self.attributes: dict[str, Attribute] = OrderedDict()
 23        self.groups: dict[str, Group] = OrderedDict()
 24
 25    def define_group(self, key: str, label: Optional[str] = None) -> Group:
 26        """
 27        Create a new group that can hold attributes and subgroups.
 28        :param key: The key for the group.
 29        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 30        :return: The created group.
 31        """
 32        group = Group(key, label)
 33        self.add_group(group)
 34        return group
 35
 36    def define_instanced_group(
 37        self, key: str, label: Optional[str] = None, instance_required: bool = True
 38    ) -> Group:
 39        """
 40        Create a new group that can hold attributes and subgroups. This group can be 'instanced', with a value, so that
 41        its subgroups and attributes can appear multiple times, once for each instance value. For example, a group
 42        containing metrics for a network interface might be instanced for each discovered interface on the parent
 43        object.
 44        :param key: The key for the group.
 45        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 46        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
 47        created both with and without an instance. Creating an instanced group without an instance can be done to
 48        provide a location for aggregate metrics across all instances, for example.
 49        :return: The created group.
 50        """
 51        group = Group(key, label, instanced=True, instance_required=instance_required)
 52        self.add_group(group)
 53        return group
 54
 55    def add_groups(self, groups: list[Group]) -> None:
 56        """
 57        Adds a list of groups as subgroups of this group.
 58        :param groups: A list of groups.
 59        :return: None
 60        """
 61        for group in groups:
 62            self.add_group(group)
 63
 64    def add_group(self, group: Group) -> None:
 65        """
 66        Adds a group as a subgroup of this group.
 67        :param group: A group.
 68        :return: None
 69        """
 70        key = group.key
 71        if key in self.groups:
 72            raise DuplicateKeyException(
 73                f"Group with key {key} already exists in {type(self)} {self.key}."
 74            )
 75        self.groups[key] = group
 76
 77    def define_metric(
 78        self,
 79        key: str,
 80        label: Optional[str] = None,
 81        unit: Optional[Unit] = None,
 82        is_rate: bool = False,
 83        is_discrete: bool = False,
 84        is_kpi: bool = False,
 85        is_impact: bool = False,
 86        is_key_attribute: bool = False,
 87    ) -> MetricAttribute:
 88        """
 89        :param key: Used to identify the parameter.
 90        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 91        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
 92        consistent manner, and perform conversions when appropriate.
 93        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
 94        will be set automatically. Otherwise, defaults to False.
 95        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
 96        (floating point)
 97        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
 98        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
 99        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
100        proxy to a root cause, but not the root cause itself.
101        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
102        """
103        metric = MetricAttribute(
104            key,
105            label,
106            unit,
107            is_rate,
108            is_discrete,
109            is_kpi,
110            is_impact,
111            is_key_attribute,
112            dashboard_order=len(self.attributes),
113        )
114        self.add_attribute(metric)
115        return metric
116
117    def define_string_property(
118        self,
119        key: str,
120        label: Optional[str] = None,
121        unit: Optional[Unit] = None,
122        is_rate: bool = False,
123        is_discrete: bool = False,
124        is_kpi: bool = False,
125        is_impact: bool = False,
126        is_key_attribute: bool = False,
127    ) -> PropertyAttribute:
128        """
129        :param key: Used to identify the parameter.
130        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
131        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
132        consistent manner, and perform conversions when appropriate.
133        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
134        will be set automatically. Otherwise, defaults to False.
135        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
136        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
137        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
138        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
139        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
140        proxy to a root cause, but not the root cause itself.
141        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
142        """
143        _property = PropertyAttribute(
144            key,
145            label,
146            True,
147            unit,
148            is_rate,
149            is_discrete,
150            is_kpi,
151            is_impact,
152            is_key_attribute,
153            dashboard_order=len(self.attributes),
154        )
155        self.add_attribute(_property)
156        return _property
157
158    def define_numeric_property(
159        self,
160        key: str,
161        label: Optional[str] = None,
162        unit: Optional[Unit] = None,
163        is_rate: bool = False,
164        is_discrete: bool = False,
165        is_kpi: bool = False,
166        is_impact: bool = False,
167        is_key_attribute: bool = False,
168    ) -> PropertyAttribute:
169        """
170        :param key: Used to identify the parameter.
171        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
172        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
173        consistent manner, and perform conversions when appropriate.
174        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
175        will be set automatically. Otherwise, defaults to False.
176        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
177        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
178        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
179        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
180        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
181        proxy to a root cause, but not the root cause itself.
182        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
183        """
184        _property = PropertyAttribute(
185            key,
186            label,
187            False,
188            unit,
189            is_rate,
190            is_discrete,
191            is_kpi,
192            is_impact,
193            is_key_attribute,
194            dashboard_order=len(self.attributes),
195        )
196        self.add_attribute(_property)
197        return _property
198
199    def add_attributes(self, attributes: list[Attribute]) -> None:
200        """
201        Adds a list of attributes to this group.
202        :param attributes: A list of attributes (metric or property definitions).
203        :return: None
204        """
205        for attribute in attributes:
206            self.add_attribute(attribute)
207
208    def add_attribute(self, attribute: Attribute) -> None:
209        """
210        Adds an attribute to this group.
211        :param attribute: An attribute (metric or property definition).
212        :return: None
213        """
214        key = attribute.key
215        if key in self.attributes:
216            raise DuplicateKeyException(
217                f"Attribute with key {key} already exists in {type(self)} {self.key}."
218            )
219
220        self.attributes[key] = attribute
221
222    def to_json(self) -> dict:
223        return {
224            "attributes": [
225                attribute.to_json() for attribute in self.attributes.values()
226            ],
227            "groups": [group.to_json() for group in self.groups.values()],
228        }

Helper class that provides a standard way to create an ABC using inheritance.

def define_group( self, key: str, label: Optional[str] = None) -> aria.ops.definition.group.Group:
25    def define_group(self, key: str, label: Optional[str] = None) -> Group:
26        """
27        Create a new group that can hold attributes and subgroups.
28        :param key: The key for the group.
29        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
30        :return: The created group.
31        """
32        group = Group(key, label)
33        self.add_group(group)
34        return group

Create a new group that can hold attributes and subgroups.

Parameters
  • key: The key for the group.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
Returns

The created group.

def define_instanced_group( self, key: str, label: Optional[str] = None, instance_required: bool = True) -> aria.ops.definition.group.Group:
36    def define_instanced_group(
37        self, key: str, label: Optional[str] = None, instance_required: bool = True
38    ) -> Group:
39        """
40        Create a new group that can hold attributes and subgroups. This group can be 'instanced', with a value, so that
41        its subgroups and attributes can appear multiple times, once for each instance value. For example, a group
42        containing metrics for a network interface might be instanced for each discovered interface on the parent
43        object.
44        :param key: The key for the group.
45        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
46        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
47        created both with and without an instance. Creating an instanced group without an instance can be done to
48        provide a location for aggregate metrics across all instances, for example.
49        :return: The created group.
50        """
51        group = Group(key, label, instanced=True, instance_required=instance_required)
52        self.add_group(group)
53        return group

Create a new group that can hold attributes and subgroups. This group can be 'instanced', with a value, so that its subgroups and attributes can appear multiple times, once for each instance value. For example, a group containing metrics for a network interface might be instanced for each discovered interface on the parent object.

Parameters
  • key: The key for the group.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
  • instance_required: If true, then this group must be created with an instance. Otherwise, it can be created both with and without an instance. Creating an instanced group without an instance can be done to provide a location for aggregate metrics across all instances, for example.
Returns

The created group.

def add_groups(self, groups: list[aria.ops.definition.group.Group]) -> None:
55    def add_groups(self, groups: list[Group]) -> None:
56        """
57        Adds a list of groups as subgroups of this group.
58        :param groups: A list of groups.
59        :return: None
60        """
61        for group in groups:
62            self.add_group(group)

Adds a list of groups as subgroups of this group.

Parameters
  • groups: A list of groups.
Returns

None

def add_group(self, group: aria.ops.definition.group.Group) -> None:
64    def add_group(self, group: Group) -> None:
65        """
66        Adds a group as a subgroup of this group.
67        :param group: A group.
68        :return: None
69        """
70        key = group.key
71        if key in self.groups:
72            raise DuplicateKeyException(
73                f"Group with key {key} already exists in {type(self)} {self.key}."
74            )
75        self.groups[key] = group

Adds a group as a subgroup of this group.

Parameters
  • group: A group.
Returns

None

def define_metric( self, key: str, label: Optional[str] = None, unit: Optional[aria.ops.definition.units.Unit] = None, is_rate: bool = False, is_discrete: bool = False, is_kpi: bool = False, is_impact: bool = False, is_key_attribute: bool = False) -> aria.ops.definition.attribute.MetricAttribute:
 77    def define_metric(
 78        self,
 79        key: str,
 80        label: Optional[str] = None,
 81        unit: Optional[Unit] = None,
 82        is_rate: bool = False,
 83        is_discrete: bool = False,
 84        is_kpi: bool = False,
 85        is_impact: bool = False,
 86        is_key_attribute: bool = False,
 87    ) -> MetricAttribute:
 88        """
 89        :param key: Used to identify the parameter.
 90        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
 91        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
 92        consistent manner, and perform conversions when appropriate.
 93        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
 94        will be set automatically. Otherwise, defaults to False.
 95        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
 96        (floating point)
 97        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
 98        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
 99        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
100        proxy to a root cause, but not the root cause itself.
101        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
102        """
103        metric = MetricAttribute(
104            key,
105            label,
106            unit,
107            is_rate,
108            is_discrete,
109            is_kpi,
110            is_impact,
111            is_key_attribute,
112            dashboard_order=len(self.attributes),
113        )
114        self.add_attribute(metric)
115        return metric
Parameters
  • key: Used to identify the parameter.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
  • unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a consistent manner, and perform conversions when appropriate.
  • is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this will be set automatically. Otherwise, defaults to False.
  • is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous (floating point)
  • is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's 'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
  • is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a proxy to a root cause, but not the root cause itself.
  • is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
def define_string_property( self, key: str, label: Optional[str] = None, unit: Optional[aria.ops.definition.units.Unit] = None, is_rate: bool = False, is_discrete: bool = False, is_kpi: bool = False, is_impact: bool = False, is_key_attribute: bool = False) -> aria.ops.definition.attribute.PropertyAttribute:
117    def define_string_property(
118        self,
119        key: str,
120        label: Optional[str] = None,
121        unit: Optional[Unit] = None,
122        is_rate: bool = False,
123        is_discrete: bool = False,
124        is_kpi: bool = False,
125        is_impact: bool = False,
126        is_key_attribute: bool = False,
127    ) -> PropertyAttribute:
128        """
129        :param key: Used to identify the parameter.
130        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
131        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
132        consistent manner, and perform conversions when appropriate.
133        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
134        will be set automatically. Otherwise, defaults to False.
135        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
136        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
137        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
138        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
139        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
140        proxy to a root cause, but not the root cause itself.
141        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
142        """
143        _property = PropertyAttribute(
144            key,
145            label,
146            True,
147            unit,
148            is_rate,
149            is_discrete,
150            is_kpi,
151            is_impact,
152            is_key_attribute,
153            dashboard_order=len(self.attributes),
154        )
155        self.add_attribute(_property)
156        return _property
Parameters
  • key: Used to identify the parameter.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
  • unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a consistent manner, and perform conversions when appropriate.
  • is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this will be set automatically. Otherwise, defaults to False.
  • is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
  • is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's 'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
  • is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a proxy to a root cause, but not the root cause itself.
  • is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
def define_numeric_property( self, key: str, label: Optional[str] = None, unit: Optional[aria.ops.definition.units.Unit] = None, is_rate: bool = False, is_discrete: bool = False, is_kpi: bool = False, is_impact: bool = False, is_key_attribute: bool = False) -> aria.ops.definition.attribute.PropertyAttribute:
158    def define_numeric_property(
159        self,
160        key: str,
161        label: Optional[str] = None,
162        unit: Optional[Unit] = None,
163        is_rate: bool = False,
164        is_discrete: bool = False,
165        is_kpi: bool = False,
166        is_impact: bool = False,
167        is_key_attribute: bool = False,
168    ) -> PropertyAttribute:
169        """
170        :param key: Used to identify the parameter.
171        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
172        :param unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a
173        consistent manner, and perform conversions when appropriate.
174        :param is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this
175        will be set automatically. Otherwise, defaults to False.
176        :param is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous
177        (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
178        :param is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's
179        'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
180        :param is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a
181        proxy to a root cause, but not the root cause itself.
182        :param is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
183        """
184        _property = PropertyAttribute(
185            key,
186            label,
187            False,
188            unit,
189            is_rate,
190            is_discrete,
191            is_kpi,
192            is_impact,
193            is_key_attribute,
194            dashboard_order=len(self.attributes),
195        )
196        self.add_attribute(_property)
197        return _property
Parameters
  • key: Used to identify the parameter.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
  • unit: Specifies what unit this metric is returned in. This allows the UI to display the units in a consistent manner, and perform conversions when appropriate.
  • is_rate: Declares this attribute as a rate (e.g., kilobytes per second). If a unit is specified, this will be set automatically. Otherwise, defaults to False.
  • is_discrete: Declares that this attribute's range of values is discrete (integer) rather than continuous (floating point). Defaults to False, unless 'is_string' is set, in which case it will always be set to True.
  • is_kpi: If set, threshold breaches for this metric will be used in the calculation of the object's 'Self - Health Score' metric, which can affect the 'Anomalies' Badge.
  • is_impact: If set, this attribute will never be the 'root cause' of an issue. For example, it could be a proxy to a root cause, but not the root cause itself.
  • is_key_attribute: True if the attribute should be shown in some object summary widgets in the UI.
def add_attributes(self, attributes: list[aria.ops.definition.attribute.Attribute]) -> None:
199    def add_attributes(self, attributes: list[Attribute]) -> None:
200        """
201        Adds a list of attributes to this group.
202        :param attributes: A list of attributes (metric or property definitions).
203        :return: None
204        """
205        for attribute in attributes:
206            self.add_attribute(attribute)

Adds a list of attributes to this group.

Parameters
  • attributes: A list of attributes (metric or property definitions).
Returns

None

def add_attribute(self, attribute: aria.ops.definition.attribute.Attribute) -> None:
208    def add_attribute(self, attribute: Attribute) -> None:
209        """
210        Adds an attribute to this group.
211        :param attribute: An attribute (metric or property definition).
212        :return: None
213        """
214        key = attribute.key
215        if key in self.attributes:
216            raise DuplicateKeyException(
217                f"Attribute with key {key} already exists in {type(self)} {self.key}."
218            )
219
220        self.attributes[key] = attribute

Adds an attribute to this group.

Parameters
  • attribute: An attribute (metric or property definition).
Returns

None

def to_json(self) -> dict:
222    def to_json(self) -> dict:
223        return {
224            "attributes": [
225                attribute.to_json() for attribute in self.attributes.values()
226            ],
227            "groups": [group.to_json() for group in self.groups.values()],
228        }
class Group(GroupType):
231class Group(GroupType):
232    def __init__(
233        self,
234        key: str,
235        label: Optional[str] = None,
236        instanced: bool = False,
237        instance_required: bool = True,
238    ) -> None:
239        """
240        Create a new group that can hold attributes and subgroups.
241        :param key: The key for the group.
242        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
243        :param instanced: If True, this group can be 'instanced' with a value, so that its subgroups and attributes can
244        appear multiple times, once for each instance value. For example, a group containing
245        metrics for a network interface might be instanced for each discovered interface on the parent object.
246        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
247        created both with and without an instance. Creating an instanced group without an instance can be done to
248        provide a location for aggregate metrics across all instances, for example. This does nothing if 'instanced' is
249        False.
250        """
251        self.key = validate_key(key, "Group")
252        self.label = label
253        if label is None:
254            self.label = key
255        self.instanced = instanced
256        self.instance_required = instance_required
257        super().__init__()
258
259    def to_json(self) -> dict:
260        return {
261            "key": self.key,
262            "label": self.label,
263            "instanced": self.instanced,
264            "instance_required": self.instance_required,
265        } | super().to_json()

Helper class that provides a standard way to create an ABC using inheritance.

Group( key: str, label: Optional[str] = None, instanced: bool = False, instance_required: bool = True)
232    def __init__(
233        self,
234        key: str,
235        label: Optional[str] = None,
236        instanced: bool = False,
237        instance_required: bool = True,
238    ) -> None:
239        """
240        Create a new group that can hold attributes and subgroups.
241        :param key: The key for the group.
242        :param label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
243        :param instanced: If True, this group can be 'instanced' with a value, so that its subgroups and attributes can
244        appear multiple times, once for each instance value. For example, a group containing
245        metrics for a network interface might be instanced for each discovered interface on the parent object.
246        :param instance_required: If true, then this group must be created with an instance. Otherwise, it can be
247        created both with and without an instance. Creating an instanced group without an instance can be done to
248        provide a location for aggregate metrics across all instances, for example. This does nothing if 'instanced' is
249        False.
250        """
251        self.key = validate_key(key, "Group")
252        self.label = label
253        if label is None:
254            self.label = key
255        self.instanced = instanced
256        self.instance_required = instance_required
257        super().__init__()

Create a new group that can hold attributes and subgroups.

Parameters
  • key: The key for the group.
  • label: Label that is displayed in the VMware Aria Operations UI. Defaults to the key.
  • instanced: If True, this group can be 'instanced' with a value, so that its subgroups and attributes can appear multiple times, once for each instance value. For example, a group containing metrics for a network interface might be instanced for each discovered interface on the parent object.
  • instance_required: If true, then this group must be created with an instance. Otherwise, it can be created both with and without an instance. Creating an instanced group without an instance can be done to provide a location for aggregate metrics across all instances, for example. This does nothing if 'instanced' is False.
def to_json(self) -> dict:
259    def to_json(self) -> dict:
260        return {
261            "key": self.key,
262            "label": self.label,
263            "instanced": self.instanced,
264            "instance_required": self.instance_required,
265        } | super().to_json()