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.

27 lines
457 B

  1. package config
  2. import (
  3. "git.binarythought.com/cdramey/alrm/check"
  4. )
  5. type Host struct {
  6. Name string
  7. Address string
  8. Checks []check.Check
  9. }
  10. func (ah *Host) GetAddress() string {
  11. if ah.Address != "" {
  12. return ah.Address
  13. }
  14. return ah.Name
  15. }
  16. func (ah *Host) NewCheck(name string) (check.Check, error) {
  17. chk, err := check.NewCheck(name, ah.GetAddress())
  18. if err != nil {
  19. return nil, err
  20. }
  21. ah.Checks = append(ah.Checks, chk)
  22. return chk, nil
  23. }