-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[summerospp]add fluentbit nginx plugin
Signed-off-by: “sjliu1” <“[email protected]”>
- Loading branch information
“sjliu1”
committed
Sep 14, 2023
1 parent
3f2904e
commit d22b5a1
Showing
12 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. <br /> | ||
// **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 | ||
} |
25 changes: 25 additions & 0 deletions
25
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.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Nginx | ||
|
||
NGINX Exporter Metrics input plugin scrapes metrics from the NGINX stub status handler. <br /> **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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters