This commit is contained in:
ilkeral
2025-07-21 13:49:36 +03:00
commit 342f1314c7
57 changed files with 9297 additions and 0 deletions

24
ssh_manager/apps.py Normal file
View File

@ -0,0 +1,24 @@
from django.apps import AppConfig
from django.conf import settings
def check_server_connection():
from .ssh_client import SSHManager # utils yerine ssh_client'dan import et
from .models import SSHCredential
# Tüm SSH bağlantılarını kontrol et
for credential in SSHCredential.objects.all():
ssh_manager = SSHManager(credential)
is_online = ssh_manager.check_connection()
# Bağlantı durumunu güncelle
credential.is_online = is_online
credential.save(update_fields=['is_online', 'last_check'])
ssh_manager.close()
class SshManagerConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'ssh_manager'
def ready(self):
import ssh_manager.signals # signals'ı import et