diff --git a/apis/fluentbit/v1alpha2/clusterinput_types.go b/apis/fluentbit/v1alpha2/clusterinput_types.go index 828aec59e..b46c64add 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types.go @@ -65,6 +65,8 @@ type InputSpec struct { Collectd *input.Collectd `json:"collectd,omitempty"` // StatsD defines the StatsD input plugin configuration StatsD *input.StatsD `json:"statsd,omitempty"` + // Nginx defines the Nginx input plugin configuration + Nginx *input.Nginx `json:"nginx,omitempty"` } // +kubebuilder:object:root=true diff --git a/apis/fluentbit/v1alpha2/plugins/input/nginx.go b/apis/fluentbit/v1alpha2/plugins/input/nginx.go new file mode 100644 index 000000000..4d607653e --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/nginx.go @@ -0,0 +1,47 @@ +package input + +import ( + "fmt" + + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params" +) + +// +kubebuilder:object:generate:=true + +// NGINX Exporter Metrics input plugin scrapes metrics from the NGINX stub status handler.
+// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/nginx** +type Nginx struct { + // Name of the target host or IP address to check, default: localhost + Host string `json:"host,omitempty"` + // Port of the target nginx service to connect to, default: 80 + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=65535 + Port *int32 `json:"port,omitempty"` + // The URL of the Stub Status Handler,default: /status + StatusURL string `json:"statusURL,omitempty"` + // Turn on NGINX plus mode,default: true + NginxPlus *bool `json:"nginxPlus,omitempty"` +} + +func (_ *Nginx) Name() string { + return "nginx_metrics" +} + +// implement Section() method +func (n *Nginx) Params(_ plugins.SecretLoader) (*params.KVs, error) { + kvs := params.NewKVs() + if n.Host != "" { + kvs.Insert("Host", n.Host) + } + if n.Port != nil { + kvs.Insert("Port", fmt.Sprint(*n.Port)) + } + if n.StatusURL != "" { + kvs.Insert("Status_URL", n.StatusURL) + } + if n.NginxPlus != nil { + kvs.Insert("Nginx_Plus", fmt.Sprint(*n.NginxPlus)) + } + return kvs, nil +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go index 025cb85c2..f44227c8f 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -160,6 +160,31 @@ func (in *MQTT) DeepCopy() *MQTT { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Nginx) DeepCopyInto(out *Nginx) { + *out = *in + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.NginxPlus != nil { + in, out := &in.NginxPlus, &out.NginxPlus + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Nginx. +func (in *Nginx) DeepCopy() *Nginx { + if in == nil { + return nil + } + out := new(Nginx) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeExporterMetrics) DeepCopyInto(out *NodeExporterMetrics) { *out = *in diff --git a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go index acd4b1076..e98f814ef 100644 --- a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go @@ -1103,6 +1103,11 @@ func (in *InputSpec) DeepCopyInto(out *InputSpec) { *out = new(input.StatsD) (*in).DeepCopyInto(*out) } + if in.Nginx != nil { + in, out := &in.Nginx, &out.Nginx + *out = new(input.Nginx) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputSpec. diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml index 5dacbda62..307e47687 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml @@ -266,6 +266,27 @@ spec: minimum: 1 type: integer type: object + nginx: + description: Nginx defines the Nginx input plugin configuration + properties: + host: + description: 'Name of the target host or IP address to check, + default: localhost' + type: string + nginxPlus: + description: 'Turn on NGINX plus mode,default: true' + type: boolean + port: + description: 'Port of the target nginx service to connect to, + default: 80' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + statusURL: + description: 'The URL of the Stub Status Handler,default: /status' + type: string + type: object nodeExporterMetrics: description: NodeExporterMetrics defines Node Exporter Metrics Input configuration. diff --git a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml index 5dacbda62..307e47687 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml @@ -266,6 +266,27 @@ spec: minimum: 1 type: integer type: object + nginx: + description: Nginx defines the Nginx input plugin configuration + properties: + host: + description: 'Name of the target host or IP address to check, + default: localhost' + type: string + nginxPlus: + description: 'Turn on NGINX plus mode,default: true' + type: boolean + port: + description: 'Port of the target nginx service to connect to, + default: 80' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + statusURL: + description: 'The URL of the Stub Status Handler,default: /status' + type: string + type: object nodeExporterMetrics: description: NodeExporterMetrics defines Node Exporter Metrics Input configuration. diff --git a/docs/fluentbit.md b/docs/fluentbit.md index 7bfea9917..3b86bfbbb 100644 --- a/docs/fluentbit.md +++ b/docs/fluentbit.md @@ -384,6 +384,7 @@ FluentBitSpec defines the desired state of FluentBit | priorityClassName | PriorityClassName represents the pod's priority class. | string | | volumes | List of volumes that can be mounted by containers belonging to the pod. | []corev1.Volume | | volumesMounts | Pod volumes to mount into the container's filesystem. | []corev1.VolumeMount | +| disableLogVolumes | DisableLogVolumes removes the hostPath mounts for varlibcontainers, varlogs and systemd. | bool | | annotations | Annotations to add to each Fluentbit pod. | map[string]string | | serviceAccountAnnotations | Annotations to add to the Fluentbit service account | map[string]string | | labels | Labels to add to each FluentBit pod | map[string]string | @@ -400,7 +401,6 @@ FluentBitSpec defines the desired state of FluentBit | metricsPort | MetricsPort is the port used by the metrics server. If this option is set, HttpPort from ClusterFluentBitConfig needs to match this value. Default is 2020. | int32 | | service | Service represents configurations on the fluent-bit service. | FluentBitService | | schedulerName | SchedulerName represents the desired scheduler for fluent-bit pods. | string | -| disableLogVolumes | DisableLogVolumes removes the hostPath mounts for varlibcontainers, varlogs and systemd. | bool | [Back to TOC](#table-of-contents) # InputSpec @@ -425,6 +425,7 @@ InputSpec defines the desired state of ClusterInput | mqtt | MQTT defines the MQTT input plugin configuration | *[input.MQTT](plugins/input/mqtt.md) | | collectd | Collectd defines the Collectd input plugin configuration | *[input.Collectd](plugins/input/collectd.md) | | statsd | StatsD defines the StatsD input plugin configuration | *[input.StatsD](plugins/input/statsd.md) | +| nginx | Nginx defines the Nginx input plugin configuration | *[input.Nginx](plugins/input/nginx.md) | [Back to TOC](#table-of-contents) # NamespacedFluentBitCfgSpec diff --git a/docs/plugins/fluentbit/input/nginx.md b/docs/plugins/fluentbit/input/nginx.md new file mode 100644 index 000000000..686245ed2 --- /dev/null +++ b/docs/plugins/fluentbit/input/nginx.md @@ -0,0 +1,11 @@ +# Nginx + +NGINX Exporter Metrics input plugin scrapes metrics from the NGINX stub status handler.
**For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/nginx** + + +| Field | Description | Scheme | +| ----- | ----------- | ------ | +| host | Name of the target host or IP address to check, default: localhost | string | +| port | Port of the target nginx service to connect to, default: 80 | *int32 | +| statusURL | The URL of the Stub Status Handler,default: /status | string | +| nginxPlus | Turn on NGINX plus mode,default: true | *bool | diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 17a82a846..69a2f3bee 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -2015,6 +2015,27 @@ spec: minimum: 1 type: integer type: object + nginx: + description: Nginx defines the Nginx input plugin configuration + properties: + host: + description: 'Name of the target host or IP address to check, + default: localhost' + type: string + nginxPlus: + description: 'Turn on NGINX plus mode,default: true' + type: boolean + port: + description: 'Port of the target nginx service to connect to, + default: 80' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + statusURL: + description: 'The URL of the Stub Status Handler,default: /status' + type: string + type: object nodeExporterMetrics: description: NodeExporterMetrics defines Node Exporter Metrics Input configuration. diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 52f9f7a40..4a08c1171 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -2015,6 +2015,27 @@ spec: minimum: 1 type: integer type: object + nginx: + description: Nginx defines the Nginx input plugin configuration + properties: + host: + description: 'Name of the target host or IP address to check, + default: localhost' + type: string + nginxPlus: + description: 'Turn on NGINX plus mode,default: true' + type: boolean + port: + description: 'Port of the target nginx service to connect to, + default: 80' + format: int32 + maximum: 65535 + minimum: 1 + type: integer + statusURL: + description: 'The URL of the Stub Status Handler,default: /status' + type: string + type: object nodeExporterMetrics: description: NodeExporterMetrics defines Node Exporter Metrics Input configuration.