2021-11-04 18:19:45
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2021/11/04 12:36:53 by gbaconni #+# #+# #
|
||||
# Updated: 2021/11/04 17:48:10 by gbaconni ### lausanne.ch #
|
||||
# Updated: 2021/11/04 18:19:42 by gbaconni ### lausanne.ch #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@@ -25,18 +25,18 @@ ft_cpu ()
|
||||
|
||||
ft_memory ()
|
||||
{
|
||||
free -m | awk '/Mem:/ { total=$2; used=total-$3; } END { printf "#Memory Usage: %d/%dMB (%.2f%%)\n", used, total, (used * 100) / total; }'
|
||||
free -m | awk '/Mem:/ { total=$2; used=$3; } END { printf "#Memory Usage: %d/%dMB (%.2f%%)\n", used, total, used / total * 100; }'
|
||||
}
|
||||
|
||||
ft_disk ()
|
||||
{
|
||||
df --total -l -t ext2 -t ext3 -t ext4 -t xfs \
|
||||
| awk '/^total/ { total=$2; used=$3; pcent=$4 } END { printf "#Disk Usage: %d/%dGb (%.2f%%)\n", used * 8, (total * 8) / (1000 * 1000 * 1000), pcent; }'
|
||||
df --total -Bm -T -l -x tmpfs -x devtmpfs | \
|
||||
| awk '/^total/ { total=int($3); used=int($4); pcent=int($6) } END { printf "#Disk Usage: %d/%dGb (%.2f%%)\n", used, total / 1000, pcent; }'
|
||||
}
|
||||
|
||||
ft_load ()
|
||||
{
|
||||
top -b -n 2 -d 0.1 | awk '/^%Cpu/ { usage=$2+$4+$6+$10+$12+$14+$16; } END {printf "#CPU load: %d%%\n", usage; }'
|
||||
top -b -n 1 | awk '/^%Cpu/ { usage=$2+$4; } END {printf "#CPU load: %d%%\n", usage; }'
|
||||
}
|
||||
|
||||
ft_lastboot ()
|
||||
@@ -68,7 +68,7 @@ ft_network ()
|
||||
|
||||
ft_sudo ()
|
||||
{
|
||||
count=$(find /var/log/sudo -type f -name log | wc -l)
|
||||
count=$(journal _COMM=sudo | grep -c COMMAND)
|
||||
echo "#Sudo : ${count} cmd"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user