github.com/netdata/go.d.plugin@v0.58.1/modules/nginxplus/nginx_http_api.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package nginxplus
     4  
     5  import "time"
     6  
     7  // https://demo.nginx.com/dashboard.html
     8  // https://demo.nginx.com/swagger-ui/
     9  // http://nginx.org/en/docs/http/ngx_http_api_module.html
    10  
    11  type nginxAPIVersions []int64
    12  
    13  type (
    14  	nginxInfo struct {
    15  		Version       string    `json:"version"`
    16  		Build         string    `json:"build"`
    17  		Address       string    `json:"address"`
    18  		Generation    int       `json:"generation"`
    19  		LoadTimestamp time.Time `json:"load_timestamp"`
    20  		Timestamp     time.Time `json:"timestamp"`
    21  	}
    22  	nginxConnections struct {
    23  		Accepted int64 `json:"accepted"`
    24  		Dropped  int64 `json:"dropped"`
    25  		Active   int64 `json:"active"`
    26  		Idle     int64 `json:"idle"`
    27  	}
    28  	nginxSSL struct {
    29  		Handshakes       int64 `json:"handshakes"`
    30  		HandshakesFailed int64 `json:"handshakes_failed"`
    31  		SessionReuses    int64 `json:"session_reuses"`
    32  		NoCommonProtocol int64 `json:"no_common_protocol"`
    33  		NoCommonCipher   int64 `json:"no_common_cipher"`
    34  		HandshakeTimeout int64 `json:"handshake_timeout"`
    35  		PeerRejectedCert int64 `json:"peer_rejected_cert"`
    36  		VerifyFailures   struct {
    37  			NoCert           int64 `json:"no_cert"`
    38  			ExpiredCert      int64 `json:"expired_cert"`
    39  			RevokedCert      int64 `json:"revoked_cert"`
    40  			HostnameMismatch int64 `json:"hostname_mismatch"`
    41  			Other            int64 `json:"other"`
    42  		} `json:"verify_failures"`
    43  	}
    44  )
    45  
    46  type (
    47  	nginxHTTPRequests struct {
    48  		Total   int64 `json:"total"`
    49  		Current int64 `json:"current"`
    50  	}
    51  	nginxHTTPServerZones map[string]struct {
    52  		Processing int64 `json:"processing"`
    53  		Requests   int64 `json:"requests"`
    54  		Responses  struct {
    55  			Class1xx int64 `json:"1xx"`
    56  			Class2xx int64 `json:"2xx"`
    57  			Class3xx int64 `json:"3xx"`
    58  			Class4xx int64 `json:"4xx"`
    59  			Class5xx int64 `json:"5xx"`
    60  			Total    int64
    61  		} `json:"responses"`
    62  		Discarded int64 `json:"discarded"`
    63  		Received  int64 `json:"received"`
    64  		Sent      int64 `json:"sent"`
    65  	}
    66  	nginxHTTPLocationZones map[string]struct {
    67  		Requests  int64 `json:"requests"`
    68  		Responses struct {
    69  			Class1xx int64 `json:"1xx"`
    70  			Class2xx int64 `json:"2xx"`
    71  			Class3xx int64 `json:"3xx"`
    72  			Class4xx int64 `json:"4xx"`
    73  			Class5xx int64 `json:"5xx"`
    74  			Total    int64
    75  		} `json:"responses"`
    76  		Discarded int64 `json:"discarded"`
    77  		Received  int64 `json:"received"`
    78  		Sent      int64 `json:"sent"`
    79  	}
    80  	nginxHTTPUpstreams map[string]struct {
    81  		Peers []struct {
    82  			Id           int64  `json:"id"`
    83  			Server       string `json:"server"`
    84  			Name         string `json:"name"`
    85  			Backup       bool   `json:"backup"`
    86  			Weight       int64  `json:"weight"`
    87  			State        string `json:"state"`
    88  			Active       int64  `json:"active"`
    89  			Requests     int64  `json:"requests"`
    90  			HeaderTime   int64  `json:"header_time"`
    91  			ResponseTime int64  `json:"response_time"`
    92  			Responses    struct {
    93  				Class1xx int64 `json:"1xx"`
    94  				Class2xx int64 `json:"2xx"`
    95  				Class3xx int64 `json:"3xx"`
    96  				Class4xx int64 `json:"4xx"`
    97  				Class5xx int64 `json:"5xx"`
    98  				Total    int64
    99  			} `json:"responses"`
   100  			Sent         int64 `json:"sent"`
   101  			Received     int64 `json:"received"`
   102  			Fails        int64 `json:"fails"`
   103  			Unavail      int64 `json:"unavail"`
   104  			HealthChecks struct {
   105  				Checks    int64 `json:"checks"`
   106  				Fails     int64 `json:"fails"`
   107  				Unhealthy int64 `json:"unhealthy"`
   108  			} `json:"health_checks"`
   109  			Downtime int64     `json:"downtime"`
   110  			Selected time.Time `json:"selected"`
   111  		} `json:"peers"`
   112  		Keepalive int64  `json:"keepalive"`
   113  		Zombies   int64  `json:"zombies"`
   114  		Zone      string `json:"zone"`
   115  	}
   116  	nginxHTTPCaches map[string]struct {
   117  		Size int64 `json:"size"`
   118  		Cold bool  `json:"cold"`
   119  		Hit  struct {
   120  			Responses int64 `json:"responses"`
   121  			Bytes     int64 `json:"bytes"`
   122  		} `json:"hit"`
   123  		Stale struct {
   124  			Responses int64 `json:"responses"`
   125  			Bytes     int64 `json:"bytes"`
   126  		} `json:"stale"`
   127  		Updating struct {
   128  			Responses int64 `json:"responses"`
   129  			Bytes     int64 `json:"bytes"`
   130  		} `json:"updating"`
   131  		Revalidated struct {
   132  			Responses int64 `json:"responses"`
   133  			Bytes     int64 `json:"bytes"`
   134  		} `json:"revalidated"`
   135  		Miss struct {
   136  			Responses        int64 `json:"responses"`
   137  			Bytes            int64 `json:"bytes"`
   138  			ResponsesWritten int64 `json:"responses_written"`
   139  			BytesWritten     int64 `json:"bytes_written"`
   140  		} `json:"miss"`
   141  		Expired struct {
   142  			Responses        int64 `json:"responses"`
   143  			Bytes            int64 `json:"bytes"`
   144  			ResponsesWritten int64 `json:"responses_written"`
   145  			BytesWritten     int64 `json:"bytes_written"`
   146  		} `json:"expired"`
   147  		Bypass struct {
   148  			Responses        int64 `json:"responses"`
   149  			Bytes            int64 `json:"bytes"`
   150  			ResponsesWritten int64 `json:"responses_written"`
   151  			BytesWritten     int64 `json:"bytes_written"`
   152  		} `json:"bypass"`
   153  	}
   154  )
   155  
   156  type (
   157  	nginxStreamServerZones map[string]struct {
   158  		Processing  int64 `json:"processing"`
   159  		Connections int64 `json:"connections"`
   160  		Sessions    struct {
   161  			Class2xx int64 `json:"2xx"`
   162  			Class4xx int64 `json:"4xx"`
   163  			Class5xx int64 `json:"5xx"`
   164  			Total    int64 `json:"total"`
   165  		} `json:"sessions"`
   166  		Discarded int64 `json:"discarded"`
   167  		Received  int64 `json:"received"`
   168  		Sent      int64 `json:"sent"`
   169  	}
   170  	nginxStreamUpstreams map[string]struct {
   171  		Peers []struct {
   172  			Id           int64  `json:"id"`
   173  			Server       string `json:"server"`
   174  			Name         string `json:"name"`
   175  			Backup       bool   `json:"backup"`
   176  			Weight       int64  `json:"weight"`
   177  			State        string `json:"state"`
   178  			Active       int64  `json:"active"`
   179  			Connections  int64  `json:"connections"`
   180  			Sent         int64  `json:"sent"`
   181  			Received     int64  `json:"received"`
   182  			Fails        int64  `json:"fails"`
   183  			Unavail      int64  `json:"unavail"`
   184  			HealthChecks struct {
   185  				Checks    int64 `json:"checks"`
   186  				Fails     int64 `json:"fails"`
   187  				Unhealthy int64 `json:"unhealthy"`
   188  			} `json:"health_checks"`
   189  			Downtime int64 `json:"downtime"`
   190  		} `json:"peers"`
   191  		Zombies int64  `json:"zombies"`
   192  		Zone    string `json:"zone"`
   193  	}
   194  )
   195  
   196  type nginxResolvers map[string]struct {
   197  	Requests struct {
   198  		Name int64 `json:"name"`
   199  		Srv  int64 `json:"srv"`
   200  		Addr int64 `json:"addr"`
   201  	} `json:"requests"`
   202  	Responses struct {
   203  		NoError  int64 `json:"noerror"`
   204  		Formerr  int64 `json:"formerr"`
   205  		Servfail int64 `json:"servfail"`
   206  		Nxdomain int64 `json:"nxdomain"`
   207  		Notimp   int64 `json:"notimp"`
   208  		Refused  int64 `json:"refused"`
   209  		TimedOut int64 `json:"timedout"`
   210  		Unknown  int64 `json:"unknown"`
   211  	} `json:"responses"`
   212  }