Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vladimir
noc
Commits
5becca72
Commit
5becca72
authored
May 04, 2022
by
Andrey Vertiprahov
Browse files
Merge branch 'patch-avs-add-slaprobe-dictionary' into 'master'
Add SLAProbe Clickhouse Dictionary. See merge request
noc/noc!6276
parents
01cfc443
ca84173b
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/bi/dictionaries/slaprobe.py
0 → 100644
View file @
5becca72
# ----------------------------------------------------------------------
# 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
,
}
sla/models/slaprobe.py
View file @
5becca72
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment