From 2689ee94f9427fc3965bec313bf7decaeb2b900d Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Wed, 15 Apr 2020 01:52:07 +0300 Subject: [PATCH] Reorganized plugins, removed debug stuff from ping plugin. --- collector.py | 12 ++++++------ plugins/{ => system}/cpu_plugin.py | 3 +-- plugins/{ => system}/disk_plugin.py | 3 +-- plugins/{ => system}/memory_plugin.py | 3 +-- plugins/{ => system}/network_plugin.py | 3 +-- plugins/{ => system}/ping_plugin.py | 4 +--- plugins/{ => system}/temperatures_plugin.py | 3 +-- 7 files changed, 12 insertions(+), 19 deletions(-) rename plugins/{ => system}/cpu_plugin.py (98%) rename plugins/{ => system}/disk_plugin.py (98%) rename plugins/{ => system}/memory_plugin.py (97%) rename plugins/{ => system}/network_plugin.py (97%) rename plugins/{ => system}/ping_plugin.py (96%) rename plugins/{ => system}/temperatures_plugin.py (96%) diff --git a/collector.py b/collector.py index aa4ece6..0fa74c5 100644 --- a/collector.py +++ b/collector.py @@ -2,12 +2,12 @@ import config import database import signal from threading import Event -from plugins.cpu_plugin import CpuPlugin -from plugins.memory_plugin import MemoryPlugin -from plugins.disk_plugin import DiskPlugin -from plugins.network_plugin import NetworkPlugin -from plugins.temperatures_plugin import TemperaturesPlugin -from plugins.ping_plugin import PingPlugin +from plugins.system.cpu_plugin import CpuPlugin +from plugins.system.memory_plugin import MemoryPlugin +from plugins.system.disk_plugin import DiskPlugin +from plugins.system.network_plugin import NetworkPlugin +from plugins.system.temperatures_plugin import TemperaturesPlugin +from plugins.system.ping_plugin import PingPlugin class Collector(object): diff --git a/plugins/cpu_plugin.py b/plugins/system/cpu_plugin.py similarity index 98% rename from plugins/cpu_plugin.py rename to plugins/system/cpu_plugin.py index e36ac94..e3c6e53 100644 --- a/plugins/cpu_plugin.py +++ b/plugins/system/cpu_plugin.py @@ -6,8 +6,7 @@ from playhouse.shortcuts import model_to_dict import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class Cpu(BaseModel): diff --git a/plugins/disk_plugin.py b/plugins/system/disk_plugin.py similarity index 98% rename from plugins/disk_plugin.py rename to plugins/system/disk_plugin.py index 2ba1c89..2894e38 100644 --- a/plugins/disk_plugin.py +++ b/plugins/system/disk_plugin.py @@ -7,8 +7,7 @@ from playhouse.shortcuts import model_to_dict import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class DiskUsage(BaseModel): diff --git a/plugins/memory_plugin.py b/plugins/system/memory_plugin.py similarity index 97% rename from plugins/memory_plugin.py rename to plugins/system/memory_plugin.py index 318a36c..7dd82fa 100644 --- a/plugins/memory_plugin.py +++ b/plugins/system/memory_plugin.py @@ -5,8 +5,7 @@ from peewee import * import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class Memory(BaseModel): diff --git a/plugins/network_plugin.py b/plugins/system/network_plugin.py similarity index 97% rename from plugins/network_plugin.py rename to plugins/system/network_plugin.py index 33bd388..7791f1e 100644 --- a/plugins/network_plugin.py +++ b/plugins/system/network_plugin.py @@ -7,8 +7,7 @@ from playhouse.shortcuts import model_to_dict import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class NetworkIO(BaseModel): diff --git a/plugins/ping_plugin.py b/plugins/system/ping_plugin.py similarity index 96% rename from plugins/ping_plugin.py rename to plugins/system/ping_plugin.py index 367b6bc..0a85108 100644 --- a/plugins/ping_plugin.py +++ b/plugins/system/ping_plugin.py @@ -9,8 +9,7 @@ from playhouse.shortcuts import model_to_dict import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class Ping(BaseModel): @@ -43,7 +42,6 @@ class PingPlugin(Plugin): entry.ping = float(match.group(1)) entry.save() - print(model_to_dict(entry)) async def execute_internal(self): await asyncio.gather(*[self.do_ping(host) for host in config.PING_HOSTS]) diff --git a/plugins/temperatures_plugin.py b/plugins/system/temperatures_plugin.py similarity index 96% rename from plugins/temperatures_plugin.py rename to plugins/system/temperatures_plugin.py index 7df6fed..4d4d6fb 100644 --- a/plugins/temperatures_plugin.py +++ b/plugins/system/temperatures_plugin.py @@ -7,8 +7,7 @@ from playhouse.shortcuts import model_to_dict import config from database import BaseModel - -from .plugin import Plugin +from plugins.plugin import Plugin class Temperatures(BaseModel):