Files
tyto/backend/internal/collectors/system.go
vikingowl a2504c1327 feat: rename project to Tyto with owl branding
- Rename project from system-monitor to Tyto (barn owl themed)
- Update Go module name and all import paths
- Update Docker container names (tyto-backend, tyto-frontend)
- Update localStorage keys (tyto-settings, tyto-hosts)
- Create barn owl SVG favicon and PWA icons (192, 512)
- Update header with owl logo icon
- Update manifest.json and app.html with Tyto branding

Named after Tyto alba, the barn owl — nature's silent, watchful guardian

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 06:36:01 +01:00

54 lines
1.0 KiB
Go

package collectors
import (
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"tyto/internal/models"
)
type SystemCollector struct {
procPath string
}
func NewSystemCollector(procPath string) *SystemCollector {
return &SystemCollector{procPath: procPath}
}
func (c *SystemCollector) Collect() (models.SystemInfo, error) {
info := models.SystemInfo{
OS: "linux",
Architecture: runtime.GOARCH,
}
// Hostname
hostname, err := os.Hostname()
if err == nil {
info.Hostname = hostname
}
// Kernel version from /proc/version
versionData, err := os.ReadFile(filepath.Join(c.procPath, "version"))
if err == nil {
fields := strings.Fields(string(versionData))
if len(fields) >= 3 {
info.Kernel = fields[2]
}
}
// Uptime from /proc/uptime
uptimeData, err := os.ReadFile(filepath.Join(c.procPath, "uptime"))
if err == nil {
fields := strings.Fields(string(uptimeData))
if len(fields) >= 1 {
uptime, _ := strconv.ParseFloat(fields[0], 64)
info.Uptime = int64(uptime)
}
}
return info, nil
}