feature/service-detection #23

Merged
triggermeelmo merged 4 commits from feature/service-detection into staging 2025-10-03 23:55:47 +02:00
2 changed files with 30 additions and 0 deletions
Showing only changes of commit 27792ff7f4 - Show all commits

28
Tests/servicediscovery.py Normal file
View File

@@ -0,0 +1,28 @@
import json
import urllib.request
url = "http://localhost:5000/monitoring/service-discovery"
payload = {
"ServerId": 1,
"ContainerId": "aaaaaaaaaaaa",
"Name": "test-Name",
"Image": "test-Image"
}
data = json.dumps(payload).encode("utf-8")
req = urllib.request.Request(
url,
data=data,
headers={"Content-Type": "application/json"},
method="POST"
)
try:
with urllib.request.urlopen(req) as response:
resp_data = response.read().decode("utf-8")
print("Status Code:", response.status)
print("Response:", resp_data)
except Exception as e:
print("Fehler beim Senden der Request:", e)

View File

@@ -252,6 +252,8 @@ public class MonitoringController : Controller
Name = dto.Name Name = dto.Name
}; };
_logger.LogInformation(container.Name + " added for Host " + container.ServerId);
_context.Containers.Add(container); _context.Containers.Add(container);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }