Get system stats to use in Consul Template
Plugin based on gopsutil use system stats in Consul Template. f.e. calculate HEAP for Java APPs.
{{ plugin system-stats-consul-template-plugin "<statsType>"" }}
- memory
- cpuInfo
- cpuCount
###get total mempory
{{ with $d := plugin "system-stats-consul-template-plugin" "memory" |parseJSON }}{{ $d.total }}{{ end }}
{{ with $d := plugin "system-stats-consul-template-plugin" "memory" |parseJSON }}{{ printf "%.f" (($d.total | multiply 0.8) | divide 1000 | divide 1000) }}{{ end }}