Fix mtime reporting in textfile collector, add tests.
This commit is contained in:
parent
704e8f76d8
commit
e13f910427
9 changed files with 186 additions and 11 deletions
8
collector/fixtures/textfile/no_metric_files.out
Normal file
8
collector/fixtures/textfile/no_metric_files.out
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
name: "node_textfile_scrape_error"
|
||||
help: "1 if there was an error opening or reading a file, 0 otherwise"
|
||||
type: GAUGE
|
||||
metric: <
|
||||
gauge: <
|
||||
value: 0
|
||||
>
|
||||
>
|
||||
|
|
@ -0,0 +1 @@
|
|||
This file should be ignored.
|
||||
8
collector/fixtures/textfile/nonexistent_path.out
Normal file
8
collector/fixtures/textfile/nonexistent_path.out
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
name: "node_textfile_scrape_error"
|
||||
help: "1 if there was an error opening or reading a file, 0 otherwise"
|
||||
type: GAUGE
|
||||
metric: <
|
||||
gauge: <
|
||||
value: 1
|
||||
>
|
||||
>
|
||||
79
collector/fixtures/textfile/two_metric_files.out
Normal file
79
collector/fixtures/textfile/two_metric_files.out
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
name: "node_textfile_mtime"
|
||||
help: "Unixtime mtime of textfiles successfully read."
|
||||
type: GAUGE
|
||||
metric: <
|
||||
label: <
|
||||
name: "file"
|
||||
value: "metrics1.prom"
|
||||
>
|
||||
gauge: <
|
||||
value: 1
|
||||
>
|
||||
>
|
||||
metric: <
|
||||
label: <
|
||||
name: "file"
|
||||
value: "metrics2.prom"
|
||||
>
|
||||
gauge: <
|
||||
value: 2
|
||||
>
|
||||
>
|
||||
name: "node_textfile_scrape_error"
|
||||
help: "1 if there was an error opening or reading a file, 0 otherwise"
|
||||
type: GAUGE
|
||||
metric: <
|
||||
gauge: <
|
||||
value: 0
|
||||
>
|
||||
>
|
||||
name: "testmetric1_1"
|
||||
help: "Metric read from fixtures/textfile/two_metric_files/metrics1.prom"
|
||||
type: UNTYPED
|
||||
metric: <
|
||||
label: <
|
||||
name: "foo"
|
||||
value: "bar"
|
||||
>
|
||||
untyped: <
|
||||
value: 10
|
||||
>
|
||||
>
|
||||
name: "testmetric1_2"
|
||||
help: "Metric read from fixtures/textfile/two_metric_files/metrics1.prom"
|
||||
type: UNTYPED
|
||||
metric: <
|
||||
label: <
|
||||
name: "foo"
|
||||
value: "baz"
|
||||
>
|
||||
untyped: <
|
||||
value: 20
|
||||
>
|
||||
>
|
||||
name: "testmetric2_1"
|
||||
help: "Metric read from fixtures/textfile/two_metric_files/metrics2.prom"
|
||||
type: UNTYPED
|
||||
metric: <
|
||||
label: <
|
||||
name: "foo"
|
||||
value: "bar"
|
||||
>
|
||||
untyped: <
|
||||
value: 30
|
||||
>
|
||||
timestamp_ms: 1441205977284
|
||||
>
|
||||
name: "testmetric2_2"
|
||||
help: "Metric read from fixtures/textfile/two_metric_files/metrics2.prom"
|
||||
type: UNTYPED
|
||||
metric: <
|
||||
label: <
|
||||
name: "foo"
|
||||
value: "baz"
|
||||
>
|
||||
untyped: <
|
||||
value: 40
|
||||
>
|
||||
timestamp_ms: 1441205977284
|
||||
>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
testmetric1_1{foo="bar"} 10
|
||||
testmetric1_2{foo="baz"} 20
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
testmetric2_1{foo="bar"} 30 1441205977284
|
||||
testmetric2_2{foo="baz"} 40 1441205977284
|
||||
|
|
@ -0,0 +1 @@
|
|||
This file should be ignored.
|
||||
Loading…
Add table
Add a link
Reference in a new issue