<% import  'fusion_alerts.macros' as fusion_alerts %>

<% set base_tags = {
    "itype": "int",
    "prj": "samohod-int"
} %>

<% set juggler_check = {
    "tags": [
        "auto_downtime"
    ]
} %>

<% set services = [
    {
        "name": "samohod_all",
        "tags": base_tags,
        "geo_with_ctype": [
            ("sas", "prestable"),
            ("man", "prod"),
            ("vla", "prod")
        ]
    },
    {
        "name": "samohod_prod",
        "tags": base_tags|merge_with_dict({
            "tier": "yandsearch"
        }),
        "juggler_check" : juggler_check,
        "geo_with_ctype": [
            ("sas", "prestable"),
            ("man", "prod"),
            ("vla", "prod")
        ]
    },
    {
        "name": "samohod_exp",
        "tags": base_tags|merge_with_dict({
            "tier": "exp"
        }),
        "juggler_check" : juggler_check,
        "geo_with_ctype": [
            ("sas", "prestable"),
            ("man", "prod"),
            ("vla", "prod")
        ]
    },
    {
        "name": "samohod_exp2",
        "tags": base_tags|merge_with_dict({
            "tier": "exp2"
        }),
        "juggler_check" : juggler_check,
        "geo_with_ctype": [
            ("sas", "prestable"),
            ("man", "prod"),
            ("vla", "prod")
        ]
    }
] %>


<% set alerts = [
    {
        "name": "unanswer",
        "signal": "div(unistat-unanswer_dmmm, unistat-unanswer-denom_dmmm)",
        "limits_by_service": {
            "samohod_prod" : [0.005, 0.01],
            "samohod_exp" : [0.005, 0.01],
            "samohod_exp2" : [0.005, 0.01]
        },
        "flaps": {
            "stable": 30,
            "critical": 60
        }
    },
    {
        "name": "cpu_throttle",
        "signal": "portoinst-cpu_throttled_cores_tmmv",
        "limits_by_service": {
            "samohod_all" : [2, 5]
        }
    }
] %>

<< fusion_alerts.generate("int", services, alerts) >>
