nagios

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NagiosProvider

func NagiosProvider() *schema.Provider

Provider function defines the schema and resources for this Nagios provider

Types

type AuthServer added in v1.4.0

type AuthServer struct {
	ID                  string `json:"id"`
	ServerID            string `json:"server_id"`
	Enabled             string `json:"enabled"`
	ConnectionMethod    string `json:"conn_method"`
	ADAccountSuffix     string `json:"ad_account_suffix,omitempty"`
	ADDomainControllers string `json:"ad_domain_controllers,omitempty"`
	BaseDN              string `json:"base_dn,omitempty"`
	SecurityLevel       string `json:"security_level,omitempty"`
	LDAPPort            string `json:"ldap_port,omitempty"`
	LDAPHost            string `json:"ldap_host,omitempty"`
}

AuthServer contains all attributes required to create an authentication server in Nagios

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client used to store info required to communicate with Nagios

func NewClient

func NewClient(url, token string) *Client

NewClient creates a pointer to the client that will be used to send requests to Nagios

type Contact added in v1.2.0

type Contact struct {
	ContactName                 string        `json:"contact_name"`
	HostNotificationsEnabled    string        `json:"host_notifications_enabled,omitempty"`
	ServiceNotificationsEnabled string        `json:"service_notifications_enabled,omitempty"`
	HostNotificationPeriod      string        `json:"host_notification_period,omitempty"`
	ServiceNotificationPeriod   string        `json:"service_notification_period,omitempty"`
	HostNotificationOptions     string        `json:"host_notification_options,omitempty"`
	ServiceNotificationOptions  string        `json:"service_notification_options,omitempty"`
	HostNotificationCommands    []interface{} `json:"host_notification_commands,omitempty"`
	ServiceNotificationCommands []interface{} `json:"service_notification_commands,omitempty"`
	Alias                       string        `json:"alias,omitempty"`
	ContactGroups               []interface{} `json:"contact_groups,omitempty"`
	Templates                   []interface{} `json:"use,omitempty"`
	Email                       string        `json:"email,omitempty"`
	Pager                       string        `json:"pager,omitempty"`
	Address1                    string        `json:"address1,omitempty"`
	Address2                    string        `json:"address2,omitempty"`
	Address3                    string        `json:"address3,omitempty"`
	CanSubmitCommands           string        `json:"can_submit_commands,omitempty"`
	RetainStatusInformation     string        `json:"retain_status_information,omitempty"`
	RetainNonstatusInformation  string        `json:"retain_nonstatus_information,omitempty"`
}

Contact contains all attributes that can be set in Nagios

type Contactgroup added in v1.2.0

type Contactgroup struct {
	ContactgroupName    string        `json:"contactgroup_name"`
	Alias               string        `json:"alias"`
	Members             []interface{} `json:"members,omitempty"`
	ContactgroupMembers []interface{} `json:"contactgroup_members,omitempty"`
}

TODO: Need to add in all of the other fields. What we have right now will work for initial testing

type Host

type Host struct {
	HostName                   string                 `json:"host_name"`
	Address                    string                 `json:"address"`
	DisplayName                string                 `json:"display_name,omitempty"`
	MaxCheckAttempts           string                 `json:"max_check_attempts"`
	CheckPeriod                string                 `json:"check_period"`
	NotificationInterval       string                 `json:"notification_interval"`
	NotificationPeriod         string                 `json:"notification_period"`
	Contacts                   []interface{}          `json:"contacts"`
	Alias                      string                 `json:"alias,omitempty"`
	Templates                  []interface{}          `json:"use,omitempty"`
	CheckCommand               string                 `json:"check_command,omitempty"`
	ContactGroups              []interface{}          `json:"contact_groups,omitempty"`
	Notes                      string                 `json:"notes,omitempty"`
	NotesURL                   string                 `json:"notes_url,omitempty"`
	ActionURL                  string                 `json:"action_url,omitempty"`
	InitialState               string                 `json:"initial_state,omitempty"`
	RetryInterval              string                 `json:"retry_interval,omitempty"`
	PassiveChecksEnabled       string                 `json:"passive_checks_enabled,omitempty"`
	ActiveChecksEnabled        string                 `json:"active_checks_enabled,omitempty"`
	ObsessOverHost             string                 `json:"obsess_over_host,omitempty"`
	EventHandler               string                 `json:"event_handler,omitempty"`
	EventHandlerEnabled        string                 `json:"event_handler_enabled,omitempty"`
	FlapDetectionEnabled       string                 `json:"flap_detection_enabled,omitempty"`
	FlapDetectionOptions       []interface{}          `json:"flap_detection_options,omitempty"`
	LowFlapThreshold           string                 `json:"low_flap_threshold,omitempty"`
	HighFlapThreshold          string                 `json:"high_flap_threshold,omitempty"`
	ProcessPerfData            string                 `json:"process_perf_data,omitempty"`
	RetainStatusInformation    string                 `json:"retain_status_information,omitempty"`
	RetainNonstatusInformation string                 `json:"retain_nonstatus_information,omitempty"`
	CheckFreshness             string                 `json:"check_freshness,omitempty"`
	FreshnessThreshold         string                 `json:"freshness_threshold,omitempty"`
	FirstNotificationDelay     string                 `json:"first_notification_delay,omitempty"`
	NotificationOptions        string                 `json:"notification_options,omitempty"`
	NotificationsEnabled       string                 `json:"notifications_enabled,omitempty"`
	StalkingOptions            string                 `json:"stalking_options,omitempty"`
	IconImage                  string                 `json:"icon_image,omitempty"`
	IconImageAlt               string                 `json:"icon_image_alt,omitempty"`
	VRMLImage                  string                 `json:"vrml_image,omitempty"`
	StatusMapImage             string                 `json:"statusmap_image,omitempty"`
	TwoDCoords                 string                 `json:"2d_coords,omitempty"`
	ThreeDCoords               string                 `json:"3d_coords,omitempty"`
	Register                   string                 `json:"register,omitempty"`
	FreeVariables              map[string]interface{} `json:"free_variables,omitempty"`
}

type Hostgroup

type Hostgroup struct {
	Name      string        `json:"hostgroup_name"`
	Alias     string        `json:"alias"`
	Members   []interface{} `json:"members,omitempty"`
	Notes     string        `json:"notes,omitempty"`
	NotesURL  string        `json:"notes_url,omitempty"`
	ActionURL string        `json:"action_url,omitempty"`
}

Hostgroup contains all info needed to create a hostgroup in Nagios TODO: Test to see if we need both JSON and schema tags EWe tag with both JSON and schema because a POST uses URL encoding to send data A GET returns data in JSON format

type MapOfAuthServers added in v1.4.0

type MapOfAuthServers struct {
	Records         int          `json:"records"`
	AuthServerEntry []AuthServer `json:"authservers"`
}

MapOfAuthServers allows to marshal the response from Nagios XI into an array of auth servers Nagios provides a different response than other API endpoints in this regard. Once we have the data in this struct, we can then migrate it into the AuthServer struct to finish processing

type ResponseStatus

type ResponseStatus struct {
	StatusSuccess string `json:"success"`
	StatusError   string `json:"error"`
}

type Service

type Service struct {
	ServiceName                string                 `json:"config_name"`
	HostName                   []interface{}          `json:"host_name"`
	DisplayName                string                 `json:"display_name,omitempty"`
	Description                string                 `json:"service_description"`
	CheckCommand               string                 `json:"check_command"`
	MaxCheckAttempts           string                 `json:"max_check_attempts"`
	CheckInterval              string                 `json:"check_interval"`
	RetryInterval              string                 `json:"retry_interval"`
	CheckPeriod                string                 `json:"check_period"`
	NotificationInterval       string                 `json:"notification_interval"`
	NotificationPeriod         string                 `json:"notification_period"`
	Contacts                   []interface{}          `json:"contacts"`
	Templates                  []interface{}          `json:"use,omitempty"`
	IsVolatile                 string                 `json:"is_volatile,omitempty"`
	InitialState               string                 `json:"initial_state,omitempty"`
	ActiveChecksEnabled        string                 `json:"active_checks_enabled,omitempty"`
	PassiveChecksEnabled       string                 `json:"passive_checks_enabled,omitempty"`
	ObsessOverService          string                 `json:"obsess_over_service,omitempty"`
	CheckFreshness             string                 `json:"check_freshness,omitempty"`
	FreshnessThreshold         string                 `json:"freshness_threshold,omitempty"`
	EventHandler               string                 `json:"event_handler,omitempty"`
	EventHandlerEnabled        string                 `json:"event_handler_enabled,omitempty"`
	LowFlapThreshold           string                 `json:"low_flap_threshold,omitempty"`
	HighFlapThreshold          string                 `json:"high_flap_threshold,omitempty"`
	FlapDetectionEnabled       string                 `json:"flap_detection_enabled,omitempty"`
	FlapDetectionOptions       []interface{}          `json:"flap_detection_options,omitempty"`
	ProcessPerfData            string                 `json:"process_perf_data,omitempty"`
	RetainStatusInformation    string                 `json:"retain_status_information,omitempty"`
	RetainNonStatusInformation string                 `json:"retain_nonstatus_information,omitempty"`
	FirstNotificationDelay     string                 `json:"first_notification_delay,omitempty"`
	NotificationOptions        []interface{}          `json:"notification_options,omitempty"`
	NotificationsEnabled       string                 `json:"notifications_enabled,omitempty"`
	ContactGroups              []interface{}          `json:"contact_groups,omitemptys"`
	Notes                      string                 `json:"notes,omitempty"`
	NotesURL                   string                 `json:"notes_url,omitempty"`
	ActionURL                  string                 `json:"action_url,omitempty"`
	IconImage                  string                 `json:"icon_image,omitempty"`
	IconImageAlt               string                 `json:"icon_image_alt,omitempty"`
	Register                   string                 `json:"register,omitempty"`
	FreeVariables              map[string]interface{} `json:"free_variables,omitempty"`
}

TODO: Need to add in all of the other fields. What we have right now will work for initial testing

type Servicegroup

type Servicegroup struct {
	Name      string        `json:"servicegroup_name,omitempty"`
	Alias     string        `json:"alias,omitempty"`
	Members   []interface{} `json:"members,omitempty"`
	Notes     string        `json:"notes,omitempty"`
	NotesURL  string        `json:"notes_url,omitempty"`
	ActionURL string        `json:"action_url,omitempty"`
}

servicegroup contains all info needed to create a servicegroup in Nagios TODO: Test to see if we need both JSON and schema tags EWe tag with both JSON and schema because a POST uses URL encoding to send data A GET returns data in JSON format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL