Documentation
¶
Index ¶
- type APIResults
- type ActiveCheck
- type Client
- func (c *Client) APIRequest(method, APICall string, jsonString []byte) (APIResults, error)
- func (c *Client) HostExist(hostname string) (bool, error)
- func (c *Client) ResetAllDowntime(hostname string) error
- func (c *Client) ResetDowntime(hostname, object string) error
- func (c *Client) SendNotification(filter, checkType, author, message string, force bool) error
- func (c *Client) SetActiveChecks(hostname, path string, check bool) error
- func (c *Client) SetAllActiveChecks(hostname string, check bool) error
- func (c *Client) SetAllDowntime(hostname, author, comment string, start, end time.Time) error
- func (c *Client) SetAllNotifications(hostname string, check bool) error
- func (c *Client) SetDowntime(hostname, object, author, comment string, start, end time.Time) error
- func (c *Client) SetNotifications(hostname, path string, check bool) error
- type Config
- type CustomNotification
- type Host
- type Notifications
- type ResetDowntime
- type ScheduleDowntime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResults ¶
type APIResults struct {
StatusCode int
Exists bool
Results []struct {
Code float64 `json:"code"`
Errors []string `json:"errors"`
Status string `json:"status"`
Name string `json:"name"`
Type string `json:"type"`
Attrs struct {
AttrsInfo map[string]interface{} `json:"-,"`
} `json:"attrs"`
Joins struct{} `json:"joins"`
Meta struct{} `json:"meta"`
} `json:"results"`
}
APIResults response from icinga API StatusCode is the http code. Code is the code in the body from icinga
type ActiveCheck ¶
type ActiveCheck struct {
Filter string `json:"filter"`
Attrs struct {
EnableActiveChecks bool `json:"enable_active_checks"`
} `json:"attrs"`
}
ActiveCheck Basic body to disable active check on a host
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the icinga2 http client
func (*Client) APIRequest ¶
func (c *Client) APIRequest(method, APICall string, jsonString []byte) (APIResults, error)
APIRequest can change attributes to icinga objects. Example is active checks, downtime, notifications. This can also be used to create and delete new object in icinga.
func (*Client) ResetAllDowntime ¶
ResetAllDowntime will turn Downtime off for the host and all the services
func (*Client) ResetDowntime ¶
ResetDowntime will turn Downtime off for either a host or service
func (*Client) SendNotification ¶
SendNotification will send a custom notification out
func (*Client) SetActiveChecks ¶
SetActiveChecks will set Active checks on or off for either a host or service
func (*Client) SetAllActiveChecks ¶
SetAllActiveChecks will turn Active check on or off for the host and all the services
func (*Client) SetAllDowntime ¶
SetAllDowntime will turn Downtime for the host and all the services
func (*Client) SetAllNotifications ¶
SetAllNotifications will turn notifications on or off for the host and all the services
func (*Client) SetDowntime ¶
SetDowntime will set Downtime for either a host or service
type Config ¶
type Config struct {
BaseURL string
Username string
Password string
TLSClientCert string
TLSClientKey string
TLSCACert string
TLSInsecure bool
// contains filtered or unexported fields
}
Config setups the information needed to connect to icinga If the system has icinga installed then you should use the cets used in /etc/icinga2/pki Username/Password should only used if it does not have a icinga2 agent installed.
type CustomNotification ¶
type CustomNotification struct {
Filter string `json:"filter"`
Type string `json:"type"`
Author string `json:"author"`
Comment string `json:"comment"`
Force bool `json:"force"`
}
CustomNotification body to send custom notifications for a host or service
type Host ¶
type Host struct {
Filter string `json:"filter,omitempty"`
Attrs []string `json:"attrs,omitempty"`
}
Host Basic Body needed to get Host information
type Notifications ¶
type Notifications struct {
Filter string `json:"filter"`
Attrs struct {
EnableNotificationss bool `json:"enable_notifications"`
} `json:"attrs"`
}
Notifications Basic body to disable notifications for a host or service
type ResetDowntime ¶
ResetDowntime Basic body to schedule downtime for a host
type ScheduleDowntime ¶
type ScheduleDowntime struct {
Type string `json:"type"`
Filter string `json:"filter"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Author string `json:"author"`
Comment string `json:"comment"`
}
ScheduleDowntime Basic body to schedule downtime for a host