-
Notifications
You must be signed in to change notification settings - Fork 1
/
ov
106 lines (88 loc) · 2.06 KB
/
ov
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
RED='\033[0;32m'
printf "\n______________________________________________________________\n\n$(tput sgr0)"
printf ${RED}$(tput bold)"Starting Computer System Overview Screen"
printf "\n______________________________________________________________\n\n$(tput sgr0)"
print_message(){
printf "\n\n"
printf ${RED}$(tput bold)"$1"
printf "\n\n$(tput sgr0)"
}
get_iostat(){
print_message "CURRENT IOSTAT" 1 60
iostat
}
get_vmstat(){
print_message "VMSTATS"
vmstat | awk ' END {print "No_process_waiting_for_CPU: " $1, "\nMemory_Idle: " $4, "\n\nSwapped_In_memory: " $9, "\nSwapped_Out_Memory: " $10, "\n\nCPU_time_runnning_user_code: " $15, "\nCPU_time_runnning_system_code: " $16, "\n\nInterupts_per_sec: " $13, "\nContext_switches_per_sec: " $14} '| column -t
}
get_simple_info(){
print_message "Simple INFO"
echo "No of cores": `nproc`
echo "Uptime"
w
}
get_max_thread_running_proc(){
print_message "Max thread Running process[3rd column is number of threads]"
ps axo pid,ppid,nlwp,cmd | sort -nr| head -n 5
}
get_highest_memory_proc(){
print_message "PROCESS WITH HIGEST MEMEORY" 30 70
ps aux| sort -rk 4,4 | head -n 5| awk '{print $2, $4, $11}'| column -t
}
get_highest_cpu_proc(){
print_message "PROCESS WITH HIGHEST CPU"
ps aux| sort -rk 3,3 | head -n 5| awk '{print $2, $3, $11}'| column -t
}
get_disk_states(){
print_message "DISK USAGE" 1 10
df -Th | sort -rk 6| head -n 3| column -t
}
get_help(){
printf "\n i: IOSTAT"
printf "\n d: DISK USAGE"
printf "\n s: Simple INFO"
printf "\n c: PROCESS WITH HIGHEST CPU"
printf "\n m: PROCESS WITH HIGEST MEMEORY"
printf "\n t: Max thread Running process"
printf "\n v: VMSTAT"
}
case $1 in
i)
get_iostat
;;
d)
get_disk_states
;;
s)
get_simple_info
;;
c)
get_highest_cpu_proc
;;
m)
get_highest_memory_proc
;;
t)
get_max_thread_running_proc
;;
v)
get_vmstat
;;
h)
get_help
;;
help)
get_help
;;
"")
get_iostat
get_vmstat
get_disk_states
get_simple_info
get_highest_memory_proc
get_highest_cpu_proc
get_max_thread_running_proc
;;
esac
printf "\n\n"