--- test case: 'Simple metric using params: wmi_os_physical_memory_free_bytes' in: data: wmi_os_physical_memory_free_bytes 8.492331008e+09 params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: 8.492331008e+09 line_raw: wmi_os_physical_memory_free_bytes 8.492331008e+09 type: untyped --- test case: 'Get metric using params: cpu_usage_system{cpu="cpu-total"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 labels: - name: cpu value: cpu-total type: gauge help: Telegraf collected metric --- test case: 'Get metric using params: wmi_logical_disk_free_bytes{volume="{#VOLUME}"}' in: data: | # HELP wmi_logical_disk_free_bytes Free space in bytes (LogicalDisk.PercentFreeSpace) # TYPE wmi_logical_disk_free_bytes gauge wmi_logical_disk_free_bytes{volume="{#VOLUME}"} 3.5180249088e+11 wmi_logical_disk_free_bytes{volume="D:"} 2.627731456e+09 wmi_logical_disk_free_bytes{volume="HarddiskVolume4"} 4.59276288e+08 params: 'wmi_logical_disk_free_bytes{volume="{#VOLUME}"}' out: result: SUCCEED metrics: - name: wmi_logical_disk_free_bytes value: 3.5180249088e+11 line_raw: 'wmi_logical_disk_free_bytes{volume="{#VOLUME}"} 3.5180249088e+11' labels: - name: volume value: '{#VOLUME}' type: gauge help: Free space in bytes (LogicalDisk.PercentFreeSpace) --- test case: 'Get metric value using params: cpu_usage_system{cpu="cpu-total",host=~".*"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total",host=~".*"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: cpu_usage_system{cpu="cpu-total",host=~".*"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total",host=~".*"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: cpu_usage_system{cpu="cpu-total"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: cpu_usage_system{cpu=~"cpu-tot.+"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu=~"cpu-tot.+"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: {__name__=~"cpu_usage_syst.+",cpu=~"cpu-tot.+"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{__name__=~"cpu_usage_syst.+",cpu=~"cpu-tot.+"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: cpu_usage_system{cpu=~".*"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu=~".*"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu0 - name: host value: host1 type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1340298507220641 line_raw: cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 labels: - name: cpu value: cpu1 - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric value using params: cpu_usage_system{cpu=~"cpu-tot.+"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu=~"cpu-tot.+"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Get metric for http_requests_total{code="400"} 3 1395066363000' in: data: | # HELP http_requests_total The total number of HTTP requests. # TYPE http_requests_total counter http_requests_total{method="post",code="200"} 1027 1395066363000 http_requests_total{method="post",code="400"} 3 1395066363000 params: http_requests_total{code="400"} out: result: SUCCEED metrics: - name: http_requests_total value: 3 line_raw: http_requests_total{method="post",code="400"} 3 1395066363000 labels: - name: method value: post - name: code value: 400 type: counter help: The total number of HTTP requests. --- test case: 'Escaping in label values' in: data: msdos_file_access_time_seconds{path="C:\\DIR\\FILE.TXT",error="Cannot find file:\n\"FILE.TXT\""} 1.458255915e9 params: msdos_file_access_time_seconds{error="Cannot find file:\n\"FILE.TXT\""} == 1.458255915e9 out: result: SUCCEED metrics: - name: msdos_file_access_time_seconds value: 1.458255915e9 line_raw: msdos_file_access_time_seconds{path="C:\\DIR\\FILE.TXT",error="Cannot find file:\n\"FILE.TXT\""} 1.458255915e9 labels: - name: path value: C:\DIR\FILE.TXT - name: error value: "Cannot find file:\n\"FILE.TXT\"" type: untyped --- test case: 'Minimalistic line' in: data: metric_without_timestamp_and_labels 12.47 params: metric_without_timestamp_and_labels out: result: SUCCEED metrics: - name: metric_without_timestamp_and_labels value: 12.47 line_raw: metric_without_timestamp_and_labels 12.47 type: untyped --- test case: 'A weird metric from before the epoch' in: data: something_weird{problem="division by zero"} +Inf -3982045 params: something_weird out: result: SUCCEED metrics: - name: something_weird value: +Inf line_raw: something_weird{problem="division by zero"} +Inf -3982045 labels: - name: problem value: division by zero type: untyped --- test case: 'A histogram, which has a pretty complex representation in the text format' in: data: | # HELP http_request_duration_seconds A histogram of the request duration. # TYPE http_request_duration_seconds histogram http_request_duration_seconds_bucket{le="0.05"} 24054 http_request_duration_seconds_bucket{le="0.1"} 33444 http_request_duration_seconds_bucket{le="0.2"} 100392 http_request_duration_seconds_bucket{le="0.5"} 129389 http_request_duration_seconds_bucket{le="1"} 133988 http_request_duration_seconds_bucket{le="+Inf"} 144320 http_request_duration_seconds_sum 53423 http_request_duration_seconds_count 144320 params: http_request_duration_seconds_bucket{le="+Inf"} out: result: SUCCEED metrics: - name: http_request_duration_seconds_bucket value: 144320 line_raw: http_request_duration_seconds_bucket{le="+Inf"} 144320 labels: - name: le value: +Inf type: untyped --- test case: 'A summary, which has a complex representation #1' in: data: | # HELP rpc_duration_seconds A summary of the RPC duration in seconds. # TYPE rpc_duration_seconds summary rpc_duration_seconds{quantile="0.01"} 3102 rpc_duration_seconds{quantile="0.05"} 3272 rpc_duration_seconds{quantile="0.5"} 4773 rpc_duration_seconds{quantile="0.9"} 9001 rpc_duration_seconds{quantile="0.99"} 76656 rpc_duration_seconds_sum 1.7560473e+07 rpc_duration_seconds_count 2693 params: rpc_duration_seconds_sum out: result: SUCCEED metrics: - name: rpc_duration_seconds_sum value: 1.7560473e+07 line_raw: rpc_duration_seconds_sum 1.7560473e+07 type: untyped --- test case: 'A summary, which has a complex representation #2' in: data: | # HELP rpc_duration_seconds A summary of the RPC duration in seconds. # TYPE rpc_duration_seconds summary rpc_duration_seconds{quantile="0.01"} 3102 rpc_duration_seconds{quantile="0.05"} 3272 rpc_duration_seconds{quantile="0.5"} 4773 rpc_duration_seconds{quantile="0.9"} 9001 rpc_duration_seconds{quantile="0.99"} 76656 rpc_duration_seconds_sum 1.7560473e+07 rpc_duration_seconds_count 2693 params: rpc_duration_seconds == 3272 out: result: SUCCEED metrics: - name: rpc_duration_seconds value: 3272 line_raw: rpc_duration_seconds{quantile="0.05"} 3272 labels: - name: quantile value: 0.05 type: summary help: A summary of the RPC duration in seconds. --- test case: 'Empty metric' in: data: "" params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Empty params' in: data: wmi_os_timezone{timezone="MSK"} 1 params: "" out: result: SUCCEED metrics: - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK"} 1 labels: - name: timezone value: MSK type: untyped --- test case: 'Empty metric and empty params' in: data: "" params: "" out: result: SUCCEED output_raw: '[]' --- test case: 'Only spaces in metric' in: data: ' ' params: wmi_os_timezone out: result: FAIL --- test case: 'Only spaces in params' in: data: wmi_os_timezone{timezone="MSK"} 1 params: ' ' out: result: SUCCEED metrics: - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK"} 1 labels: - name: timezone value: MSK type: untyped --- test case: 'Only spaces in params (multiline metric)' in: data: | rpc_duration_seconds{quantile="0.01"} 3102 rpc_duration_seconds{quantile="0.05"} 3272 rpc_duration_seconds{quantile="0.5"} 4773 rpc_duration_seconds{quantile="0.9"} 9001 rpc_duration_seconds{quantile="0.99"} 76656 rpc_duration_seconds_sum 1.7560473e+07 rpc_duration_seconds_count 2693 params: ' ' out: result: SUCCEED metrics: - name: rpc_duration_seconds value: 3102 line_raw: rpc_duration_seconds{quantile="0.01"} 3102 labels: - name: quantile value: 0.01 type: untyped - name: rpc_duration_seconds value: 3272 line_raw: rpc_duration_seconds{quantile="0.05"} 3272 labels: - name: quantile value: 0.05 type: untyped - name: rpc_duration_seconds value: 4773 line_raw: rpc_duration_seconds{quantile="0.5"} 4773 labels: - name: quantile value: 0.5 type: untyped - name: rpc_duration_seconds value: 9001 line_raw: rpc_duration_seconds{quantile="0.9"} 9001 labels: - name: quantile value: 0.9 type: untyped - name: rpc_duration_seconds value: 76656 line_raw: rpc_duration_seconds{quantile="0.99"} 76656 labels: - name: quantile value: 0.99 type: untyped - name: rpc_duration_seconds_sum value: 1.7560473e+07 line_raw: rpc_duration_seconds_sum 1.7560473e+07 type: untyped - name: rpc_duration_seconds_count value: 2693 line_raw: rpc_duration_seconds_count 2693 type: untyped --- test case: 'Only spaces in metric and in params' in: data: ' ' params: ' ' out: result: FAIL --- test case: 'Empty multiline metric' in: data: "\n\n\n\n" params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Metric without value' in: data: wmi_os_physical_memory_free_bytes params: wmi_os_physical_memory_free_bytes out: result: FAIL --- test case: 'Metric with missing label value: wmi_os_timezone{timezone=} 1' in: data: | # HELP wmi_os_timezone OperatingSystem.LocalDateTime # TYPE wmi_os_timezone gauge wmi_os_timezone{timezone=} 1 params: wmi_os_timezone out: result: FAIL --- test case: 'Metric with missing label value: wmi_os_timezone{timezone} 1' in: data: | # HELP wmi_os_timezone OperatingSystem.LocalDateTime # TYPE wmi_os_timezone gauge wmi_os_timezone{timezone} 1 params: wmi_os_timezone out: result: FAIL --- test case: 'Incorrect metric data' in: data: asdlkdlkasdasd09814mnvclmx params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Incorrect metric data (a space within)' in: data: asdlkdlkasda sd09814mnvclmx params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Metric name with invalid characters included' in: data: wmi_os_physical_^&;memory_free_bytes 8.492331008e+09 params: wmi_os_physical_^&;memory_free_bytes out: result: FAIL --- test case: 'Incorrect metric data with valid HELP/TYPE' in: data: | # HELP wmi_os_timezone OperatingSystem.LocalDateTime # TYPE wmi_os_timezone gauge asdlkdlkasdasd09814mnvclmx params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Metric with a hash symbol only' in: data: '#' params: wmi_os_timezone out: result: SUCCEED output_raw: '[]' --- test case: 'Metric with an empty space only' in: data: ' ' params: wmi_os_timezone out: result: FAIL --- test case: 'Metric with UTF-8 3 byte character only' in: data: "ࠀ" params: wmi_os_timezone out: result: FAIL --- test case: 'Metric with UTF-8 3 byte character in label value' in: data: | # HELP http_requests_total The total number of HTTP requests. # TYPE http_requests_total counter http_requests_total{method="post",code="200"} 1027 1395066363000 http_requests_total{method="post",code="-⃠"} 3 1395066363000 params: http_requests_total == 3 out: result: SUCCEED metrics: - name: http_requests_total value: 3 line_raw: http_requests_total{method="post",code="-⃠"} 3 1395066363000 labels: - name: method value: post - name: code value: -⃠ type: counter help: The total number of HTTP requests. --- test case: 'Metric with missing "{"' in: data: cpu_usage_systemcpu="cpu-total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: SUCCEED output_raw: '[]' --- test case: 'Metric with missing "}"' in: data: cpu_usage_system{cpu="cpu-total" 1.1940298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with missing "' in: data: cpu_usage_system{cpu=cpu-total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with missing ","' in: data: cpu_usage_system{cpu="cpu-total"host="host1"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with missing "," but empty params' in: data: cpu_usage_system{cpu="cpu-total"host="host1"} 1.1940298507220641 params: "" out: result: FAIL --- test case: 'Double equal sign (==) instead of single equal sign (=) in label value assignment #1' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu=="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Double equal sign (==) instead of single equal sign (=) in label value assignment #2' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu=="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Double equal sign (==) instead of single equal sign (=) in label value assignment #3' in: data: cpu_usage_system{cpu=="cpu-total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Label value and params holds new line character' in: data: "cpu_usage_system{cpu=\"cpu\ntotal\"} 1.1940298507220641" params: "cpu_usage_system{cpu=\"cpu\ntotal\"}" out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: "cpu_usage_system{cpu=\"cpu\ntotal\"} 1.1940298507220641" labels: - name: cpu value: "cpu\ntotal" type: untyped --- test case: 'Metric name and params holds new line character' in: data: "cpu_usa\nge_system{cpu=\"cputotal\"} 1.1940298507220641" params: "cpu_usa\nge_system{cpu=\"cputotal\"}" out: result: FAIL --- test case: 'Double equal sign (==) instead of single equal sign (=) for label value in params' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu=="cpu-total"} out: result: FAIL --- test case: 'Single equal sign (=) instead of double equal sign (==) for metric value in params' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} = 1.1940298507220641 out: result: FAIL --- test case: 'More than one metric (2) corresponds to the given params' in: data: | wmi_service_state{name="devicesflowusersvc_7b100",state="running"} 1 wmi_service_state{name="devicesflowusersvc_7b100",state="start pending"} 0 wmi_service_state{name="devicesflowusersvc_7b100",state="stop pending"} 0 wmi_service_state{name="devicesflowusersvc_7b100",state="stopped"} 0 wmi_service_state{name="devicesflowusersvc_7b100",state="unknown"} 0 wmi_service_state{name="dhcp",state="continue pending"} 0 wmi_service_state{name="dhcp",state="pause pending"} 0 wmi_service_state{name="dhcp",state="paused"} 0 wmi_service_state{name="dhcp",state="running"} 1 wmi_service_state{name="dhcp",state="start pending"} 0 wmi_service_state{name="dhcp",state="stop pending"} 0 wmi_service_state{name="dhcp",state="stopped"} 1 wmi_service_state{name="dhcp",state="unknown"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="continue pending"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="pause pending"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="paused"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="running"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="start pending"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="stop pending"} 0 wmi_service_state{name="diagnosticshub.standardcollector.service",state="stopped"} 1 wmi_service_state{name="diagnosticshub.standardcollector.service",state="unknown"} 0 params: wmi_service_state{name="dhcp"} == 1 out: result: SUCCEED metrics: - name: wmi_service_state value: 1 line_raw: wmi_service_state{name="dhcp",state="running"} 1 labels: - name: name value: dhcp - name: state value: running type: untyped - name: wmi_service_state value: 1 line_raw: wmi_service_state{name="dhcp",state="stopped"} 1 labels: - name: name value: dhcp - name: state value: stopped type: untyped --- test case: 'Metric with "Nan" value' in: data: wmi_os_physical_memory_free_bytes Nan params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: Nan line_raw: wmi_os_physical_memory_free_bytes Nan type: untyped --- test case: 'Metric with "+Inf" value' in: data: wmi_os_physical_memory_free_bytes +Inf params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: +Inf line_raw: wmi_os_physical_memory_free_bytes +Inf type: untyped --- test case: 'Metric with "-Inf" value' in: data: wmi_os_physical_memory_free_bytes -Inf params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: -Inf line_raw: wmi_os_physical_memory_free_bytes -Inf type: untyped --- test case: 'Metric with "NAN" value' in: data: wmi_os_physical_memory_free_bytes NAN params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: NAN line_raw: wmi_os_physical_memory_free_bytes NAN type: untyped --- test case: 'Metric with timestamp' in: data: wmi_os_physical_memory_free_bytes 8.492331008e+09 25 params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: 8.492331008e+09 line_raw: wmi_os_physical_memory_free_bytes 8.492331008e+09 25 type: untyped --- test case: 'Metric with additional value after timestamp' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 25 66 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 25 66 labels: - name: cpu value: cpu-total type: gauge help: Telegraf collected metric --- test case: 'Metric with negative timestamp' in: data: http_requests_total{method="post",code="200"} 1027 -123 params: http_requests_total out: result: SUCCEED metrics: - name: http_requests_total value: 1027 line_raw: http_requests_total{method="post",code="200"} 1027 -123 labels: - name: method value: post - name: code value: 200 type: untyped --- test case: 'Metric with negative value' in: data: http_requests_total{method="post",code="200"} -1027 params: http_requests_total out: result: SUCCEED metrics: - name: http_requests_total value: -1027 line_raw: http_requests_total{method="post",code="200"} -1027 labels: - name: method value: post - name: code value: 200 type: untyped --- test case: 'Multilne metric with negative value' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} -654 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{__name__=~"cpu_usage_syst.+",cpu=~"cpu-tot.+"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: -654 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} -654 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'The __name__ identifier is specified as last in params #1' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{cpu="cpu-total",__name__="cpu_usage_system"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'The __name__ identifier is specified as last in params #2' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{cpu=~"cpu-tot.+",__name__=~"cpu_usage_syst.+"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 type: gauge help: Telegraf collected metric --- test case: 'Params set to cpu_usage_system{__name__=~"cpu_usage_syst.+",cpu=~"cpu-tot.+"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.19402985 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: 'cpu_usage_system{__name__=~"cpu_usage_syst.+",cpu=~"cpu-tot.+"}' out: result: FAIL --- test case: 'Params set to cpu_usage_system{__name__=~"cpu_age_syst.+",cpu=~"cpu-tot.+"}' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.19402985 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: 'cpu_usage_system{__name__=~"cpu_age_syst.+",cpu=~"cpu-tot.+"}' out: result: FAIL --- test case: 'Metric with multiple HELP lines' in: data: | # HELP cpu_usage_system Telegraf collected metric # HELP cpu_usage_system collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with multiple TYPE:untyped lines' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system untyped # TYPE cpu_usage_system untyped cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with wrong TYPE' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system something cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 labels: - name: cpu value: cpu-total type: something help: Telegraf collected metric --- test case: 'Metric with only one argument for TYPE' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with no arguments for TYPE' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with multiple spaces before value' in: data: wmi_os_physical_memory_free_bytes 8.492331008e+09 params: wmi_os_physical_memory_free_bytes out: result: SUCCEED metrics: - name: wmi_os_physical_memory_free_bytes value: 8.492331008e+09 line_raw: wmi_os_physical_memory_free_bytes 8.492331008e+09 type: untyped --- test case: 'Metric with no description after HELP' in: data: | # HELP cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total"} out: result: FAIL --- test case: 'Metric with invalid characters in label name' in: data: cpu_usage_system{cp%^&u="cpu-total"} 1.1940298507220641 params: cpu_usage_system{cp%^&u="cpu-total"} out: result: FAIL --- test case: 'Metric name consists of all valid characters' in: data: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789 1 params: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789 out: result: SUCCEED metrics: - name: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789 value: 1 line_raw: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:_0123456789 1 type: untyped --- test case: 'Label name consists of all valid characters' in: data: cpu_usage_system{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_0123456789="test"} 1 params: cpu_usage_system == 1 out: result: SUCCEED metrics: - name: cpu_usage_system value: 1 line_raw: cpu_usage_system{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_0123456789="test"} 1 labels: - name: AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz_0123456789 value: test type: untyped --- test case: 'Params with regular expression but without prefix "~"' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total",host=".*"} out: result: SUCCEED output_raw: '[]' --- test case: 'Wrong regular expression in params' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu-total",host=~"[0-9"} out: result: SUCCEED output_raw: '[]' --- test case: 'Incorrect identifier __cpu__ set in params #1' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} -654 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{__name__="cpu_usage_system",__cpu__="cpu-total"}' out: result: SUCCEED output_raw: '[]' --- test case: 'Incorrect identifier __cpu__ set in params #2' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} -654 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 params: '{__name__=~"cpu_usage_syst.+",__cpu__=~"cpu-tot.+"}' out: result: SUCCEED output_raw: '[]' --- test case: 'Incorrect float in metric value' in: data: wmi_logical_disk_free_bytes{volume="D:"} 8.49233.1008e+09 params: wmi_logical_disk_free_bytes out: result: FAIL --- test case: 'Params set to "{}"' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cputotal"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: '{}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cputotal"} 1.1940298507220641 labels: - name: cpu value: cputotal type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0"} 1.1940298507220641 labels: - name: cpu value: cpu0 type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1340298507220641 line_raw: cpu_usage_system{cpu="cpu1"} 1.1340298507220641 labels: - name: cpu value: cpu1 type: gauge help: Telegraf collected metric --- test case: 'Params set to "a{}"' in: data: | # HELP a Telegraf collected metric # TYPE a gauge a{cpu="cputotal"} 1.1940298507220641 a{cpu="cpu0"} 1.1940298507220641 a{cpu="cpu1"} 1.1340298507220641 params: a{} out: result: SUCCEED metrics: - name: a value: 1.1940298507220641 line_raw: a{cpu="cputotal"} 1.1940298507220641 labels: - name: cpu value: cputotal type: gauge help: Telegraf collected metric - name: a value: 1.1940298507220641 line_raw: a{cpu="cpu0"} 1.1940298507220641 labels: - name: cpu value: cpu0 type: gauge help: Telegraf collected metric - name: a value: 1.1340298507220641 line_raw: a{cpu="cpu1"} 1.1340298507220641 labels: - name: cpu value: cpu1 type: gauge help: Telegraf collected metric --- test case: 'Metric data contains "{}" only' in: data: '{}' params: metric out: result: FAIL --- test case: 'Negative value in params for metric value' in: data: | # HELP wmi_os_timezone OperatingSystem.LocalDateTime # TYPE wmi_os_timezone gauge wmi_os_timezone{timezone="MSK"} -1 params: wmi_os_timezone{timezone="MSK"} == -1 out: result: SUCCEED metrics: - name: wmi_os_timezone value: -1 line_raw: wmi_os_timezone{timezone="MSK"} -1 labels: - name: timezone value: MSK type: gauge help: OperatingSystem.LocalDateTime --- test case: 'Get metric value using regular expression for date (mm/dd/yyyy) #1' in: data: | random_date{year="2019",month="february",day="02/12/2019"} 1 random_date{year="2019",month="march",day="03/07/2019"} 2 params: random_date{year="2019",day=~"^([0-2][0-9]|(3)[0-1])(\\/)(((0)[0-9])|((1)[0-2]))(\\/)\\d{4}$"} out: result: SUCCEED metrics: - name: random_date value: 1 line_raw: random_date{year="2019",month="february",day="02/12/2019"} 1 labels: - name: year value: 2019 - name: month value: february - name: day value: 02/12/2019 type: untyped - name: random_date value: 2 line_raw: random_date{year="2019",month="march",day="03/07/2019"} 2 labels: - name: year value: 2019 - name: month value: march - name: day value: 03/07/2019 type: untyped --- test case: 'Get metric value using regular expression for date (mm/dd/yyyy) #2' in: data: | random_date{year="2019",month="february",day="02/12/2019"} 1 random_date{year="2019",month="march",day="03/07/2019"} 2 params: random_date{year="2019",day=~"^([0-2][0-9]|(3)[0-1])(\\/)(((0)[0-9])|((1)[0-2]))(\\/)\\d{4}$"} == 2 out: result: SUCCEED metrics: - name: random_date value: 2 line_raw: random_date{year="2019",month="march",day="03/07/2019"} 2 labels: - name: year value: 2019 - name: month value: march - name: day value: 03/07/2019 type: untyped --- test case: 'Get metric value using regular expression for date (mm/dd/yyyy) #3' in: data: | random_date{year="2019",month="february",day="02/12/2019"} 1 random_date{year="2019",month="march",day="03-07-2019"} 2 params: random_date{year="2019",day=~"^([0-2][0-9]|(3)[0-1])(\\/)(((0)[0-9])|((1)[0-2]))(\\/)\\d{4}$"} == 2 out: result: SUCCEED output_raw: '[]' --- test case: 'Missing "==" in params' in: data: | # HELP wmi_os_timezone OperatingSystem.LocalDateTime # TYPE wmi_os_timezone gauge wmi_os_timezone{timezone="MSK"} 1 params: wmi_os_timezone 1 out: result: FAIL --- test case: 'Get metric value using regular expression for email address' in: data: | some_user{country="lv",addr="user1@domain.com"} 1 some_user{country="lv",addr="user2@domain.org"} 2 some_user{country="lv",addr="no_valid_addr"} 2 params: some_user{country="lv",addr=~"^[-\\w\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"} out: result: SUCCEED metrics: - name: some_user value: 1 line_raw: some_user{country="lv",addr="user1@domain.com"} 1 labels: - name: country value: lv - name: addr value: user1@domain.com type: untyped - name: some_user value: 2 line_raw: some_user{country="lv",addr="user2@domain.org"} 2 labels: - name: country value: lv - name: addr value: user2@domain.org type: untyped --- test case: 'Label value and params hold "{"' in: data: cpu_usage_system{cpu="cpu{total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu{total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu{total"} 1.1940298507220641 labels: - name: cpu value: cpu{total type: untyped --- test case: 'Label value and params hold "{}"' in: data: cpu_usage_system{cpu="cpu{}total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu{}total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu{}total"} 1.1940298507220641 labels: - name: cpu value: cpu{}total type: untyped --- test case: 'Label value and params hold "}"' in: data: cpu_usage_system{cpu="cpu}total"} 1.1940298507220641 params: cpu_usage_system{cpu="cpu}total"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu}total"} 1.1940298507220641 labels: - name: cpu value: cpu}total type: untyped --- test case: 'Label value and params hold ","' in: data: important_metric{important_number="42,0"} 42 params: important_metric{important_number="42,0"} out: result: SUCCEED metrics: - name: important_metric value: 42 line_raw: important_metric{important_number="42,0"} 42 labels: - name: important_number value: 42,0 type: untyped --- test case: 'Metric with five values' in: data: cpu_usage_system{cpu="cputotal"} 1.1940298507220641 2.23443 333 four five params: cpu_usage_system{cpu="cputotal"} == 1.1940298507220641 out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cputotal"} 1.1940298507220641 2.23443 333 four five labels: - name: cpu value: cputotal type: untyped --- test case: 'Different metrics under one header #1' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 wmi_os_timezone{timezone="MSK"} 1 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 params: cpu_usage_system{cpu="cpu1",host=~".*"} out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1340298507220641 line_raw: cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 labels: - name: cpu value: cpu1 - name: host value: host3 type: gauge help: Telegraf collected metric --- test case: 'Different metrics under one header #2' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 wmi_os_timezone{timezone="MSK",host="host2"} 1 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 params: '{host="host2"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 labels: - name: cpu value: cpu0 - name: host value: host2 type: gauge help: Telegraf collected metric - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK",host="host2"} 1 labels: - name: timezone value: MSK - name: host value: host2 type: untyped --- test case: 'Different metrics under one header #3' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 wmi_os_timezone{timezone="MSK",host="host2"} 1 params: '{host="host2"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 labels: - name: cpu value: cpu0 - name: host value: host2 type: gauge help: Telegraf collected metric - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK",host="host2"} 1 labels: - name: timezone value: MSK - name: host value: host2 type: untyped --- test case: 'Metrics of different type #1' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1.1340298507220641 # HELP http_requests_total The total number of HTTP requests. # TYPE http_requests_total counter http_requests_total{method="post",code="200"} 1027 1395066363000 http_requests_total{method="post",code="400"} 3 1395066363000 params: http_requests_total == 3 out: result: SUCCEED metrics: - name: http_requests_total value: 3 line_raw: http_requests_total{method="post",code="400"} 3 1395066363000 labels: - name: method value: post - name: code value: 400 type: counter help: The total number of HTTP requests. --- test case: 'Metrics of different type #2' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1"} 1027 # HELP http_requests_total The total number of HTTP requests. # TYPE http_requests_total counter http_requests_total{method="post",code="200"} 1027 1395066363000 http_requests_total{method="post",code="400"} 3 1395066363000 params: '{__name__=~".*"} == 1027' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1027 line_raw: cpu_usage_system{cpu="cpu1",host="host1"} 1027 labels: - name: cpu value: cpu1 - name: host value: host1 type: gauge help: Telegraf collected metric - name: http_requests_total value: 1027 line_raw: http_requests_total{method="post",code="200"} 1027 1395066363000 labels: - name: method value: post - name: code value: 200 type: counter help: The total number of HTTP requests. --- test case: 'Metrics of different type #3' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1",prio="normal"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host1",prio="high"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host1",prio="normal"} 1027 # HELP http_requests_total The total number of HTTP requests. # TYPE http_requests_total counter http_requests_total{method="post",code="200",prio="high"} 1027 1395066363000 http_requests_total{method="post",code="400",prio="normal"} 3 1395066363000 params: '{prio="normal"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total",host="host1",prio="normal"} 1.1940298507220641 labels: - name: cpu value: cpu-total - name: host value: host1 - name: prio value: normal type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1027 line_raw: cpu_usage_system{cpu="cpu1",host="host1",prio="normal"} 1027 labels: - name: cpu value: cpu1 - name: host value: host1 - name: prio value: normal type: gauge help: Telegraf collected metric - name: http_requests_total value: 3 line_raw: http_requests_total{method="post",code="400",prio="normal"} 3 1395066363000 labels: - name: method value: post - name: code value: 400 - name: prio value: normal type: counter help: The total number of HTTP requests. --- test case: 'Get metric value using params: cpu_usage_system' in: data: | # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 cpu_usage_system{cpu="cpu0"} 1.1940298507220641 cpu_usage_system{cpu="cpu1"} 1.1340298507220641 params: cpu_usage_system out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu-total"} 1.1940298507220641 labels: - name: cpu value: cpu-total type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0"} 1.1940298507220641 labels: - name: cpu value: cpu0 type: gauge help: Telegraf collected metric - name: cpu_usage_system value: 1.1340298507220641 line_raw: cpu_usage_system{cpu="cpu1"} 1.1340298507220641 labels: - name: cpu value: cpu1 type: gauge help: Telegraf collected metric --- test case: 'Different metrics #1' in: data: | wmi_os_timezone{timezone="MSK",host="host2"} 1 # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 params: '{host="host2"}' out: result: SUCCEED metrics: - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK",host="host2"} 1 labels: - name: timezone value: MSK - name: host value: host2 type: untyped - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 labels: - name: cpu value: cpu0 - name: host value: host2 type: gauge help: Telegraf collected metric --- test case: 'Different metrics #2' in: data: | wmi_os_timezone{timezone="MSK",host="host2"} 1 # HELP cpu_usage_system Telegraf collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 params: '{host="host2"}' out: result: SUCCEED metrics: - name: wmi_os_timezone value: 1 line_raw: wmi_os_timezone{timezone="MSK",host="host2"} 1 labels: - name: timezone value: MSK - name: host value: host2 type: untyped - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 labels: - name: cpu value: cpu0 - name: host value: host2 type: gauge help: Telegraf collected metric --- test case: 'Invalid HELP hint' in: data: | wmi_os_timezone{timezone="MSK",host="host2"} 1 # HELP cpu_usage_system Telegraf \x collected metric # TYPE cpu_usage_system gauge cpu_usage_system{cpu="cpu-total",host="host1"} 1.1940298507220641 cpu_usage_system{cpu="cpu0",host="host2"} 1.1940298507220641 cpu_usage_system{cpu="cpu1",host="host3"} 1.1340298507220641 params: '{host="host2"}' out: result: FAIL --- test case: 'Test HELP hint unescaping' in: data: | # HELP cpu_usage_system Telegraf \\/ collected metric # TYPE cpu_usage_system gauge cpu_usage_system 1.1940298507220641 params: '{__name__=~"cpu_usage_syst.+"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system 1.1940298507220641 type: gauge help: Telegraf \/ collected metric --- test case: 'Test HELP hint trailing whitespace removal' in: data: "# HELP cpu_usage_system Telegraf collected metric \n# TYPE cpu_usage_system gauge\ncpu_usage_system 1.1940298507220641\n" params: '{__name__=~"cpu_usage_syst.+"}' out: result: SUCCEED metrics: - name: cpu_usage_system value: 1.1940298507220641 line_raw: cpu_usage_system 1.1940298507220641 type: gauge help: Telegraf collected metric --- test case: 'Test HELP hint unescaping' in: data: "alertmanager_alerts{instance=\"demo.robustperception.io:9093\",job=\"alertmanager\",state=\"active\"} 4\nalertmanager_alerts{instance=\"demo.robustperception.io:9093\",job=\"alertmanager\",state=\"active\"} 5\n # test alertmanager_alerts test" params: '' out: result: SUCCEED metrics: - name: alertmanager_alerts value: 4 line_raw: alertmanager_alerts{instance="demo.robustperception.io:9093",job="alertmanager",state="active"} 4 labels: - name: instance value: demo.robustperception.io:9093 - name: job value: alertmanager - name: state value: active type: untyped - name: alertmanager_alerts value: 5 line_raw: alertmanager_alerts{instance="demo.robustperception.io:9093",job="alertmanager",state="active"} 5 labels: - name: instance value: demo.robustperception.io:9093 - name: job value: alertmanager - name: state value: active type: untyped ...