Commit Diff


commit - 8635d20e62566f62e2365441d2091b721cd8ef71
commit + 83f511305d76af055cecefced0265cee26d63d75
blob - f7e037875aad09f3f9c8d9d471b89047f21183d9
blob + 3a84467cec091e7f675eb95959ffdcaac04a5ec6
--- http.go
+++ http.go
@@ -63,7 +63,7 @@ func newRequest(method, host, path string, body io.Rea
 }
 
 func (c *Client) get(path string) (*http.Response, error) {
-	req, err := newRequest(http.MethodGet, c.host, path, nil)
+	req, err := newRequest(http.MethodGet, c.addr, path, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -71,7 +71,7 @@ func (c *Client) get(path string) (*http.Response, err
 }
 
 func (c *Client) post(path string, body io.Reader) (*http.Response, error) {
-	req, err := newRequest(http.MethodPost, c.host, path, body)
+	req, err := newRequest(http.MethodPost, c.addr, path, body)
 	if err != nil {
 		return nil, err
 	}
@@ -79,7 +79,7 @@ func (c *Client) post(path string, body io.Reader) (*h
 }
 
 func (c *Client) put(path string, body io.Reader) error {
-	req, err := newRequest(http.MethodPut, c.host, path, body)
+	req, err := newRequest(http.MethodPut, c.addr, path, body)
 	if err != nil {
 		return err
 	}
@@ -99,7 +99,7 @@ func (c *Client) put(path string, body io.Reader) erro
 }
 
 func (c *Client) delete(path string) error {
-	req, err := newRequest(http.MethodDelete, c.host, path, nil)
+	req, err := newRequest(http.MethodDelete, c.addr, path, nil)
 	if err != nil {
 		return err
 	}
blob - a268dee69097cbccbda0932108fc00149c0685ef
blob + 192b34d6811b50bb362732c15399eae8ab09f608
--- icinga.go
+++ icinga.go
@@ -28,6 +28,21 @@ import (
 	"net/http"
 )
 
+type State int
+
+const (
+	StateOK State = 0 + iota
+	StateWarning
+	StateCritical
+	StateUnknown
+)
+
+const (
+	HostUp State = 0 + iota
+	HostDown
+	HostUnknown
+)
+
 // A Client represents a client connection to the Icinga2 HTTP API.
 // It should be created using Dial.
 // Since Client wraps http.Client, standard methods such as Get and