Documentation
¶
Index ¶
- Constants
- type Connections
- type HTTPRequests
- type HealthChecks
- type KeyValPairs
- type KeyValPairsByZone
- type NginxClient
- func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error
- func (client *NginxClient) AddKeyValPair(zone string, key string, val string) error
- func (client *NginxClient) AddStreamKeyValPair(zone string, key string, val string) error
- func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstreamServer) error
- func (client *NginxClient) CheckIfStreamUpstreamExists(upstream string) error
- func (client *NginxClient) CheckIfUpstreamExists(upstream string) error
- func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error
- func (client *NginxClient) DeleteKeyValPairs(zone string) error
- func (client *NginxClient) DeleteKeyValuePair(zone string, key string) error
- func (client *NginxClient) DeleteStreamKeyValPairs(zone string) error
- func (client *NginxClient) DeleteStreamKeyValuePair(zone string, key string) error
- func (client *NginxClient) DeleteStreamServer(upstream string, server string) error
- func (client *NginxClient) GetAllKeyValPairs() (KeyValPairsByZone, error)
- func (client *NginxClient) GetAllStreamKeyValPairs() (KeyValPairsByZone, error)
- func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, error)
- func (client *NginxClient) GetKeyValPairs(zone string) (KeyValPairs, error)
- func (client *NginxClient) GetStats() (*Stats, error)
- func (client *NginxClient) GetStreamKeyValPairs(zone string) (KeyValPairs, error)
- func (client *NginxClient) GetStreamServers(upstream string) ([]StreamUpstreamServer, error)
- func (client *NginxClient) ModifyKeyValPair(zone string, key string, val string) error
- func (client *NginxClient) ModifyStreamKeyValPair(zone string, key string, val string) error
- func (client *NginxClient) UpdateHTTPServers(upstream string, servers []UpstreamServer) ([]UpstreamServer, []UpstreamServer, error)
- func (client *NginxClient) UpdateStreamServers(upstream string, servers []StreamUpstreamServer) ([]StreamUpstreamServer, []StreamUpstreamServer, error)
- type NginxInfo
- type Peer
- type Queue
- type Responses
- type SSL
- type ServerZone
- type ServerZones
- type Sessions
- type Stats
- type StreamPeer
- type StreamServerZone
- type StreamServerZones
- type StreamUpstream
- type StreamUpstreamServer
- type StreamUpstreams
- type StreamZoneSync
- type StreamZoneSyncStatus
- type SyncZone
- type Upstream
- type UpstreamServer
- type Upstreams
Constants ¶
const APIVersion = 4
APIVersion is a version of NGINX Plus API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connections ¶
Connections represents connection related stats.
type HTTPRequests ¶
HTTPRequests represents HTTP request related stats.
type HealthChecks ¶
type HealthChecks struct { Checks uint64 Fails uint64 Unhealthy uint64 LastPassed bool `json:"last_passed"` }
HealthChecks represents health check related stats for a peer.
type KeyValPairs ¶
KeyValPairs are the key-value pairs stored in a zone.
type KeyValPairsByZone ¶
type KeyValPairsByZone map[string]KeyValPairs
KeyValPairsByZone are the KeyValPairs for all zones, by zone name.
type NginxClient ¶
type NginxClient struct {
// contains filtered or unexported fields
}
NginxClient lets you access NGINX Plus API.
func NewNginxClient ¶
func NewNginxClient(httpClient *http.Client, apiEndpoint string) (*NginxClient, error)
NewNginxClient creates an NginxClient.
func (*NginxClient) AddHTTPServer ¶
func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error
AddHTTPServer adds the server to the upstream.
func (*NginxClient) AddKeyValPair ¶
func (client *NginxClient) AddKeyValPair(zone string, key string, val string) error
AddKeyValPair adds a new key/value pair to a given HTTP zone.
func (*NginxClient) AddStreamKeyValPair ¶
func (client *NginxClient) AddStreamKeyValPair(zone string, key string, val string) error
AddStreamKeyValPair adds a new key/value pair to a given Stream zone.
func (*NginxClient) AddStreamServer ¶
func (client *NginxClient) AddStreamServer(upstream string, server StreamUpstreamServer) error
AddStreamServer adds the stream server to the upstream.
func (*NginxClient) CheckIfStreamUpstreamExists ¶
func (client *NginxClient) CheckIfStreamUpstreamExists(upstream string) error
CheckIfStreamUpstreamExists checks if the stream upstream exists in NGINX. If the upstream doesn't exist, it returns the error.
func (*NginxClient) CheckIfUpstreamExists ¶
func (client *NginxClient) CheckIfUpstreamExists(upstream string) error
CheckIfUpstreamExists checks if the upstream exists in NGINX. If the upstream doesn't exist, it returns the error.
func (*NginxClient) DeleteHTTPServer ¶
func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error
DeleteHTTPServer the server from the upstream.
func (*NginxClient) DeleteKeyValPairs ¶
func (client *NginxClient) DeleteKeyValPairs(zone string) error
DeleteKeyValPairs deletes all the key-value pairs in a given HTTP zone.
func (*NginxClient) DeleteKeyValuePair ¶
func (client *NginxClient) DeleteKeyValuePair(zone string, key string) error
DeleteKeyValuePair deletes the key/value pair for a key in a given HTTP zone.
func (*NginxClient) DeleteStreamKeyValPairs ¶
func (client *NginxClient) DeleteStreamKeyValPairs(zone string) error
DeleteStreamKeyValPairs deletes all the key-value pairs in a given Stream zone.
func (*NginxClient) DeleteStreamKeyValuePair ¶
func (client *NginxClient) DeleteStreamKeyValuePair(zone string, key string) error
DeleteStreamKeyValuePair deletes the key/value pair for a key in a given Stream zone.
func (*NginxClient) DeleteStreamServer ¶
func (client *NginxClient) DeleteStreamServer(upstream string, server string) error
DeleteStreamServer the server from the upstream.
func (*NginxClient) GetAllKeyValPairs ¶
func (client *NginxClient) GetAllKeyValPairs() (KeyValPairsByZone, error)
GetAllKeyValPairs fetches all key/value pairs for all HTTP zones.
func (*NginxClient) GetAllStreamKeyValPairs ¶
func (client *NginxClient) GetAllStreamKeyValPairs() (KeyValPairsByZone, error)
GetAllStreamKeyValPairs fetches all key/value pairs for all Stream zones.
func (*NginxClient) GetHTTPServers ¶
func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, error)
GetHTTPServers returns the servers of the upstream from NGINX.
func (*NginxClient) GetKeyValPairs ¶
func (client *NginxClient) GetKeyValPairs(zone string) (KeyValPairs, error)
GetKeyValPairs fetches key/value pairs for a given HTTP zone.
func (*NginxClient) GetStats ¶
func (client *NginxClient) GetStats() (*Stats, error)
GetStats gets connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API.
func (*NginxClient) GetStreamKeyValPairs ¶
func (client *NginxClient) GetStreamKeyValPairs(zone string) (KeyValPairs, error)
GetStreamKeyValPairs fetches key/value pairs for a given Stream zone.
func (*NginxClient) GetStreamServers ¶
func (client *NginxClient) GetStreamServers(upstream string) ([]StreamUpstreamServer, error)
GetStreamServers returns the stream servers of the upstream from NGINX.
func (*NginxClient) ModifyKeyValPair ¶
func (client *NginxClient) ModifyKeyValPair(zone string, key string, val string) error
ModifyKeyValPair modifies the value of an existing key in a given HTTP zone.
func (*NginxClient) ModifyStreamKeyValPair ¶
func (client *NginxClient) ModifyStreamKeyValPair(zone string, key string, val string) error
ModifyStreamKeyValPair modifies the value of an existing key in a given Stream zone.
func (*NginxClient) UpdateHTTPServers ¶
func (client *NginxClient) UpdateHTTPServers(upstream string, servers []UpstreamServer) ([]UpstreamServer, []UpstreamServer, error)
UpdateHTTPServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX.
func (*NginxClient) UpdateStreamServers ¶
func (client *NginxClient) UpdateStreamServers(upstream string, servers []StreamUpstreamServer) ([]StreamUpstreamServer, []StreamUpstreamServer, error)
UpdateStreamServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX.
type NginxInfo ¶
type NginxInfo struct { Version string Build string Address string Generation uint64 LoadTimestamp string `json:"load_timestamp"` Timestamp string ProcessID uint64 `json:"pid"` ParentProcessID uint64 `json:"ppid"` }
NginxInfo contains general information about NGINX Plus.
type Peer ¶
type Peer struct { ID int Server string Service string Name string Backup bool Weight int State string Active uint64 MaxConns int `json:"max_conns"` Requests uint64 Responses Responses Sent uint64 Received uint64 Fails uint64 HealthChecks HealthChecks `json:"health_checks"` Downtime uint64 Downstart string Selected string HeaderTime uint64 `json:"header_time"` ResponseTime uint64 `json:"response_time"` }
Peer represents peer (upstream server) related stats.
type Responses ¶
type Responses struct { Responses1xx uint64 `json:"1xx"` Responses2xx uint64 `json:"2xx"` Responses3xx uint64 `json:"3xx"` Responses4xx uint64 `json:"4xx"` Responses5xx uint64 `json:"5xx"` Total uint64 }
Responses represents HTTP response related stats.
type SSL ¶
type SSL struct { Handshakes uint64 HandshakesFailed uint64 `json:"handshakes_failed"` SessionReuses uint64 `json:"session_reuses"` }
SSL represents SSL related stats.
type ServerZone ¶
type ServerZone struct { Processing uint64 Requests uint64 Responses Responses Discarded uint64 Received uint64 Sent uint64 }
ServerZone represents server zone related stats.
type ServerZones ¶
type ServerZones map[string]ServerZone
ServerZones is map of server zone stats by zone name
type Sessions ¶
type Sessions struct { Sessions2xx uint64 `json:"2xx"` Sessions4xx uint64 `json:"4xx"` Sessions5xx uint64 `json:"5xx"` Total uint64 }
Sessions represents stream session related stats.
type Stats ¶
type Stats struct { NginxInfo NginxInfo Connections Connections HTTPRequests HTTPRequests SSL SSL ServerZones ServerZones Upstreams Upstreams StreamServerZones StreamServerZones StreamUpstreams StreamUpstreams StreamZoneSync *StreamZoneSync }
Stats represents NGINX Plus stats fetched from the NGINX Plus API. https://nginx.org/en/docs/http/ngx_http_api_module.html
type StreamPeer ¶
type StreamPeer struct { ID int Server string Service string Name string Backup bool Weight int State string Active uint64 MaxConns int `json:"max_conns"` Connections uint64 ConnectTime int `json:"connect_time"` FirstByteTime int `json:"first_byte_time"` ResponseTime uint64 `json:"response_time"` Sent uint64 Received uint64 Fails uint64 HealthChecks HealthChecks `json:"health_checks"` Downtime uint64 Downstart string Selected string }
StreamPeer represents peer (stream upstream server) related stats.
type StreamServerZone ¶
type StreamServerZone struct { Processing uint64 Connections uint64 Sessions Sessions Discarded uint64 Received uint64 Sent uint64 }
StreamServerZone represents stream server zone related stats.
type StreamServerZones ¶
type StreamServerZones map[string]StreamServerZone
StreamServerZones is map of stream server zone stats by zone name.
type StreamUpstream ¶
type StreamUpstream struct { Peers []StreamPeer Zombies int Zone string }
StreamUpstream represents stream upstream related stats.
type StreamUpstreamServer ¶
type StreamUpstreamServer struct { ID int `json:"id,omitempty"` Server string `json:"server"` MaxConns int `json:"max_conns"` MaxFails int `json:"max_fails"` FailTimeout string `json:"fail_timeout,omitempty"` SlowStart string `json:"slow_start,omitempty"` }
StreamUpstreamServer lets you configure Stream upstreams.
type StreamUpstreams ¶
type StreamUpstreams map[string]StreamUpstream
StreamUpstreams is a map of stream upstream stats by upstream name.
type StreamZoneSync ¶
type StreamZoneSync struct { Zones map[string]SyncZone Status StreamZoneSyncStatus }
StreamZoneSync represents the sync information per each shared memory zone and the sync information per node in a cluster
type StreamZoneSyncStatus ¶
type StreamZoneSyncStatus struct { BytesIn uint64 `json:"bytes_in"` MsgsIn uint64 `json:"msgs_in"` MsgsOut uint64 `json:"msgs_out"` BytesOut uint64 `json:"bytes_out"` NodesOnline uint64 `json:"nodes_online"` }
StreamZoneSyncStatus represents the status of a shared memory zone
type SyncZone ¶
type SyncZone struct { RecordsPending uint64 `json:"records_pending"` RecordsTotal uint64 `json:"records_total"` }
SyncZone represents the synchronization status of a shared memory zone
type UpstreamServer ¶
type UpstreamServer struct { ID int `json:"id,omitempty"` Server string `json:"server"` MaxConns int `json:"max_conns"` MaxFails int `json:"max_fails"` FailTimeout string `json:"fail_timeout,omitempty"` SlowStart string `json:"slow_start,omitempty"` }
UpstreamServer lets you configure HTTP upstreams.