mirror of https://github.com/jumpserver/jumpserver
perf: 去掉 tunnel 和 command 会话的监控
parent
2877ea0e3b
commit
40b49e258e
|
@ -59,3 +59,9 @@ class PublishStatus(TextChoices):
|
||||||
success = 'success', _("Success")
|
success = 'success', _("Success")
|
||||||
failed = 'failed', _("Failed")
|
failed = 'failed', _("Failed")
|
||||||
mismatch = 'mismatch', _("Mismatch")
|
mismatch = 'mismatch', _("Mismatch")
|
||||||
|
|
||||||
|
|
||||||
|
class SessionType(TextChoices):
|
||||||
|
normal = 'normal', _('Normal')
|
||||||
|
tunnel = 'tunnel', _('Tunnel')
|
||||||
|
command = 'command', _('Command')
|
||||||
|
|
|
@ -15,6 +15,7 @@ from assets.models import Asset
|
||||||
from common.utils import get_object_or_none, lazyproperty
|
from common.utils import get_object_or_none, lazyproperty
|
||||||
from orgs.mixins.models import OrgModelMixin
|
from orgs.mixins.models import OrgModelMixin
|
||||||
from terminal.backends import get_multi_command_storage
|
from terminal.backends import get_multi_command_storage
|
||||||
|
from terminal.const import SessionType
|
||||||
from users.models import User
|
from users.models import User
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,6 +125,9 @@ class Session(OrgModelMixin):
|
||||||
return False
|
return False
|
||||||
if self.login_from == self.LOGIN_FROM.RT:
|
if self.login_from == self.LOGIN_FROM.RT:
|
||||||
return False
|
return False
|
||||||
|
if self.type != SessionType.normal:
|
||||||
|
# 会话监控仅支持 normal,不支持 tunnel 和 command
|
||||||
|
return False
|
||||||
if self.protocol in [
|
if self.protocol in [
|
||||||
Protocol.ssh, Protocol.vnc, Protocol.rdp,
|
Protocol.ssh, Protocol.vnc, Protocol.rdp,
|
||||||
Protocol.telnet, Protocol.k8s
|
Protocol.telnet, Protocol.k8s
|
||||||
|
@ -153,7 +157,7 @@ class Session(OrgModelMixin):
|
||||||
return None, e
|
return None, e
|
||||||
|
|
||||||
if settings.SERVER_REPLAY_STORAGE:
|
if settings.SERVER_REPLAY_STORAGE:
|
||||||
from ..tasks import upload_session_replay_to_external_storage
|
from terminal.tasks import upload_session_replay_to_external_storage
|
||||||
upload_session_replay_to_external_storage.delay(str(self.id))
|
upload_session_replay_to_external_storage.delay(str(self.id))
|
||||||
return name, None
|
return name, None
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from django.db import models
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from assets.const import Protocol
|
from assets.const import Protocol
|
||||||
from common.serializers.fields import LabeledChoiceField
|
from common.serializers.fields import LabeledChoiceField
|
||||||
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||||
|
from ..const import SessionType
|
||||||
from ..models import Session
|
from ..models import Session
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -13,10 +13,6 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class SessionType(models.TextChoices):
|
|
||||||
normal = 'normal', _('Normal')
|
|
||||||
tunnel = 'tunnel', _('Tunnel')
|
|
||||||
command = 'command', _('Command')
|
|
||||||
|
|
||||||
|
|
||||||
class SessionSerializer(BulkOrgResourceModelSerializer):
|
class SessionSerializer(BulkOrgResourceModelSerializer):
|
||||||
|
|
Loading…
Reference in New Issue