Verified Commit ca84173b authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Add SLAProbe Clickhouse Dictionary.

parent 01cfc443
Pipeline #36166 passed with stages
in 17 minutes and 9 seconds
# ----------------------------------------------------------------------
# SLAProbe Attributes dictionary
# ----------------------------------------------------------------------
# Copyright (C) 2007-2022 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from noc.core.clickhouse.model import DictionaryModel
from noc.core.clickhouse.fields import StringField, UInt64Field
from noc.sla.models.slaprobe import SLAProbe as SLAProbeModel
from noc.core.text import ch_escape
class SLAProbe(DictionaryModel):
class Meta(object):
name = "slaprobe"
layout = "hashed"
source_model = "sla.SLAProbe"
incremental_update = True
name = StringField()
group = StringField()
description = StringField()
profile = StringField()
type = StringField()
target = StringField()
service = UInt64Field()
@classmethod
def extract(cls, item: "SLAProbeModel"):
return {
"bi_id": item.bi_id,
"name": item.name,
"group": item.group or "",
"description": ch_escape(item.description or ""),
"profile": item.profile.name,
"type": item.type,
"target": item.target,
"service": item.service.bi_id if item.service else 0,
}
......@@ -34,6 +34,7 @@ from noc.sa.models.service import Service
from noc.pm.models.agent import Agent
from noc.main.models.label import Label
from noc.core.mongo.fields import ForeignKeyField, PlainReferenceField
from noc.core.change.decorator import change
from noc.core.bi.decorator import bi_sync
from noc.core.wf.decorator import workflow
......@@ -44,6 +45,7 @@ _target_cache = cachetools.TTLCache(maxsize=100, ttl=60)
@Label.model
@change
@bi_sync
@workflow
class SLAProbe(Document):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment