summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2024-06-13 15:09:52 +0300
committerGitHub <noreply@github.com>2024-06-13 15:09:52 +0300
commit8f37ab05ccaaf51fa890c895948435567d4988e9 (patch)
treef39413ef0763fd0099e78b5e036676c6d02448eb /src
parentb3e206c271b37238d5d91d350e7f118efc5d42a2 (diff)
go.d phpfpm add config schema (#17872)
Diffstat (limited to 'src')
-rw-r--r--src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json197
-rw-r--r--src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go10
2 files changed, 158 insertions, 49 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json b/src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json
index 23928430f4..252d8a0834 100644
--- a/src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json
+++ b/src/go/collectors/go.d.plugin/modules/phpfpm/config_schema.json
@@ -1,46 +1,87 @@
{
"jsonSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
- "title": "go.d/phpfpm job configuration schema.",
+ "title": "PHP-FPM collector configuration.",
"type": "object",
"properties": {
- "name": {
- "type": "string"
+ "update_every": {
+ "title": "Update every",
+ "description": "Data collection interval, measured in seconds.",
+ "type": "integer",
+ "minimum": 1,
+ "default": 1
},
- "url": {
- "type": "string"
+ "timeout": {
+ "title": "Timeout",
+ "description": "The timeout in seconds for requests.",
+ "type": "number",
+ "minimum": 0.5,
+ "default": 1
},
- "socket": {
- "type": "string"
+ "url": {
+ "title": "URL",
+ "description": "The URL of the PHP-FPM [status page](https://www.php.net/manual/en/fpm.status.php).",
+ "type": "string",
+ "default": "http://127.0.0.1/status?full&json",
+ "format": "uri"
},
"address": {
- "type": "string"
+ "title": "Address",
+ "description": "The PHP-FPM daemon's TCP listening address. This will be preferred over the **URL** if set.",
+ "type": "string",
+ "default": ""
+ },
+ "socket": {
+ "title": "Socket",
+ "description": "The PHP-FPM daemon's Unix socket. This will be preferred over both the **URL** and **Address** if set.",
+ "type": "string",
+ "default": "",
+ "pattern": "^$|^/"
},
"fcgi_path": {
- "type": "string"
+ "title": "FCGI status path",
+ "description": "The URI to view the [FPM status page](https://www.php.net/manual/en/fpm.status.php).",
+ "type": "string",
+ "default": "/status",
+ "pattern": "^$|^/"
},
- "timeout": {
- "type": [
- "string",
- "integer"
- ]
+ "not_follow_redirects": {
+ "title": "Not follow redirects",
+ "description": "If set, the client will not follow HTTP redirects automatically.",
+ "type": "boolean"
},
"username": {
- "type": "string"
+ "title": "Username",
+ "description": "The username for basic authentication.",
+ "type": "string",
+ "sensitive": true
},
"password": {
- "type": "string"
+ "title": "Password",
+ "description": "The password for basic authentication.",
+ "type": "string",
+ "sensitive": true
},
"proxy_url": {
+ "title": "Proxy URL",
+ "description": "The URL of the proxy server.",
"type": "string"
},
"proxy_username": {
- "type": "string"
+ "title": "Proxy username",
+ "description": "The username for proxy authentication.",
+ "type": "string",
+ "sensitive": true
},
"proxy_password": {
- "type": "string"
+ "title": "Proxy password",
+ "description": "The password for proxy authentication.",
+ "type": "string",
+ "sensitive": true
},
"headers": {
+ "title": "Headers",
+ "description": "Additional HTTP headers to include in the request.",
"type": [
"object",
"null"
@@ -49,46 +90,116 @@
"type": "string"
}
},
- "not_follow_redirects": {
+ "tls_skip_verify": {
+ "title": "Skip TLS verification",
+ "description": "If set, TLS certificate verification will be skipped.",
"type": "boolean"
},
"tls_ca": {
- "type": "string"
+ "title": "TLS CA",
+ "description": "The path to the CA certificate file for TLS verification.",
+ "type": "string",
+ "pattern": "^$|^/"
},
"tls_cert": {
- "type": "string"
+ "title": "TLS certificate",
+ "description": "The path to the client certificate file for TLS authentication.",
+ "type": "string",
+ "pattern": "^$|^/"
},
"tls_key": {
+ "title": "TLS key",
+ "description": "The path to the client key file for TLS authentication.",
+ "type": "string",
+ "pattern": "^$|^/"
+ },
+ "body": {
+ "title": "Body",
"type": "string"
},
- "insecure_skip_verify": {
- "type": "boolean"
+ "method": {
+ "title": "Method",
+ "type": "string"
}
},
- "oneOf": [
- {
- "required": [
- "name",
- "url"
- ]
- },
- {
- "required": [
- "name",
- "socket"
- ]
- },
- {
- "required": [
- "name",
- "address"
- ]
- }
- ]
+ "additionalProperties": false,
+ "patternProperties": {
+ "^name$": {}
+ }
},
"uiSchema": {
"uiOptions": {
"fullPage": true
+ },
+ "address": {
+ "ui:placeholder": "127.0.0.1:9000"
+ },
+ "socket": {
+ "ui:placeholder": "/tmp/php-fpm.sock"
+ },
+ "fcgi_path": {
+ "ui:widget": "hidden"
+ },
+ "body": {
+ "ui:widget": "hidden"
+ },
+ "method": {
+ "ui:widget": "hidden"
+ },
+ "timeout": {
+ "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)."
+ },
+ "password": {
+ "ui:widget": "password"
+ },
+ "proxy_password": {
+ "ui:widget": "password"
+ },
+ "ui:flavour": "tabs",
+ "ui:options": {
+ "tabs": [
+ {
+ "title": "Base",
+ "fields": [
+ "update_every",
+ "timeout",
+ "url",
+ "address",
+ "socket",
+ "not_follow_redirects"
+ ]
+ },
+ {
+ "title": "Auth",
+ "fields": [
+ "username",
+ "password"
+ ]
+ },
+ {
+ "title": "TLS",
+ "fields": [
+ "tls_skip_verify",
+ "tls_ca",
+ "tls_cert",
+ "tls_key"
+ ]
+ },
+ {
+ "title": "Proxy",
+ "fields": [
+ "proxy_url",
+ "proxy_username",
+ "proxy_password"
+ ]
+ },
+ {
+ "title": "Headers",
+ "fields": [
+ "headers"
+ ]
+ }
+ ]
}
}
}
diff --git a/src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go b/src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go
index 10273a9855..bff4d06c1d 100644
--- a/src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go
+++ b/src/go/collectors/go.d.plugin/modules/phpfpm/phpfpm.go
@@ -11,9 +11,7 @@ import (
"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
)
-////go:embed "config_schema.json"
-//var configSchema string
-
+//go:embed "config_schema.json"
var configSchema string
func init() {
@@ -43,9 +41,9 @@ func New() *Phpfpm {
type Config struct {
UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
web.HTTP `yaml:",inline" json:""`
- Socket string `yaml:"socket" json:"socket"`
- Address string `yaml:"address" json:"address"`
- FcgiPath string `yaml:"fcgi_path" json:"fcgi_path"`
+ Socket string `yaml:"socket,omitempty" json:"socket"`
+ Address string `yaml:"address,omitempty" json:"address"`
+ FcgiPath string `yaml:"fcgi_path,omitempty" json:"fcgi_path"`
}
type Phpfpm struct {