Révision b43ec018
use printf and pass variable to awk
| plugins/router/mikrotik_system | ||
|---|---|---|
| 320 | 320 |
get_mem_total |
| 321 | 321 |
get_mem_free |
| 322 | 322 |
while read -r line; do |
| 323 |
echo "$line" | awk '/free-memory:/{
|
|
| 324 |
print "multigraph memory_graph_""'"$name"'";
|
|
| 325 |
print "graph_title memory " "'"$name"'";
|
|
| 323 |
echo "$line" | awk -v name=$name '/free-memory:/{
|
|
| 324 |
printf "multigraph memory_graph_%s\n", name;
|
|
| 325 |
printf "graph_title memory %s\n", name;
|
|
| 326 | 326 |
print "graph_vlabel MiB"; |
| 327 | 327 |
print "graph_category mikrotik"; |
| 328 | 328 |
print "graph_args -l 0"; |
| ... | ... | |
| 331 | 331 |
print "free_memory.label free memory"; |
| 332 | 332 |
print "graph_info Total, Used & free RAM."; |
| 333 | 333 |
gsub(/MiB/,"",$2); |
| 334 |
print "used_memory.critical " $2*0.9;
|
|
| 335 |
print "used_memory.warning " $2*0.7 }'
|
|
| 334 |
printf "used_memory.critical %.0f\n", $2*0.9;
|
|
| 335 |
printf "used_memory.warning %.0f\n", $2*0.7 }'
|
|
| 336 | 336 |
done <<< "$data" |
| 337 | 337 |
} |
| 338 | 338 |
function get_memory_value {
|
Formats disponibles : Unified diff