Skip to content

Commit

Permalink
Merge pull request #914 from sjliu1/collectd
Browse files Browse the repository at this point in the history
[summerospp]add fluentbit collectd  plugin
  • Loading branch information
benjaminhuo authored Sep 13, 2023
2 parents fdbf8e1 + b0586a9 commit 0481522
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apis/fluentbit/v1alpha2/clusterinput_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type InputSpec struct {
HTTP *input.HTTP `json:"http,omitempty"`
// MQTT defines the MQTT input plugin configuration
MQTT *input.MQTT `json:"mqtt,omitempty"`
// Collectd defines the Collectd input plugin configuration
Collectd *input.Collectd `json:"collectd,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
42 changes: 42 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/input/collectd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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

// The Collectd input plugin allows you to receive datagrams from collectd service. <br />
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/collectd**
type Collectd struct {
// Set the address to listen to, default: 0.0.0.0
Listen string `json:"listen,omitempty"`
// Set the port to listen to, default: 25826
// +kubebuilder:validation:Minimum:=1
// +kubebuilder:validation:Maximum:=65535
Port *int32 `json:"port,omitempty"`
// Set the data specification file,default: /usr/share/collectd/types.db
TypesDB string `json:"typesDB,omitempty"`
}

func (_ *Collectd) Name() string {
return "collectd"
}

// implement Section() method
func (c *Collectd) Params(_ plugins.SecretLoader) (*params.KVs, error) {
kvs := params.NewKVs()
if c.Listen != "" {
kvs.Insert("Listen", c.Listen)
}
if c.Port != nil {
kvs.Insert("Port", fmt.Sprint(*c.Port))
}
if c.TypesDB != "" {
kvs.Insert("TypesDB", c.TypesDB)
}
return kvs, nil
}
20 changes: 20 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions apis/fluentbit/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ spec:
description: A user friendly alias name for this input plugin. Used
in metrics for distinction of each configured input.
type: string
collectd:
description: Collectd defines the Collectd input plugin configuration
properties:
listen:
description: 'Set the address to listen to, default: 0.0.0.0'
type: string
port:
description: 'Set the port to listen to, default: 25826'
format: int32
maximum: 65535
minimum: 1
type: integer
typesDB:
description: 'Set the data specification file,default: /usr/share/collectd/types.db'
type: string
type: object
customPlugin:
description: CustomPlugin defines Custom Input configuration.
properties:
Expand Down
16 changes: 16 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ spec:
description: A user friendly alias name for this input plugin. Used
in metrics for distinction of each configured input.
type: string
collectd:
description: Collectd defines the Collectd input plugin configuration
properties:
listen:
description: 'Set the address to listen to, default: 0.0.0.0'
type: string
port:
description: 'Set the port to listen to, default: 25826'
format: int32
maximum: 65535
minimum: 1
type: integer
typesDB:
description: 'Set the data specification file,default: /usr/share/collectd/types.db'
type: string
type: object
customPlugin:
description: CustomPlugin defines Custom Input configuration.
properties:
Expand Down
1 change: 1 addition & 0 deletions docs/fluentbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ InputSpec defines the desired state of ClusterInput
| openTelemetry | OpenTelemetry defines the OpenTelemetry input plugin configuration | *[input.OpenTelemetry](plugins/input/opentelemetry.md) |
| http | HTTP defines the HTTP input plugin configuration | *[input.HTTP](plugins/input/http.md) |
| 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) |

[Back to TOC](#table-of-contents)
# NamespacedFluentBitCfgSpec
Expand Down
10 changes: 10 additions & 0 deletions docs/plugins/fluentbit/input/collectd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Collectd

The Collectd input plugin allows you to receive datagrams from collectd service. <br /> **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/collectd**


| Field | Description | Scheme |
| ----- | ----------- | ------ |
| listen | Set the address to listen to, default: 0.0.0.0 | string |
| port | Set the port to listen to, default: 25826 | *int32 |
| typesDB | Set the data specification file,default: /usr/share/collectd/types.db | string |
16 changes: 16 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,22 @@ spec:
description: A user friendly alias name for this input plugin. Used
in metrics for distinction of each configured input.
type: string
collectd:
description: Collectd defines the Collectd input plugin configuration
properties:
listen:
description: 'Set the address to listen to, default: 0.0.0.0'
type: string
port:
description: 'Set the port to listen to, default: 25826'
format: int32
maximum: 65535
minimum: 1
type: integer
typesDB:
description: 'Set the data specification file,default: /usr/share/collectd/types.db'
type: string
type: object
customPlugin:
description: CustomPlugin defines Custom Input configuration.
properties:
Expand Down
16 changes: 16 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,22 @@ spec:
description: A user friendly alias name for this input plugin. Used
in metrics for distinction of each configured input.
type: string
collectd:
description: Collectd defines the Collectd input plugin configuration
properties:
listen:
description: 'Set the address to listen to, default: 0.0.0.0'
type: string
port:
description: 'Set the port to listen to, default: 25826'
format: int32
maximum: 65535
minimum: 1
type: integer
typesDB:
description: 'Set the data specification file,default: /usr/share/collectd/types.db'
type: string
type: object
customPlugin:
description: CustomPlugin defines Custom Input configuration.
properties:
Expand Down

0 comments on commit 0481522

Please sign in to comment.