Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

553 B
Raw Blame
package sensors

import "strings"

// IsTemperatureInput identifies an lm-sensors temperature subfeature by its
// native tempN_input key. The displayed feature label can be arbitrary; a
// fan, voltage, current or power input does not acquire Celsius units from it.
func IsTemperatureInput(key string) bool {
	index := strings.TrimSuffix(strings.TrimPrefix(key, "temp"), "_input")
	if index == "" || key != "temp"+index+"_input" {
		return false
	}
	for _, digit := range index {
		if digit < '0' || digit > '9' {
			return false
		}
	}
	return true
}