@cryptotaxi247 / netdata-1 / commits / 8f37ab05c

go.d phpfpm add config schema (#17872)

Ilya Mashchenko committed Jun 13, 2024 at 15:09 UTC 8f37ab05ccaaf51fa890c895948435567d4988e9
2 files changed +158 -49
src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json
+154 -43
@@ -1,46 +1,87 @@
1 {
2 "jsonSchema": {
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 - "title": "go.d/phpfpm job configuration schema.",
4 + "title": "PHP-FPM collector configuration.",
5 "type": "object",
6 "properties": {
7 - "name": {
8 - "type": "string"
7 + "update_every": {
8 + "title": "Update every",
9 + "description": "Data collection interval, measured in seconds.",
10 + "type": "integer",
11 + "minimum": 1,
12 + "default": 1
13 },
10 - "url": {
11 - "type": "string"
14 + "timeout": {
15 + "title": "Timeout",
16 + "description": "The timeout in seconds for requests.",
17 + "type": "number",
18 + "minimum": 0.5,
19 + "default": 1
20 },
13 - "socket": {
14 - "type": "string"
21 + "url": {
22 + "title": "URL",
23 + "description": "The URL of the PHP-FPM [status page](https://www.php.net/manual/en/fpm.status.php).",
24 + "type": "string",
25 + "default": "http://127.0.0.1/status?full&json",
26 + "format": "uri"
27 },
28 "address": {
17 - "type": "string"
29 + "title": "Address",
30 + "description": "The PHP-FPM daemon's TCP listening address. This will be preferred over the **URL** if set.",
31 + "type": "string",
32 + "default": ""
33 + },
34 + "socket": {
35 + "title": "Socket",
36 + "description": "The PHP-FPM daemon's Unix socket. This will be preferred over both the **URL** and **Address** if set.",
37 + "type": "string",
38 + "default": "",
39 + "pattern": "^$|^/"
40 },
41 "fcgi_path": {
20 - "type": "string"
42 + "title": "FCGI status path",
43 + "description": "The URI to view the [FPM status page](https://www.php.net/manual/en/fpm.status.php).",
44 + "type": "string",
45 + "default": "/status",
46 + "pattern": "^$|^/"
47 },
22 - "timeout": {
23 - "type": [
24 - "string",
25 - "integer"
26 - ]
48 + "not_follow_redirects": {
49 + "title": "Not follow redirects",
50 + "description": "If set, the client will not follow HTTP redirects automatically.",
51 + "type": "boolean"
52 },
53 "username": {
29 - "type": "string"
54 + "title": "Username",
55 + "description": "The username for basic authentication.",
56 + "type": "string",
57 + "sensitive": true
58 },
59 "password": {
32 - "type": "string"
60 + "title": "Password",
61 + "description": "The password for basic authentication.",
62 + "type": "string",
63 + "sensitive": true
64 },
65 "proxy_url": {
66 + "title": "Proxy URL",
67 + "description": "The URL of the proxy server.",
68 "type": "string"
69 },
70 "proxy_username": {
38 - "type": "string"
71 + "title": "Proxy username",
72 + "description": "The username for proxy authentication.",
73 + "type": "string",
74 + "sensitive": true
75 },
76 "proxy_password": {
41 - "type": "string"
77 + "title": "Proxy password",
78 + "description": "The password for proxy authentication.",
79 + "type": "string",
80 + "sensitive": true
81 },
82 "headers": {
83 + "title": "Headers",
84 + "description": "Additional HTTP headers to include in the request.",
85 "type": [
86 "object",
87 "null"
@@ -49,46 +90,116 @@
90 "type": "string"
91 }
92 },
52 - "not_follow_redirects": {
93 + "tls_skip_verify": {
94 + "title": "Skip TLS verification",
95 + "description": "If set, TLS certificate verification will be skipped.",
96 "type": "boolean"
97 },
98 "tls_ca": {
56 - "type": "string"
99 + "title": "TLS CA",
100 + "description": "The path to the CA certificate file for TLS verification.",
101 + "type": "string",
102 + "pattern": "^$|^/"
103 },
104 "tls_cert": {
59 - "type": "string"
105 + "title": "TLS certificate",
106 + "description": "The path to the client certificate file for TLS authentication.",
107 + "type": "string",
108 + "pattern": "^$|^/"
109 },
110 "tls_key": {
111 + "title": "TLS key",
112 + "description": "The path to the client key file for TLS authentication.",
113 + "type": "string",
114 + "pattern": "^$|^/"
115 + },
116 + "body": {
117 + "title": "Body",
118 "type": "string"
119 },
64 - "insecure_skip_verify": {
65 - "type": "boolean"
120 + "method": {
121 + "title": "Method",
122 + "type": "string"
123 }
124 },
68 - "oneOf": [
69 - {
70 - "required": [
71 - "name",
72 - "url"
73 - ]
74 - },
75 - {
76 - "required": [
77 - "name",
78 - "socket"
79 - ]
80 - },
81 - {
82 - "required": [
83 - "name",
84 - "address"
85 - ]
86 - }
87 - ]
125 + "additionalProperties": false,
126 + "patternProperties": {
127 + "^name$": {}
128 + }
129 },
130 "uiSchema": {
131 "uiOptions": {
132 "fullPage": true
133 + },
134 + "address": {
135 + "ui:placeholder": "127.0.0.1:9000"
136 + },
137 + "socket": {
138 + "ui:placeholder": "/tmp/php-fpm.sock"
139 + },
140 + "fcgi_path": {
141 + "ui:widget": "hidden"
142 + },
143 + "body": {
144 + "ui:widget": "hidden"
145 + },
146 + "method": {
147 + "ui:widget": "hidden"
148 + },
149 + "timeout": {
150 + "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)."
151 + },
152 + "password": {
153 + "ui:widget": "password"
154 + },
155 + "proxy_password": {
156 + "ui:widget": "password"
157 + },
158 + "ui:flavour": "tabs",
159 + "ui:options": {
160 + "tabs": [
161 + {
162 + "title": "Base",
163 + "fields": [
164 + "update_every",
165 + "timeout",
166 + "url",
167 + "address",
168 + "socket",
169 + "not_follow_redirects"
170 + ]
171 + },
172 + {
173 + "title": "Auth",
174 + "fields": [
175 + "username",
176 + "password"
177 + ]
178 + },
179 + {
180 + "title": "TLS",
181 + "fields": [
182 + "tls_skip_verify",
183 + "tls_ca",
184 + "tls_cert",
185 + "tls_key"
186 + ]
187 + },
188 + {
189 + "title": "Proxy",
190 + "fields": [
191 + "proxy_url",
192 + "proxy_username",
193 + "proxy_password"
194 + ]
195 + },
196 + {
197 + "title": "Headers",
198 + "fields": [
199 + "headers"
200 + ]
201 + }
202 + ]
203 }
204 }
205 }
src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go
+4 -6
@@ -11,9 +11,7 @@ import (
11 "github.com/netdata/netdata/go/go.d.plugin/pkg/web"
12 )
13
14 -////go:embed "config_schema.json"
15 -//var configSchema string
16 -
14 +//go:embed "config_schema.json"
15 var configSchema string
16
17 func init() {
@@ -43,9 +41,9 @@ func New() *Phpfpm {
41 type Config struct {
42 UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
43 web.HTTP `yaml:",inline" json:""`
46 - Socket string `yaml:"socket" json:"socket"`
47 - Address string `yaml:"address" json:"address"`
48 - FcgiPath string `yaml:"fcgi_path" json:"fcgi_path"`
44 + Socket string `yaml:"socket,omitempty" json:"socket"`
45 + Address string `yaml:"address,omitempty" json:"address"`
46 + FcgiPath string `yaml:"fcgi_path,omitempty" json:"fcgi_path"`
47 }
48
49 type Phpfpm struct {