Skip to content

Commit ff1004c

Browse files
committed
Use same threshold for mem, swap and cpu metrics: low, medium, stress
1 parent 335997c commit ff1004c

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

scripts/cpu.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ refresh_interval=$(get_tmux_option "status-interval" "5")
1111
cpu_view_tmpl=$(get_tmux_option "@sysstat_cpu_view_tmpl" '#[fg=#{cpu.color}]#{cpu.pused}#[default]')
1212

1313
cpu_medium_threshold=$(get_tmux_option "@sysstat_cpu_medium_threshold" "30")
14-
cpu_high_threshold=$(get_tmux_option "@sysstat_cpu_high_threshold" "80")
14+
cpu_stress_threshold=$(get_tmux_option "@sysstat_cpu_stress_threshold" "80")
1515

1616
cpu_color_low=$(get_tmux_option "@sysstat_cpu_color_low" "green")
1717
cpu_color_medium=$(get_tmux_option "@sysstat_cpu_color_medium" "yellow")
18-
cpu_color_high=$(get_tmux_option "@sysstat_cpu_color_high" "red")
18+
cpu_color_stress=$(get_tmux_option "@sysstat_cpu_color_stress" "red")
1919

2020
get_cpu_color(){
2121
local cpu_used=$1
2222

23-
if fcomp "$cpu_high_threshold" "$cpu_used"; then
24-
echo "$cpu_color_high";
23+
if fcomp "$cpu_stress_threshold" "$cpu_used"; then
24+
echo "$cpu_color_stress";
2525
elif fcomp "$cpu_medium_threshold" "$cpu_used"; then
2626
echo "$cpu_color_medium";
2727
else

scripts/mem.sh

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,43 @@ source "$CURRENT_DIR/helpers.sh"
88

99
mem_view_tmpl=$(get_tmux_option "@sysstat_mem_view_tmpl" '#[fg=#{mem.color}]#{mem.pused}#[default]')
1010

11-
mem_stress_threshold=$(get_tmux_option "@sysstat_mem_stress_threshold" "80")
12-
swap_stress_threshold=$(get_tmux_option "@sysstat_swap_stress_threshold" "80")
11+
mem_medium_threshold=$(get_tmux_option "@sysstat_mem_medium_threshold" "75")
12+
mem_stress_threshold=$(get_tmux_option "@sysstat_mem_stress_threshold" "90")
1313

14-
mem_color_ok=$(get_tmux_option "@sysstat_mem_color_ok" "green")
15-
mem_color_stress=$(get_tmux_option "@sysstat_mem_color_stress" "yellow")
16-
swap_color_ok=$(get_tmux_option "@sysstat_swap_color_ok" "green")
17-
swap_color_stress=$(get_tmux_option "@sysstat_swap_color_stress" "yellow")
14+
swap_medium_threshold=$(get_tmux_option "@sysstat_swap_medium_threshold" "25")
15+
swap_stress_threshold=$(get_tmux_option "@sysstat_swap_stress_threshold" "75")
1816

19-
size_unit=$(get_tmux_option "@sysstat_mem_size_unit" "M")
17+
mem_color_low=$(get_tmux_option "@sysstat_mem_color_low" "green")
18+
mem_color_medium=$(get_tmux_option "@sysstat_mem_color_medium" "yellow")
19+
mem_color_stress=$(get_tmux_option "@sysstat_mem_color_stress" "red")
20+
21+
swap_color_low=$(get_tmux_option "@sysstat_swap_color_low" "green")
22+
swap_color_medium=$(get_tmux_option "@sysstat_swap_color_medium" "yellow")
23+
swap_color_stress=$(get_tmux_option "@sysstat_swap_color_stress" "red")
24+
25+
size_unit=$(get_tmux_option "@sysstat_mem_size_unit" "G")
2026

2127
get_mem_color() {
2228
local mem_pused=$1
2329

2430
if fcomp "$mem_stress_threshold" "$mem_pused"; then
2531
echo "$mem_color_stress";
26-
else
27-
echo "$mem_color_ok";
32+
elif fcomp "$mem_medium_threshold" "$mem_pused"; then
33+
echo "$mem_color_medium";
34+
else
35+
echo "$mem_color_low";
2836
fi
2937
}
3038

31-
get_swap_color(){
39+
get_swap_color() {
3240
local swap_pused=$1
3341

3442
if fcomp "$swap_stress_threshold" "$swap_pused"; then
3543
echo "$swap_color_stress";
36-
else
37-
echo "$swap_color_ok";
44+
elif fcomp "$swap_medium_threshold" "$swap_pused"; then
45+
echo "$swap_color_medium";
46+
else
47+
echo "$swap_color_low";
3848
fi
3949
}
4050

0 commit comments

Comments
 (0)