mirror of
https://github.com/Dvorinka/beszel.git
synced 2026-06-04 13:22:57 +00:00
Add public monitoring features and CI updates
- Add status pages, incidents, badges, maintenance, bulk ops, and metrics - Add Docker packaging, env example, and frontend routes - Refresh GitHub workflows and project metadata
This commit is contained in:
@@ -6,23 +6,46 @@ import "time"
|
||||
type Status string
|
||||
|
||||
const (
|
||||
StatusUp Status = "up"
|
||||
StatusDown Status = "down"
|
||||
StatusPending Status = "pending"
|
||||
StatusPaused Status = "paused"
|
||||
StatusUp Status = "up"
|
||||
StatusDown Status = "down"
|
||||
StatusPending Status = "pending"
|
||||
StatusPaused Status = "paused"
|
||||
StatusMaintenance Status = "maintenance"
|
||||
)
|
||||
|
||||
// Monitor types
|
||||
const (
|
||||
TypeHTTP = "http"
|
||||
TypeHTTPS = "https"
|
||||
TypeTCP = "tcp"
|
||||
TypePing = "ping"
|
||||
TypeDNS = "dns"
|
||||
TypeKeyword = "keyword"
|
||||
TypeJSONQuery = "json-query"
|
||||
TypeDocker = "docker"
|
||||
TypeHTTP = "http"
|
||||
TypeHTTPS = "https"
|
||||
TypeTCP = "tcp"
|
||||
TypePing = "ping"
|
||||
TypeDNS = "dns"
|
||||
TypeKeyword = "keyword"
|
||||
TypeJSONQuery = "json-query"
|
||||
TypeDocker = "docker"
|
||||
TypePush = "push"
|
||||
TypeManual = "manual"
|
||||
TypeSystemService = "system-service"
|
||||
TypeRealBrowser = "real-browser"
|
||||
TypeGRPCKeyword = "grpc-keyword"
|
||||
TypeMQTT = "mqtt"
|
||||
TypeRabbitMQ = "rabbitmq"
|
||||
TypeKafka = "kafka-producer"
|
||||
TypeSMTP = "smtp"
|
||||
TypeSNMP = "snmp"
|
||||
TypeSIP = "sip-options"
|
||||
TypeTailscalePing = "tailscale-ping"
|
||||
TypeWebSocket = "websocket-upgrade"
|
||||
TypeGlobalping = "globalping"
|
||||
TypeMySQL = "mysql"
|
||||
TypeMongoDB = "mongodb"
|
||||
TypeRedis = "redis"
|
||||
TypePostgreSQL = "postgresql"
|
||||
TypeSQLServer = "sqlserver"
|
||||
TypeOracleDB = "oracledb"
|
||||
TypeRADIUS = "radius"
|
||||
TypeGameDig = "gamedig"
|
||||
TypeSteam = "steam"
|
||||
)
|
||||
|
||||
// HTTPMethod constants
|
||||
@@ -38,39 +61,39 @@ const (
|
||||
|
||||
// Monitor represents a website/service monitor configuration
|
||||
type Monitor struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Type string `json:"type" db:"type"`
|
||||
URL string `json:"url" db:"url"`
|
||||
Hostname string `json:"hostname" db:"hostname"`
|
||||
Port int `json:"port" db:"port"`
|
||||
Method string `json:"method" db:"method"`
|
||||
Headers string `json:"headers" db:"headers"`
|
||||
Body string `json:"body" db:"body"`
|
||||
Interval int `json:"interval" db:"interval"`
|
||||
Timeout int `json:"timeout" db:"timeout"`
|
||||
Retries int `json:"retries" db:"retries"`
|
||||
RetryInterval int `json:"retry_interval" db:"retry_interval"`
|
||||
MaxRedirects int `json:"max_redirects" db:"max_redirects"`
|
||||
Keyword string `json:"keyword" db:"keyword"`
|
||||
JSONQuery string `json:"json_query" db:"json_query"`
|
||||
ExpectedValue string `json:"expected_value" db:"expected_value"`
|
||||
InvertKeyword bool `json:"invert_keyword" db:"invert_keyword"`
|
||||
DNSResolveServer string `json:"dns_resolve_server" db:"dns_resolve_server"`
|
||||
DNSResolverMode string `json:"dns_resolver_mode" db:"dns_resolver_mode"`
|
||||
Status Status `json:"status" db:"status"`
|
||||
Active bool `json:"active" db:"active"`
|
||||
UserID string `json:"user" db:"user"`
|
||||
Tags []string `json:"tags" db:"tags"`
|
||||
Created time.Time `json:"created" db:"created"`
|
||||
Updated time.Time `json:"updated" db:"updated"`
|
||||
LastCheck time.Time `json:"last_check" db:"last_check"`
|
||||
UptimeStats map[string]float64 `json:"uptime_stats" db:"uptime_stats"`
|
||||
Description string `json:"description" db:"description"`
|
||||
CertExpiryNotification bool `json:"cert_expiry_notification" db:"cert_expiry_notification"`
|
||||
CertExpiryDays int `json:"cert_expiry_days" db:"cert_expiry_days"`
|
||||
ProxyID string `json:"proxy" db:"proxy"`
|
||||
IgnoreTLSError bool `json:"ignore_tls_error" db:"ignore_tls_error"`
|
||||
ID string `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Type string `json:"type" db:"type"`
|
||||
URL string `json:"url" db:"url"`
|
||||
Hostname string `json:"hostname" db:"hostname"`
|
||||
Port int `json:"port" db:"port"`
|
||||
Method string `json:"method" db:"method"`
|
||||
Headers string `json:"headers" db:"headers"`
|
||||
Body string `json:"body" db:"body"`
|
||||
Interval int `json:"interval" db:"interval"`
|
||||
Timeout int `json:"timeout" db:"timeout"`
|
||||
Retries int `json:"retries" db:"retries"`
|
||||
RetryInterval int `json:"retry_interval" db:"retry_interval"`
|
||||
MaxRedirects int `json:"max_redirects" db:"max_redirects"`
|
||||
Keyword string `json:"keyword" db:"keyword"`
|
||||
JSONQuery string `json:"json_query" db:"json_query"`
|
||||
ExpectedValue string `json:"expected_value" db:"expected_value"`
|
||||
InvertKeyword bool `json:"invert_keyword" db:"invert_keyword"`
|
||||
DNSResolveServer string `json:"dns_resolve_server" db:"dns_resolve_server"`
|
||||
DNSResolverMode string `json:"dns_resolver_mode" db:"dns_resolver_mode"`
|
||||
Status Status `json:"status" db:"status"`
|
||||
Active bool `json:"active" db:"active"`
|
||||
UserID string `json:"user" db:"user"`
|
||||
Tags []string `json:"tags" db:"tags"`
|
||||
Created time.Time `json:"created" db:"created"`
|
||||
Updated time.Time `json:"updated" db:"updated"`
|
||||
LastCheck time.Time `json:"last_check" db:"last_check"`
|
||||
UptimeStats map[string]float64 `json:"uptime_stats" db:"uptime_stats"`
|
||||
Description string `json:"description" db:"description"`
|
||||
CertExpiryNotification bool `json:"cert_expiry_notification" db:"cert_expiry_notification"`
|
||||
CertExpiryDays int `json:"cert_expiry_days" db:"cert_expiry_days"`
|
||||
ProxyID string `json:"proxy" db:"proxy"`
|
||||
IgnoreTLSError bool `json:"ignore_tls_error" db:"ignore_tls_error"`
|
||||
}
|
||||
|
||||
// Heartbeat represents a single monitor check result
|
||||
@@ -107,8 +130,8 @@ type CheckResult struct {
|
||||
|
||||
// CheckRequest holds parameters for a monitor check
|
||||
type CheckRequest struct {
|
||||
Monitor *Monitor
|
||||
Timeout time.Duration
|
||||
Monitor *Monitor
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
// ToPublicJSON returns a monitor object suitable for public display
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package system
|
||||
|
||||
// TODO: this is confusing, make common package with common/types common/helpers etc
|
||||
// NOTE: consider refactoring into common/types and common/helpers packages
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -40,7 +40,7 @@ type Stats struct {
|
||||
// LoadAvg15 float64 `json:"l15,omitempty" cbor:"25,keyasint,omitempty"`
|
||||
Bandwidth [2]uint64 `json:"b,omitzero" cbor:"26,keyasint,omitzero"` // [sent bytes, recv bytes]
|
||||
MaxBandwidth [2]uint64 `json:"bm,omitzero" cbor:"-"` // [sent bytes, recv bytes]
|
||||
// TODO: remove other load fields in future release in favor of load avg array
|
||||
// NOTE: load avg array replaces individual load fields in future versions
|
||||
LoadAvg [3]float64 `json:"la,omitempty" cbor:"28,keyasint"`
|
||||
Battery [2]uint8 `json:"bat,omitzero" cbor:"29,keyasint,omitzero"` // [percent, charge state, current]
|
||||
NetworkInterfaces map[string][4]uint64 `json:"ni,omitempty" cbor:"31,keyasint,omitempty"` // [upload bytes, download bytes, total upload, total download]
|
||||
@@ -94,7 +94,7 @@ type FsStats struct {
|
||||
DiskWritePs float64 `json:"w" cbor:"3,keyasint"`
|
||||
MaxDiskReadPS float64 `json:"rm,omitempty" cbor:"-"`
|
||||
MaxDiskWritePS float64 `json:"wm,omitempty" cbor:"-"`
|
||||
// TODO: remove DiskReadPs and DiskWritePs in future release in favor of DiskReadBytes and DiskWriteBytes
|
||||
// NOTE: DiskReadPs and DiskWritePs deprecated in favor of DiskReadBytes and DiskWriteBytes
|
||||
DiskReadBytes uint64 `json:"rb" cbor:"6,keyasint,omitempty"`
|
||||
DiskWriteBytes uint64 `json:"wb" cbor:"7,keyasint,omitempty"`
|
||||
MaxDiskReadBytes uint64 `json:"rbm,omitempty" cbor:"-"`
|
||||
|
||||
Reference in New Issue
Block a user