5 func (s Service) name() string {
9 func (s Service) path() string {
10 return "/objects/services/" + s.Name
13 // Service represents a Service object.
15 Name string `json:"__name"`
18 CheckCommand string `json:"check_command"`
19 DisplayName string `json:"display_name:"`
25 ServiceOK ServiceState = 0 + iota
31 func (s ServiceState) String() string {
36 return "ServiceWarning"
38 return "ServiceCritical"
40 return "ServiceUnknown"
42 return "unhandled service state"
45 func (s Service) MarshalJSON() ([]byte, error) {
46 attrs := make(map[string]interface{})
47 if len(s.Groups) > 0 {
48 attrs["groups"] = s.Groups
50 attrs["check_command"] = s.CheckCommand
51 attrs["display_name"] = s.DisplayName
53 Attrs map[string]interface{} `json:"attrs"`
55 return json.Marshal(jservice)