Ejemplo n.º 1
0
class BIAggregationPackSchema(Schema):
    id = ReqString(default="", example="bi_pack1")
    title = ReqString(default="", example="BI Title")
    comment = String(
        description=
        "An optional comment that may be used to explain the purpose of this object.",
        allow_none=True,
        example="Rule comment",
    )
    contact_groups = ReqList(fields.String(),
                             default=[],
                             example=["contactgroup_a", "contactgroup_b"])
    public = ReqBoolean(default=False)
    rules = ReqList(fields.Nested(BIRuleSchema()), default=[])
    aggregations = ReqList(fields.Nested(BIAggregationSchema()), default=[])

    @pre_dump
    def pre_dumper(self, obj: BIAggregationPack, many=False) -> Dict:
        # Convert aggregations and rules to list
        return {
            "id": obj.id,
            "title": obj.title,
            "comment": obj.comment,
            "contact_groups": obj.contact_groups,
            "public": obj.public,
            "rules": obj.get_rules().values(),
            "aggregations": obj.get_aggregations().values(),
        }
Ejemplo n.º 2
0
class BISiteHostPairSchema(Schema):
    site_id = ReqString()
    host_name = ReqString()

    @marshmallow.pre_dump
    def pre_dump(self, obj: Tuple) -> Dict:
        # Convert aggregations and rules to list
        return {"site_id": obj[0], "host_name": obj[1]}
Ejemplo n.º 3
0
class BIAggregationSchema(Schema):
    id = ReqString(default="", example="aggr1")
    customer = ReqString(default="", example="customer1")
    groups = create_nested_schema_for_class(
        BIAggregationGroups,
        example_config={
            "names": ["groupA", "groupB"],
            "paths": [["path", "group", "a"], ["path", "group", "b"]]
        },
    )
    node = create_nested_schema_for_class(BINodeGenerator)
    aggregation_visualization = create_nested_schema(
        BIAggregationVisualizationSchema)
    computation_options = create_nested_schema_for_class(
        BIAggregationComputationOptions)
Ejemplo n.º 4
0
class BIRuleSchema(Schema):
    class Meta:
        ordered = True

    id = ReqString(
        default="",
        example="rule1",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    nodes = ReqList(
        fields.Nested(BINodeGeneratorSchema),
        default=[],
        example=[],
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    params = create_nested_schema_for_class(
        BIParams,
        example_config={
            "arguments": ["foo", "bar"],
        },
    )
    node_visualization = create_nested_schema(
        BINodeVisLayoutStyleSchema, default_schema=BINodeVisBlockStyleSchema)
    properties = create_nested_schema_for_class(BIRuleProperties)
    aggregation_function = create_nested_schema(
        BIAggregationFunctionSchema,
        default_schema=BIAggregationFunctionBest.schema())
    computation_options = create_nested_schema_for_class(
        BIRuleComputationOptions)
Ejemplo n.º 5
0
class HostConditionsSchema(Schema):
    host_folder = ReqString(default="", example="servers/groupA")
    host_labels = ReqDict(default={}, example={"db": "mssql"})
    host_tags = ReqDict(default={}, example={})
    host_choice = ReqNested(BIHostChoice,
                            default={"type": "all_hosts"},
                            example={"type": "all_hosts"})
Ejemplo n.º 6
0
class BIAggregationSchema(Schema):
    class Meta:
        ordered = True

    id = ReqString(
        default="",
        example="aggr1",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    customer = String(
        description="CME Edition only: The customer id for this aggregation.",
        allow_none=True,
        example="customer1",
    )
    groups = create_nested_schema_for_class(
        BIAggregationGroups,
        example_config={
            "names": ["groupA", "groupB"],
            "paths": [["path", "group", "a"], ["path", "group", "b"]]
        },
    )
    node = create_nested_schema_for_class(BINodeGenerator)
    aggregation_visualization = create_nested_schema(
        BIAggregationVisualizationSchema)
    computation_options = create_nested_schema_for_class(
        BIAggregationComputationOptions)
Ejemplo n.º 7
0
class BICompiledRuleSchema(Schema):
    id = ReqString()
    pack_id = ReqString()
    type = ReqConstant(BICompiledRule.type())
    required_hosts = ReqList(fields.Nested(BISiteHostPairSchema))
    nodes = ReqList(fields.Nested("BIResultSchema"))
    aggregation_function = ReqNested(
        BIAggregationFunctionSchema,
        example={
            "type": "worst",
            "count": 2,
            "restrict_state": 1
        },
    )
    node_visualization = ReqNested(BINodeVisLayoutStyleSchema,
                                   example=BINodeVisBlockStyleSchema().dump(
                                       {}))
    properties = ReqNested("BIRulePropertiesSchema", example={})
Ejemplo n.º 8
0
class BIAggregationPackSchema(Schema):
    id = ReqString(default="", example="bi_pack1")
    title = ReqString(default="", example="BI Title")
    contact_groups = ReqList(fields.String(),
                             default=[],
                             example=["contactgroup_a", "contactgroup_b"])
    public = ReqBoolean(default=False)
    rules = ReqList(fields.Nested(BIRuleSchema()), default=[])
    aggregations = ReqList(fields.Nested(BIAggregationSchema()), default=[])

    @pre_dump
    def pre_dumper(self, obj: BIAggregationPack, many=False) -> Dict:
        # Convert aggregations and rules to list
        return {
            "id": obj.id,
            "title": obj.title,
            "contact_groups": obj.contact_groups,
            "public": obj.public,
            "rules": obj.get_rules().values(),
            "aggregations": obj.get_aggregations().values(),
        }
Ejemplo n.º 9
0
class BIRuleSchema(Schema):
    id = ReqString(default="", example="rule1")
    nodes = ReqList(fields.Nested(BINodeGeneratorSchema), default=[], example=[])
    params = create_nested_schema_for_class(BIParams,
                                            example_config=[{
                                                "arguments": ["foo", "bar"],
                                            }])
    node_visualization = create_nested_schema(BINodeVisLayoutStyleSchema,
                                              default_schema=BINodeVisBlockStyleSchema)
    properties = create_nested_schema_for_class(BIRuleProperties)
    aggregation_function = create_nested_schema(BIAggregationFunctionSchema,
                                                default_schema=BIAggregationFunctionBest.schema())
    computation_options = create_nested_schema_for_class(BIRuleComputationOptions)
Ejemplo n.º 10
0
class BICompiledAggregationSchema(Schema):
    id = ReqString()
    branches = ReqList(Nested(BICompiledRuleSchema))
    aggregation_visualization = ReqNested(BIAggregationVisualizationSchema)
    computation_options = create_nested_schema_for_class(
        BIAggregationComputationOptions,
        example_config={"disabled": True},
    )

    groups = create_nested_schema_for_class(
        BIAggregationGroups,
        example_config={
            "names": ["groupA", "groupB"],
            "paths": [["path", "group", "a"]]
        },
    )
Ejemplo n.º 11
0
class BIPackEndpointSchema(Schema):
    title = ReqString(
        dump_default="",
        example="BI Title",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    contact_groups = ReqList(
        fields.String(),
        dump_default=[],
        example=["contact", "contactgroup_b"],
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    public = ReqBoolean(
        dump_default=False,
        example="false",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
Ejemplo n.º 12
0
class BIPackEndpointSchema(Schema):
    title = ReqString(
        dump_default="",
        example="BI Title",
        description="The title of the BI pack.",
    )
    contact_groups = ReqList(
        fields.String(),
        dump_default=[],
        example=["contact", "contactgroup_b"],
        description="A list of contact group identifiers.",
    )
    public = ReqBoolean(
        dump_default=False,
        example="false",
        description="Should the BI pack be public or not.",
    )
Ejemplo n.º 13
0
class BIPackEndpointSchema(Schema):
    title = ReqString(default="", example="BI Title")
    contact_groups = ReqList(fields.String(),
                             default=[],
                             example=["contact", "contactgroup_b"])
    public = ReqBoolean(default=False, example="false")
Ejemplo n.º 14
0
class BIAggregationVisualizationSchema(Schema):
    ignore_rule_styles = ReqBoolean(default=False, example=False)
    layout_id = ReqString(default="builtin_default", example="radial_layout2")
    line_style = ReqString(default="round", example="round")
Ejemplo n.º 15
0
class BIStateOfRemainingServicesActionSchema(Schema):
    type = ReqConstant(BIStateOfRemainingServicesAction.type())
    host_regex = ReqString(default="", example="testhost")
Ejemplo n.º 16
0
class BICompiledLeafSchema(Schema):
    type = ReqConstant(BICompiledLeaf.type())
    required_hosts = ReqList(Nested(BISiteHostPairSchema))
    site_id = ReqString()
    host_name = ReqString()
    service_description = String()
Ejemplo n.º 17
0
class BIRuleEndpointSchema(BIRuleSchema):
    pack_id = ReqString(default="", example="pack1")
Ejemplo n.º 18
0
class BICallARuleActionSchema(Schema):
    type = ReqConstant(BICallARuleAction.type())
    rule_id = ReqString(default="", example="test_rule_1")
    params = ReqNested(BIParamsSchema,
                       default=BIParamsSchema().dump({}),
                       example=BIParamsSchema().dump({}))
Ejemplo n.º 19
0
class BIAggregationEndpointSchema(BIAggregationSchema):
    pack_id = ReqString(default="", example="pack1")
Ejemplo n.º 20
0
class BIRulePropertiesSchema(Schema):
    title = ReqString(dump_default="", example="Rule title")
    comment = ReqString(dump_default="", example="Rule comment")
    docu_url = ReqString(dump_default="", example="Rule documentation")
    icon = ReqString(dump_default="", example="icon1.png")
    state_messages = ReqDict(dump_default={}, example={})
Ejemplo n.º 21
0
class BIRuleEndpointSchema(BIRuleSchema):
    pack_id = ReqString(
        dump_default="",
        example="pack1",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
Ejemplo n.º 22
0
class BIHostSearchSchema(Schema):
    type = ReqConstant(BIHostSearch.type())
    conditions = ReqNested(HostConditionsSchema,
                           default=HostConditionsSchema().dump({}))
    refer_to = ReqString(validate=validate.OneOf(["host", "child", "parent"]),
                         default="host")
Ejemplo n.º 23
0
class BIHostNameRegexChoiceSchema(Schema):
    type = ReqConstant("host_name_regex")
    pattern = ReqString(default="", example="testhostn.*")
Ejemplo n.º 24
0
class BIFixedArgumentsSearchTokenSchema(Schema):
    key = ReqString()
    values = ReqList(fields.String)
Ejemplo n.º 25
0
class BIAggregationFunctionCountSettings(Schema):
    type = ReqString(default="count",
                     validate=validate.OneOf(["count", "percentage"]))
    value = ReqInteger(default=1)
Ejemplo n.º 26
0
class BIHostAliasRegexChoiceSchema(Schema):
    type = ReqConstant("host_alias_regex")
    pattern = ReqString(default="", example="testali.*")
Ejemplo n.º 27
0
class BIRuleEndpointSchema(BIRuleSchema):
    pack_id = ReqString(
        dump_default="",
        example="pack1",
        description="The identifier of the BI pack.",
    )
Ejemplo n.º 28
0
class ServiceConditionsSchema(HostConditionsSchema):
    service_regex = ReqString(default="", example="Filesystem.*")
    service_labels = ReqDict(default={}, example={"db": "mssql"})
Ejemplo n.º 29
0
class BIStateOfServiceActionSchema(Schema):
    type = ReqConstant(BIStateOfServiceAction.type())
    host_regex = ReqString(dump_default="", example="testhost")
    service_regex = ReqString(dump_default="", example="testservice")