serverwatcher 5.26__tar.gz → 5.27.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {serverwatcher-5.26/src/serverwatcher.egg-info → serverwatcher-5.27.1}/PKG-INFO +1 -1
- {serverwatcher-5.26 → serverwatcher-5.27.1}/pyproject.toml +1 -1
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/configclasses/messages.py +1 -2
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/configclasses/watcher.py +8 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/defaultconfigs/messages.yaml +1 -1
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/defaultconfigs/watcher.yaml +5 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/validator.py +1 -1
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/watcher.py +8 -6
- {serverwatcher-5.26 → serverwatcher-5.27.1/src/serverwatcher.egg-info}/PKG-INFO +1 -1
- {serverwatcher-5.26 → serverwatcher-5.27.1}/LICENSE +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/README.md +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/setup.cfg +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/__init__.py +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/__main__.py +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/configclasses/__init__.py +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/configclasses/config.py +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher/defaultconfigs/config.yaml +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher.egg-info/SOURCES.txt +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher.egg-info/dependency_links.txt +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher.egg-info/requires.txt +0 -0
- {serverwatcher-5.26 → serverwatcher-5.27.1}/src/serverwatcher.egg-info/top_level.txt +0 -0
|
@@ -56,7 +56,6 @@ class MessagesConfig:
|
|
|
56
56
|
|
|
57
57
|
restart_action_sent: str = 'restarts.restart_action_sent'
|
|
58
58
|
server_back_online: str = 'restarts.back_online'
|
|
59
|
-
server_back_online_broadcast: str = 'restarts.back_online_broadcast'
|
|
60
59
|
server_failed_restart: str = 'restarts.failed_restart'
|
|
61
60
|
|
|
62
61
|
|
|
@@ -112,5 +111,5 @@ class fallbacks:
|
|
|
112
111
|
|
|
113
112
|
restart_action_sent = 'Restart action sent. Waiting...'
|
|
114
113
|
server_back_online = 'Server is back online!'
|
|
115
|
-
|
|
114
|
+
server_back_online_log = 'ServerWatcher successfully restarted the server.'
|
|
116
115
|
server_failed_restart = 'Server failed to restart!'
|
|
@@ -7,6 +7,10 @@ class WatcherConfig:
|
|
|
7
7
|
|
|
8
8
|
watch_interval: int = 'watch_interval'
|
|
9
9
|
|
|
10
|
+
sample_duration: float = 'sampling.duration'
|
|
11
|
+
sample_interval: float = 'sampling.interval'
|
|
12
|
+
sample_outlier_drop: int = 'sampling.drop_outliers'
|
|
13
|
+
|
|
10
14
|
threshold_ram: int = 'thresholds.ram'
|
|
11
15
|
threshold_cpu: int = 'thresholds.cpu'
|
|
12
16
|
threshold_uptime: int = 'thresholds.uptime'
|
|
@@ -36,6 +40,10 @@ class WatcherConfig:
|
|
|
36
40
|
class fallbacks:
|
|
37
41
|
watch_interval = 300
|
|
38
42
|
|
|
43
|
+
sample_duration = 5.0
|
|
44
|
+
sample_interval = 1.0
|
|
45
|
+
sample_outlier_drop = 1
|
|
46
|
+
|
|
39
47
|
threshold_ram = 6
|
|
40
48
|
threshold_cpu = 150
|
|
41
49
|
threshold_uptime = 12
|
|
@@ -76,5 +76,5 @@ reasons:
|
|
|
76
76
|
restarts:
|
|
77
77
|
restart_action_sent: 'Restart action sent. Waiting...'
|
|
78
78
|
back_online: 'Server is back online!'
|
|
79
|
-
|
|
79
|
+
back_online_log: 'ServerWatcher successfully restarted the server.'
|
|
80
80
|
failed_restart: 'Server failed to restart!'
|
|
@@ -93,6 +93,10 @@ class ServerWatcher:
|
|
|
93
93
|
|
|
94
94
|
self.tz = ZoneInfo(self.config.timezone)
|
|
95
95
|
|
|
96
|
+
def clearTerminal(self):
|
|
97
|
+
if self.config.clear_terminal:
|
|
98
|
+
utils.clearTerminal()
|
|
99
|
+
|
|
96
100
|
def shutdown(self):
|
|
97
101
|
self.router.info(self.messages.shutdown)
|
|
98
102
|
raise SystemExit
|
|
@@ -111,7 +115,7 @@ class ServerWatcher:
|
|
|
111
115
|
|
|
112
116
|
if alive:
|
|
113
117
|
self.router.info(self.messages.server_back_online)
|
|
114
|
-
self.router.
|
|
118
|
+
self.router.destination(self.messages.server_back_online_log)
|
|
115
119
|
else:
|
|
116
120
|
self.router.error(self.messages.server_failed_restart)
|
|
117
121
|
|
|
@@ -166,7 +170,7 @@ class ServerWatcher:
|
|
|
166
170
|
self.shutdown()
|
|
167
171
|
|
|
168
172
|
self.server.refresh()
|
|
169
|
-
snap = utils.Snapshot(self.server, duration=
|
|
173
|
+
snap = utils.Snapshot(self.server, duration=self.watcherconfig.sample_duration, interval=self.watcherconfig.sample_interval, drop_outliers=self.watcherconfig.sample_outlier_drop, gb=True)
|
|
170
174
|
|
|
171
175
|
pro = 0
|
|
172
176
|
anti = 0
|
|
@@ -245,15 +249,13 @@ class ServerWatcher:
|
|
|
245
249
|
if self.config.handle_keyboard_interrupt:
|
|
246
250
|
try:
|
|
247
251
|
while True:
|
|
248
|
-
|
|
249
|
-
utils.clearTerminal()
|
|
252
|
+
self.clearTerminal()
|
|
250
253
|
self.evaluate()
|
|
251
254
|
time.sleep(self.watcherconfig.watch_interval)
|
|
252
255
|
except KeyboardInterrupt:
|
|
253
256
|
self.shutdown()
|
|
254
257
|
else:
|
|
255
258
|
while True:
|
|
256
|
-
|
|
257
|
-
utils.clearTerminal()
|
|
259
|
+
self.clearTerminal()
|
|
258
260
|
self.evaluate()
|
|
259
261
|
time.sleep(self.watcherconfig.watch_interval)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|