sacloud / sakuracloud_exporter

Prometheus exporter for SakuraCloud metrics.
Apache License 2.0
7 stars 2 forks source link

[Bug]: Metrics with multiple values #14

Closed TakumaNakagame closed 5 years ago

TakumaNakagame commented 5 years ago

Problem

Prometheus reads one value for a metric. However, some metrics in SakuraCloud Exporter output two values.

For example

# HELP sakuracloud_server_cpu_time Server's CPU time(unit: ms)
# TYPE sakuracloud_server_cpu_time gauge
sakuracloud_server_cpu_time{id="[RESOURCE_ID]",name="[RESOURCE_NAME]",zone="is1b"} 53.333333333 1562729400000

# HELP sakuracloud_server_disk_read Disk's read bytes(unit: KBps)
# TYPE sakuracloud_server_disk_read gauge
sakuracloud_server_disk_read{disk_id="[RESOURCE_ID]",disk_name="[RESOURCE_NAME]",id="[RESOURCE_ID]",index="0",name="[RESOURCE_NAME]",zone="is1b"} 0 1562729400000

and more.

Therefore, you can not refer data from Prometheus.

Behavior to be sought

One value is output from SakuraCloud Exporter, and can be referenced from Prometheus.

Example (this is from Node Exporter)

# HELP node_cpu_seconds_total Seconds the cpus spent in each mode.
# TYPE node_cpu_seconds_total counter
node_cpu_seconds_total{cpu="0",mode="idle"} 6755.32

# HELP node_filesystem_avail_bytes Filesystem space available to non-root users in bytes.
# TYPE node_filesystem_avail_bytes gauge
node_filesystem_avail_bytes{device="C:",fstype="drvfs",mountpoint="/mnt/c"} 3.8205878272e+11

Environment

Prometheus:

SakuraCloud Exporter

yamamoto-febc commented 5 years ago

Hi @TakumaNakagame, Thank you for reporting.

It looks like expected behavior. The second value is a timestamp.

Metrics Format(ref: https://prometheus.io/docs/instrumenting/exposition_formats/):

 metric_name [
  "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}"
] value [ timestamp ]
TakumaNakagame commented 5 years ago

Hi @yamamoto-febc, Thank you for confirmation!

The format was my mistake. Thank you for teaching me!


However, the value is not displayed as it is. The value is taken in SakuraCloud-Exporter.

sakuracloud_nfs_info is OK. image

sakuracloud_nfs_free_disk_size is NG. image

yamamoto-febc commented 5 years ago

Can you view data in a Graph view (not a Console view)? If so, it is Prometheus's default behavior.

Please see this comment.

This is as timestamps are set on the data which will be at least 10 minutes old, and the console view only looks back 5 minutes.

yamamoto-febc commented 5 years ago

In addition, you can also set time/timestamp parameter.

スクリーンショット 2019-07-10 15 42 33

ref: https://github.com/prometheus/prometheus/pull/4764

Please try it.

TakumaNakagame commented 5 years ago

Oops! Displayed in graph view! This is what I did not know.

Thank you! My problem is solved. It was saved.

image

yamamoto-febc commented 5 years ago

NP:smile: I'm going to close this.