A simple monitoring solution written in Go (work in progress)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
410 B

package config
import (
"fmt"
)
type AlrmGroup struct {
Name string
Hosts map[string]*AlrmHost
}
func (ag *AlrmGroup) NewHost(name string) (*AlrmHost, error) {
if ag.Hosts == nil {
ag.Hosts = make(map[string]*AlrmHost)
}
if _, exists := ag.Hosts[name]; exists {
return nil, fmt.Errorf("host %s already exists", name)
}
host := &AlrmHost{Name: name}
ag.Hosts[name] = host
return host, nil
}