Compare commits
3 Commits
v0.2.5
...
8383cc88c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 8383cc88c8 | |||
| 89ffce20da | |||
| 2e7741f6fe |
117
Tests/test.json
Normal file
117
Tests/test.json
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"server_id": 1,
|
||||
"containers": [
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cpu": {
|
||||
"cpu_load": 0.0
|
||||
},
|
||||
"network": {
|
||||
"net_in": null,
|
||||
"net_out": null
|
||||
},
|
||||
"ram": {
|
||||
"ram_load": 0.0
|
||||
},
|
||||
"container_id": "aaaaaaaa",
|
||||
"status": {
|
||||
"status": "exited"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -31,4 +31,25 @@ public class ContainerController : Controller
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> RestartContainer(string container_id)
|
||||
{
|
||||
//Befehl an Agent schicken??
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> StopContainer(string container_id)
|
||||
{
|
||||
//Befehl an Agent schicken??
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> UpdateContainer(string container_id)
|
||||
{
|
||||
//Befehl an Agent schicken??
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ public class DockerServiceDto
|
||||
|
||||
public class DockerServiceMetricDto
|
||||
{
|
||||
|
||||
public required int Server_id { get; set; } // Vom Watcher-Server zugewiesene ID des Hosts
|
||||
public required JsonElement Containers { get; set; }
|
||||
}
|
||||
|
||||
[ApiController]
|
||||
@@ -330,17 +331,20 @@ public class MonitoringController : Controller
|
||||
return BadRequest(new { error = "Invalid Payload", details = errors });
|
||||
}
|
||||
|
||||
// Liste an Metrics aus der dto erstellen
|
||||
// Liste der eingegangenen Metric
|
||||
List<ContainerMetric> metrics = new List<ContainerMetric>();
|
||||
|
||||
// Json Parser -> Metric Objekt erstellen
|
||||
|
||||
|
||||
// Metrics in die Datenbank eintragen
|
||||
try
|
||||
{
|
||||
foreach (ContainerMetric m in metrics)
|
||||
foreach (ContainerMetric cm in metrics)
|
||||
{
|
||||
_context.ContainerMetrics.Add(m);
|
||||
_context.ContainerMetrics.Add(cm);
|
||||
await _context.SaveChangesAsync();
|
||||
// _logger.LogInformation(m. + " added for Host " + c.ServerId);
|
||||
_logger.LogInformation(cm.ContainerId + " Metric received");
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
397
Watcher/Migrations/20251030093420_ContainerMetricChange.Designer.cs
generated
Normal file
397
Watcher/Migrations/20251030093420_ContainerMetricChange.Designer.cs
generated
Normal file
@@ -0,0 +1,397 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Watcher.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Watcher.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20251030093420_ContainerMetricChange")]
|
||||
partial class ContainerMetricChange
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ContainerId")
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("Image")
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "image");
|
||||
|
||||
b.Property<int?>("ImageId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsRunning")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "name");
|
||||
|
||||
b.Property<int>("ServerId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "Server_id");
|
||||
|
||||
b.Property<int?>("TagId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ImageId");
|
||||
|
||||
b.HasIndex("TagId");
|
||||
|
||||
b.ToTable("Containers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.ContainerMetric", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("CPU_Load")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "cpu_load");
|
||||
|
||||
b.Property<int?>("ContainerId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "container_id");
|
||||
|
||||
b.Property<double>("NET_in")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "net_in");
|
||||
|
||||
b.Property<double>("NET_out")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "net_out");
|
||||
|
||||
b.Property<double>("RAM_Load")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "ram_load");
|
||||
|
||||
b.Property<int?>("ServerId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "server_id");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ContainerMetrics");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Tag")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Images");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ContainerId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Level")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ServerId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContainerId");
|
||||
|
||||
b.HasIndex("ServerId");
|
||||
|
||||
b.ToTable("LogEvents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Metric", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("CPU_Load")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("CPU_Temp")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("DISK_Size")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("DISK_Temp")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("DISK_Usage")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Load")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Temp")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Vram_Size")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Vram_Usage")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("NET_In")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("NET_Out")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("RAM_Load")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("RAM_Size")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int?>("ServerId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Metrics");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("CPU_Load_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("CPU_Load_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("CPU_Temp_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("CPU_Temp_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("CpuCores")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CpuType")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("DISK_Temp_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("DISK_Temp_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DiskSpace")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Disk_Usage_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Disk_Usage_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Load_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Load_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Temp_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("GPU_Temp_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("GpuType")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("IPAddress")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsOnline")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsVerified")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("LastSeen")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("RAM_Load_Critical")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("RAM_Load_Warning")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("RamSize")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int?>("TagId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TagId");
|
||||
|
||||
b.ToTable("Servers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("IdentityProvider")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastLogin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("OIDC_Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Container", b =>
|
||||
{
|
||||
b.HasOne("Watcher.Models.Image", null)
|
||||
.WithMany("Containers")
|
||||
.HasForeignKey("ImageId");
|
||||
|
||||
b.HasOne("Watcher.Models.Tag", null)
|
||||
.WithMany("Containers")
|
||||
.HasForeignKey("TagId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.LogEvent", b =>
|
||||
{
|
||||
b.HasOne("Watcher.Models.Container", "Container")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContainerId");
|
||||
|
||||
b.HasOne("Watcher.Models.Server", "Server")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServerId");
|
||||
|
||||
b.Navigation("Container");
|
||||
|
||||
b.Navigation("Server");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Server", b =>
|
||||
{
|
||||
b.HasOne("Watcher.Models.Tag", null)
|
||||
.WithMany("Servers")
|
||||
.HasForeignKey("TagId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||
{
|
||||
b.Navigation("Containers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Tag", b =>
|
||||
{
|
||||
b.Navigation("Containers");
|
||||
|
||||
b.Navigation("Servers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Watcher/Migrations/20251030093420_ContainerMetricChange.cs
Normal file
41
Watcher/Migrations/20251030093420_ContainerMetricChange.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Watcher.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ContainerMetricChange : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ContainerMetrics",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Timestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
ContainerId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ServerId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
CPU_Load = table.Column<double>(type: "REAL", nullable: false),
|
||||
RAM_Load = table.Column<double>(type: "REAL", nullable: false),
|
||||
NET_in = table.Column<double>(type: "REAL", nullable: false),
|
||||
NET_out = table.Column<double>(type: "REAL", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ContainerMetrics", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ContainerMetrics");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,12 @@ namespace Watcher.Migrations
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ContainerId")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("Image")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "image");
|
||||
|
||||
b.Property<int?>("ImageId")
|
||||
.HasColumnType("INTEGER");
|
||||
@@ -36,10 +38,12 @@ namespace Watcher.Migrations
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("TEXT")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "name");
|
||||
|
||||
b.Property<int>("ServerId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "Server_id");
|
||||
|
||||
b.Property<int?>("TagId")
|
||||
.HasColumnType("INTEGER");
|
||||
@@ -53,6 +57,44 @@ namespace Watcher.Migrations
|
||||
b.ToTable("Containers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.ContainerMetric", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("CPU_Load")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "cpu_load");
|
||||
|
||||
b.Property<int?>("ContainerId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "container_id");
|
||||
|
||||
b.Property<double>("NET_in")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "net_in");
|
||||
|
||||
b.Property<double>("NET_out")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "net_out");
|
||||
|
||||
b.Property<double>("RAM_Load")
|
||||
.HasColumnType("REAL")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "ram_load");
|
||||
|
||||
b.Property<int?>("ServerId")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "server_id");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ContainerMetrics");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Watcher.Models.Image", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Watcher.Models;
|
||||
|
||||
public class ContainerMetric
|
||||
@@ -6,19 +8,26 @@ public class ContainerMetric
|
||||
public int Id { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
|
||||
// Zuordnung zu einem Container -- Foreign Key
|
||||
// allgemeine Conainer Informationen
|
||||
[JsonPropertyName("container_id")]
|
||||
public int? ContainerId { get; set; }
|
||||
|
||||
[JsonPropertyName("server_id")]
|
||||
public int? ServerId { get; set; }
|
||||
|
||||
// CPU-Daten
|
||||
[JsonPropertyName("cpu_load")]
|
||||
public double CPU_Load { get; set; } = 0.0; // %
|
||||
|
||||
public double CPU_Temp { get; set; } = 0.0; // deg C
|
||||
|
||||
// RAM-Daten
|
||||
public double RAM_Size { get; set; } = 0.0; // GB
|
||||
|
||||
[JsonPropertyName("ram_load")]
|
||||
public double RAM_Load { get; set; } = 0.0; // %
|
||||
|
||||
// Network-Daten
|
||||
[JsonPropertyName("net_in")]
|
||||
public double NET_in { get; set; } = 0.0; // Bit
|
||||
|
||||
[JsonPropertyName("net_out")]
|
||||
public double NET_out { get; set; } = 0.0; // Bit
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,18 @@
|
||||
<td>@container.ContainerId</td>
|
||||
<td>@container.Name</td>
|
||||
<td>@container.Image</td>
|
||||
<!-- TODO: Link Hardcoded -->
|
||||
<td><a class="ServiceEntry" href="/Server/Details/2">@container.ServerId</a></td>
|
||||
<td>nicht verfügbar</td>
|
||||
<td><a class="ServiceEntry" href="/Server/Details/@container.ServerId">@container.ServerId</a></td>
|
||||
<td>
|
||||
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||
<i class="bi bi-pencil-square me-1"></i> Neustart
|
||||
</a>
|
||||
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||
<i class="bi bi-pencil-square me-1"></i> Stop
|
||||
</a>
|
||||
<a asp-action="#" asp-route-id="#" class="btn btn-outline-primary">
|
||||
<i class="bi bi-pencil-square me-1"></i> Update
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user