scraper

package
v0.0.0-...-f05999e Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caches

type Caches map[string]struct {
	// added in version 2
	Size    int64 `json:"size"`
	MaxSize int64 `json:"max_size"`
	Cold    bool  `json:"cold"`
	Hit     struct {
		Responses int64 `json:"responses"`
		Bytes     int64 `json:"bytes"`
	} `json:"hit"`
	Stale struct {
		Responses int64 `json:"responses"`
		Bytes     int64 `json:"bytes"`
	} `json:"stale"`
	Updating struct {
		Responses int64 `json:"responses"`
		Bytes     int64 `json:"bytes"`
	} `json:"updating"`
	Revalidated *struct {
		// added in version 3
		Responses int64 `json:"responses"`
		Bytes     int64 `json:"bytes"`
	} `json:"revalidated"`
	Miss struct {
		Responses        int64 `json:"responses"`
		Bytes            int64 `json:"bytes"`
		ResponsesWritten int64 `json:"responses_written"`
		BytesWritten     int64 `json:"bytes_written"`
	} `json:"miss"`
	Expired struct {
		Responses        int64 `json:"responses"`
		Bytes            int64 `json:"bytes"`
		ResponsesWritten int64 `json:"responses_written"`
		BytesWritten     int64 `json:"bytes_written"`
	} `json:"expired"`
	Bypass struct {
		Responses        int64 `json:"responses"`
		Bytes            int64 `json:"bytes"`
		ResponsesWritten int64 `json:"responses_written"`
		BytesWritten     int64 `json:"bytes_written"`
	} `json:"bypass"`
}

Caches contains a lot of information of cache, like: current size of cache, the limit on the maximum size of the cache, total number of responses and total number of bytes read from the cache, total number of requests not read from the cache and number of bytes read from proxied server, number of responses and bytes written to the cache.

type Connections

type Connections struct {
	Accepted int `json:"accepted"`
	Dropped  int `json:"dropped"`
	Active   int `json:"active"`
	Idle     int `json:"idle"`
}

Connections contains the total number of accepted, dropped, active and idle client connections.

type NginxPlusScraper

type NginxPlusScraper struct{}

NginxPlusScraper is scraper for getting nginx plus metrics

func NewNginxPlusScraper

func NewNginxPlusScraper() NginxPlusScraper

NewNginxPlusScraper crates new nginx plus stats scraper

func (*NginxPlusScraper) Scrape

func (scr *NginxPlusScraper) Scrape(body io.Reader, metrics chan<- metric.Metric, labels map[string]string) error

Scrape scrapes stats from nginx plus module

type NginxScraper

type NginxScraper struct{}

NginxScraper is the main struct of nginx stats scraper

func NewNginxScraper

func NewNginxScraper() NginxScraper

NewNginxScraper creates new nginx status scraper

func (*NginxScraper) Scrape

func (scr *NginxScraper) Scrape(body io.Reader, metrics chan<- metric.Metric, labels map[string]string) error

Scrape scrapes full information from nginx

type Processes

type Processes struct {
	// added in version 5
	Respawned *int `json:"respawned"`
}

Processes contains the total number of respawned child processes.

type Requests

type Requests struct {
	Total   int64 `json:"total"`
	Current int   `json:"current"`
}

Requests contains total and current number of client requests.

type ServerZones

type ServerZones map[string]struct {
	// added in version 2
	Processing int   `json:"processing"`
	Requests   int64 `json:"requests"`
	Responses  struct {
		Responses1xx int64 `json:"1xx"`
		Responses2xx int64 `json:"2xx"`
		Responses3xx int64 `json:"3xx"`
		Responses4xx int64 `json:"4xx"`
		Responses5xx int64 `json:"5xx"`
		Total        int64 `json:"total"`
	} `json:"responses"`
	Discarded *int64 `json:"discarded"` // added in version 6
	Received  int64  `json:"received"`
	Sent      int64  `json:"sent"`
}

ServerZones contains info about processed requests, requests received from clients, number of responses from clients with http statuses, total number of requests completed without sending a response, number of bytes received and sent.

type Ssl

type Ssl struct {
	// added in version 6
	Handshakes       int64 `json:"handshakes"`
	HandshakesFailed int64 `json:"handshakes_failed"`
	SessionReuses    int64 `json:"session_reuses"`
}

Ssl contains the total number of successful, failed SSL handshakes and number of sessions reuses during SSL handshake.

type Status

type Status struct {
	Version       int    `json:"version"`
	NginxVersion  string `json:"nginx_version"`
	Address       string `json:"address"`
	Generation    *int   `json:"generation"`     // added in version 5
	LoadTimestamp *int64 `json:"load_timestamp"` // added in version 2
	Timestamp     int64  `json:"timestamp"`
	Pid           *int   `json:"pid"` // added in version 6

	Processes   *Processes  `json:"processes"`
	Connections Connections `json:"connections"`
	Ssl         *Ssl        `json:"ssl"`
	Requests    Requests    `json:"requests"`
	ServerZones ServerZones `json:"server_zones"`
	Upstreams   Upstreams   `json:"upstreams"`
	Caches      Caches      `json:"caches"`
	Stream      Stream      `json:"stream"`
}

Status is the main struct of nginx plus statistics.

type Stream

type Stream struct {
	ServerZones map[string]struct {
		Processing  int `json:"processing"`
		Connections int `json:"connections"`
		Sessions    *struct {
			Total       int64 `json:"total"`
			Sessions1xx int64 `json:"1xx"`
			Sessions2xx int64 `json:"2xx"`
			Sessions3xx int64 `json:"3xx"`
			Sessions4xx int64 `json:"4xx"`
			Sessions5xx int64 `json:"5xx"`
		} `json:"sessions"`
		Discarded *int64 `json:"discarded"` // added in version 7
		Received  int64  `json:"received"`
		Sent      int64  `json:"sent"`
	} `json:"server_zones"`
	Upstreams map[string]struct {
		Peers []struct {
			ID            int    `json:"id"`
			Server        string `json:"server"`
			Backup        bool   `json:"backup"`
			Weight        int    `json:"weight"`
			State         string `json:"state"`
			Active        int    `json:"active"`
			Connections   int64  `json:"connections"`
			ConnectTime   *int   `json:"connect_time"`
			FirstByteTime *int   `json:"first_byte_time"`
			ResponseTime  *int   `json:"response_time"`
			Sent          int64  `json:"sent"`
			Received      int64  `json:"received"`
			Fails         int64  `json:"fails"`
			Unavail       int64  `json:"unavail"`
			HealthChecks  struct {
				Checks     int64 `json:"checks"`
				Fails      int64 `json:"fails"`
				Unhealthy  int64 `json:"unhealthy"`
				LastPassed *bool `json:"last_passed"`
			} `json:"health_checks"`
			Downtime  int64 `json:"downtime"`
			Downstart int64 `json:"downstart"`
			Selected  int64 `json:"selected"`
		} `json:"peers"`
		Zombies int `json:"zombies"`
	} `json:"upstreams"`
}

Stream contains a lot of information about streams, like: the number of processed client connections, number of accepted connections, number of completed client sessions with http statuses, number of connections without creating a session, number of bytes received from clients, total number of bytes sent to clients and more information about upstreams.

type Upstreams

type Upstreams map[string]struct {
	Peers []struct {
		ID        *int   `json:"id"` // added in version 3
		Server    string `json:"server"`
		Backup    bool   `json:"backup"`
		Weight    int    `json:"weight"`
		State     string `json:"state"`
		Active    int    `json:"active"`
		Keepalive *int   `json:"keepalive"` // removed in version 5
		MaxConns  *int   `json:"max_conns"` // added in version 3
		Requests  int64  `json:"requests"`
		Responses struct {
			Responses1xx int64 `json:"1xx"`
			Responses2xx int64 `json:"2xx"`
			Responses3xx int64 `json:"3xx"`
			Responses4xx int64 `json:"4xx"`
			Responses5xx int64 `json:"5xx"`
			Total        int64 `json:"total"`
		} `json:"responses"`
		Sent         int64 `json:"sent"`
		Received     int64 `json:"received"`
		Fails        int64 `json:"fails"`
		Unavail      int64 `json:"unavail"`
		HealthChecks struct {
			Checks     int64 `json:"checks"`
			Fails      int64 `json:"fails"`
			Unhealthy  int64 `json:"unhealthy"`
			LastPassed *bool `json:"last_passed"`
		} `json:"health_checks"`
		Downtime     int64  `json:"downtime"`
		Downstart    int64  `json:"downstart"`
		Selected     *int64 `json:"selected"`      // added in version 4
		HeaderTime   *int64 `json:"header_time"`   // added in version 5
		ResponseTime *int64 `json:"response_time"` // added in version 5
	} `json:"peers"`
	Keepalive int `json:"keepalive"`
	Zombies   int `json:"zombies"` // added in version 6
	Queue     *struct {
		// added in version 6
		Size      int   `json:"size"`
		MaxSize   int   `json:"max_size"`
		Overflows int64 `json:"overflows"`
	} `json:"queue"`
}

Upstreams contains a lot of information about upstreams, like: peers info, current number of idle keepalive connections, total number of zombies, the size of requests queue.

Jump to

Keyboard shortcuts

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