mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Fix memory gauge in mixin with multiple pods
Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
This commit is contained in:
		
							parent
							
								
									ff2ff3410f
								
							
						
					
					
						commit
						6585e43eec
					
				|  | @ -75,14 +75,15 @@ local gauge = promgrafonnet.gauge; | |||
| 
 | ||||
|       // TODO: It would be nicer to have a gauge that gets a 0-1 range and displays it as a percentage 0%-100%. | ||||
|       // This needs to be added upstream in the promgrafonnet library and then changed here. | ||||
|       // NOTE: avg() is used to circumvent a label change caused by a node_exporter rollout. | ||||
|       local memoryGauge = gauge.new( | ||||
|         'Memory Usage', | ||||
|         ||| | ||||
|           100 - | ||||
|           ( | ||||
|             node_memory_MemAvailable_bytes{%(nodeExporterSelector)s, instance="$instance"} | ||||
|             avg(node_memory_MemAvailable_bytes{%(nodeExporterSelector)s, instance="$instance"}) | ||||
|           / | ||||
|             node_memory_MemTotal_bytes{%(nodeExporterSelector)s, instance="$instance"} | ||||
|             avg(node_memory_MemTotal_bytes{%(nodeExporterSelector)s, instance="$instance"}) | ||||
|           * 100 | ||||
|           ) | ||||
|         ||| % $._config, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue