Files
EonaCat.LogStack/EonaCat.LogStack.Status/Models/Models.cs
EonaCat 977374ce02 Added EonaCat.LogStack.Status
Updated EonaCat.LogStack.LogClient to support EonaCat.LogStack.Status
2026-03-12 21:15:33 +01:00

108 lines
3.7 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace EonaCat.LogStack.Status.Models;
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
public enum MonitorType { TCP, UDP, AppLocal, AppRemote, HTTP, HTTPS }
public enum MonitorStatus { Unknown, Up, Down, Warning, Degraded }
public class Monitor
{
public int Id { get; set; }
[Required] public string Name { get; set; } = "";
public string? Description { get; set; }
public MonitorType Type { get; set; }
public string Host { get; set; } = "";
public int? Port { get; set; }
public string? Url { get; set; }
public string? ProcessName { get; set; }
public int IntervalSeconds { get; set; } = 60;
public int TimeoutMs { get; set; } = 5000;
public bool IsActive { get; set; } = true;
public bool IsPublic { get; set; } = true;
public string? Tags { get; set; }
public string? GroupName { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? LastChecked { get; set; }
public MonitorStatus LastStatus { get; set; } = MonitorStatus.Unknown;
public double? LastResponseMs { get; set; }
public ICollection<MonitorCheck> Checks { get; set; } = new List<MonitorCheck>();
}
public class MonitorCheck
{
public int Id { get; set; }
public int MonitorId { get; set; }
public Monitor? Monitor { get; set; }
public DateTime CheckedAt { get; set; } = DateTime.UtcNow;
public MonitorStatus Status { get; set; }
public double ResponseMs { get; set; }
public string? Message { get; set; }
}
public class CertificateEntry
{
public int Id { get; set; }
[Required] public string Name { get; set; } = "";
[Required] public string Domain { get; set; } = "";
public int Port { get; set; } = 443;
public DateTime? ExpiresAt { get; set; }
public DateTime? IssuedAt { get; set; }
public string? Issuer { get; set; }
public string? Subject { get; set; }
public string? Thumbprint { get; set; }
public bool IsPublic { get; set; } = true;
public bool AlertOnExpiry { get; set; } = true;
public int AlertDaysBeforeExpiry { get; set; } = 30;
public DateTime? LastChecked { get; set; }
public string? LastError { get; set; }
}
public class LogEntry
{
public int Id { get; set; }
public string Source { get; set; } = "system";
public string Level { get; set; } = "info";
public string Message { get; set; } = "";
public string? Properties { get; set; }
public string? Exception { get; set; }
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
public string? TraceId { get; set; }
public string? Host { get; set; }
}
public class AppSettings
{
public int Id { get; set; }
public string Key { get; set; } = "";
public string Value { get; set; } = "";
}
public class LogFilter
{
public string? Level { get; set; }
public string? Source { get; set; }
public string? Search { get; set; }
public DateTime? From { get; set; }
public DateTime? To { get; set; }
public int Page { get; set; } = 1;
public int PageSize { get; set; } = 100;
}
public class DashboardStats
{
public int TotalMonitors { get; set; }
public int UpCount { get; set; }
public int DownCount { get; set; }
public int WarnCount { get; set; }
public int UnknownCount { get; set; }
public int CertCount { get; set; }
public int CertExpiringSoon { get; set; }
public int CertExpired { get; set; }
public long TotalLogs { get; set; }
public long ErrorLogs { get; set; }
public double OverallUptime { get; set; }
}