Commit 5becca72 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'patch-avs-add-slaprobe-dictionary' into 'master'

Add SLAProbe Clickhouse Dictionary.

See merge request !6276
parents 01cfc443 ca84173b
# ----------------------------------------------------------------------
# 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()
def extract(cls, item: "SLAProbeModel"):
return {
"bi_id": item.bi_id,
"group": or "",
"description": ch_escape(item.description or ""),
"type": item.type,
"service": item.service.bi_id if item.service else 0,
......@@ -34,6 +34,7 @@ from import Service
from 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 import bi_sync
from import workflow
......@@ -44,6 +45,7 @@ _target_cache = cachetools.TTLCache(maxsize=100, ttl=60)
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