master
go 53 lines 1.57 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package nginxvts
4
5 // NginxVTS metrics: https://github.com/vozlt/nginx-module-vts#json
6
7 type vtsMetrics struct {
8 // HostName string
9 // NginxVersion string
10 LoadMsec int64
11 NowMsec int64
12 Uptime int64
13 Connections struct {
14 Active int64 `stm:"active"`
15 Reading int64 `stm:"reading"`
16 Writing int64 `stm:"writing"`
17 Waiting int64 `stm:"waiting"`
18 Accepted int64 `stm:"accepted"`
19 Handled int64 `stm:"handled"`
20 Requests int64 `stm:"requests"`
21 } `stm:"connections"`
22 SharedZones struct {
23 // Name string
24 MaxSize int64 `stm:"maxsize"`
25 UsedSize int64 `stm:"usedsize"`
26 UsedNode int64 `stm:"usednode"`
27 }
28 ServerZones map[string]Server
29 }
30
31 func (m vtsMetrics) hasServerZones() bool { return m.ServerZones != nil }
32
33 // Server is for total Nginx server
34 type Server struct {
35 RequestCounter int64 `stm:"requestcounter"`
36 InBytes int64 `stm:"inbytes"`
37 OutBytes int64 `stm:"outbytes"`
38 Responses struct {
39 Resp1xx int64 `stm:"responses_1xx" json:"1xx"`
40 Resp2xx int64 `stm:"responses_2xx" json:"2xx"`
41 Resp3xx int64 `stm:"responses_3xx" json:"3xx"`
42 Resp4xx int64 `stm:"responses_4xx" json:"4xx"`
43 Resp5xx int64 `stm:"responses_5xx" json:"5xx"`
44 Miss int64 `stm:"cache_miss"`
45 Bypass int64 `stm:"cache_bypass"`
46 Expired int64 `stm:"cache_expired"`
47 Stale int64 `stm:"cache_stale"`
48 Updating int64 `stm:"cache_updating"`
49 Revalidated int64 `stm:"cache_revalidated"`
50 Hit int64 `stm:"cache_hit"`
51 Scarce int64 `stm:"cache_scarce"`
52 } `stm:""`
53 }