diff --git a/.golangci.yml b/.golangci.yml index 636463c..716cd56 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,4 +2,4 @@ linters: enable: - staticcheck - disable-all: true \ No newline at end of file + disable-all: true diff --git a/.promu.yml b/.promu.yml index 421d2da..0ca7976 100644 --- a/.promu.yml +++ b/.promu.yml @@ -6,13 +6,15 @@ repository: path: github.com/MicroOps-cn/data_exporter build: flags: -a -tags netgo + # yamllint disable rule:line-length ldflags: | -X github.com/prometheus/common/version.Version={{.Version}} -X github.com/prometheus/common/version.Revision={{.Revision}} -X github.com/prometheus/common/version.Branch={{.Branch}} -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} + # yamllint enable tarball: files: - examples - - LICENSE \ No newline at end of file + - LICENSE diff --git a/examples/data_exporter.yaml b/examples/data_exporter.yaml index dc41811..0227457 100644 --- a/examples/data_exporter.yaml +++ b/examples/data_exporter.yaml @@ -1,6 +1,6 @@ collects: - name: "test-http" - relabel_configs: [ ] + relabel_configs: [] data_format: "json" datasource: - type: "http" @@ -10,12 +10,12 @@ collects: relabel_configs: - target_label: __namespace__ replacement: "node_server" - - source_labels: [ __name__ ] + - source_labels: [__name__] target_label: name regex: "([^.]+)\\.metrics\\..+" replacement: "$1" action: replace - - source_labels: [ __name__ ] + - source_labels: [__name__] target_label: __name__ regex: "[^.]+\\.metrics\\.(.+)" replacement: "$1" @@ -74,7 +74,7 @@ collects: relabel_configs: - target_label: __namespace__ replacement: "node_server" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: "#([^/]+).*" datasource: @@ -83,10 +83,10 @@ collects: metrics: - name: "server cpu" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: __value__ regex: "(?s:.*cpu=([0-9]+).*)" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: "(?s:\\[(.+?)].*)" - target_label: __name__ @@ -97,10 +97,10 @@ collects: __raw__: "(?s:.*)" - name: "server memory" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: __value__ regex: "(?s:.*memory=([0-9]+).*)" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: "(?s:\\[(.+?)].*)" - target_label: __name__ @@ -111,13 +111,13 @@ collects: __raw__: "(?s:.*)" - name: "server info" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: hostname regex: "(?s:.*hostname=(.+?)\n.*)" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: ip regex: "(?s:.*ip=([0-9.]+).*)" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: "(?s:\\[(.+?)].*)" - target_label: __value__ @@ -133,7 +133,7 @@ collects: relabel_configs: - target_label: __namespace__ replacement: "node_server" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: "#([^/]+).*" datasource: @@ -142,10 +142,10 @@ collects: metrics: - name: "server cpu" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: __value__ regex: ".*cpu=(.+?)[!/].*" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: ".*@\\[(.+?)].*" - target_label: __name__ @@ -156,10 +156,10 @@ collects: __raw__: ".*" - name: "server memory" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: __value__ regex: ".*memory=(.+?)[!/].*" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: ".*@\\[(.+?)].*" - target_label: __name__ @@ -170,13 +170,13 @@ collects: __raw__: ".*" - name: "server info" relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: hostname regex: ".*hostname=(.+?)[!/].*" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: ip regex: ".*ip=(.+?)[!/].*" - - source_labels: [ __raw__ ] + - source_labels: [__raw__] target_label: name regex: ".*@\\[(.+?)].*" - target_label: __value__ @@ -186,4 +186,4 @@ collects: match: datapoint: "@.*!" labels: - __raw__: ".*" \ No newline at end of file + __raw__: ".*" diff --git a/examples/regex.yaml b/examples/regex.yaml index 9cafb79..33ebcc1 100644 --- a/examples/regex.yaml +++ b/examples/regex.yaml @@ -17,7 +17,7 @@ collects: - target_label: __value__ replacement: "1" match: - datapoint: '@\[(?P[^[]+)]/time=(?P<__time__>[-\d :]+)/.+/ip=(?P[\d.]+)/hostname=(?P.+?)!' + datapoint: '@\[(?P[^[]+)]/time=(?P<__time__>[-\d :]+)/.+/ip=(?P[\d.]+)/hostname=(?P.+?)!' # yamllint disable-line metric_type: gauge - name: regex - memory relabel_configs: @@ -30,10 +30,10 @@ collects: metric_type: gauge - name: regex - cpu relabel_configs: - - source_labels: [ __raw__ ] + - source_labels: [__raw__] regex: .*cpu=(\d+).* target_label: __value__ - - source_labels: [ __raw__ ] + - source_labels: [__raw__] regex: .*@\[(.+?)].* target_label: name - target_label: __name__