Skip to content

Commit

Permalink
Merge pull request #3339 from iholder101/metric/machine-swap-capacity
Browse files Browse the repository at this point in the history
Add a metric for machine swap capacity
  • Loading branch information
iwankgb authored Jun 27, 2023
2 parents 4496c94 + 78150d9 commit b4443af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/storage/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Metric name | Type | Description | Unit (where applicable) | option parameter |
`machine_dimm_capacity_bytes` | Gauge | Total RAM DIMM capacity (all types memory modules) value labeled by dimm type,<br>information is retrieved from sysfs edac per-DIMM API (/sys/devices/system/edac/mc/) introduced in kernel 3.6 | bytes | | |
`machine_dimm_count` | Gauge | Number of RAM DIMM (all types memory modules) value labeled by dimm type,<br>information is retrieved from sysfs edac per-DIMM API (/sys/devices/system/edac/mc/) introduced in kernel 3.6 | | |
`machine_memory_bytes` | Gauge | Amount of memory installed on the machine | bytes | |
`machine_swap_bytes` | Gauge | Amount of swap memory available on the machine | bytes | |
`machine_node_distance` | Gauge | Distance between NUMA node and target NUMA node | | cpu_topology |
`machine_node_hugepages_count` | Gauge | Numer of hugepages assigned to NUMA node | | cpu_topology |
`machine_node_memory_capacity_bytes` | Gauge | Amount of memory assigned to NUMA node | bytes | cpu_topology |
Expand Down
8 changes: 8 additions & 0 deletions metrics/prometheus_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ func NewPrometheusMachineCollector(i infoProvider, includedMetrics container.Met
return metricValues{{value: float64(machineInfo.MemoryCapacity), timestamp: machineInfo.Timestamp}}
},
},
{
name: "machine_swap_bytes",
help: "Amount of swap memory available on the machine.",
valueType: prometheus.GaugeValue,
getValues: func(machineInfo *info.MachineInfo) metricValues {
return metricValues{{value: float64(machineInfo.SwapCapacity), timestamp: machineInfo.Timestamp}}
},
},
{
name: "machine_dimm_count",
help: "Number of RAM DIMM (all types memory modules) value labeled by dimm type.",
Expand Down
3 changes: 3 additions & 0 deletions metrics/testdata/prometheus_machine_metrics
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ machine_nvm_capacity{boot_id="boot-id-test",machine_id="machine-id-test",mode="m
# HELP machine_scrape_error 1 if there was an error while getting machine metrics, 0 otherwise.
# TYPE machine_scrape_error gauge
machine_scrape_error 0
# HELP machine_swap_bytes Amount of swap memory available on the machine.
# TYPE machine_swap_bytes gauge
machine_swap_bytes{boot_id="boot-id-test",machine_id="machine-id-test",system_uuid="system-uuid-test"} 0 1395066363000
# HELP machine_thread_siblings_count Number of CPU thread siblings.
# TYPE machine_thread_siblings_count gauge
machine_thread_siblings_count{boot_id="boot-id-test",core_id="0",machine_id="machine-id-test",node_id="0",system_uuid="system-uuid-test",thread_id="0"} 2 1395066363000
Expand Down

0 comments on commit b4443af

Please sign in to comment.