diff --git a/backend/scripts/cpu.sh b/backend/scripts/cpu.sh new file mode 100644 index 0000000..a1b45b0 --- /dev/null +++ b/backend/scripts/cpu.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Returns CPU percentages of all machines in the cluster +# Example output: steffe3 3.5 + +parallel --nonall --slf /home/rock/macchine.txt top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | sed "s/^/100 - /" | bc diff --git a/backend/scripts/memory.sh b/backend/scripts/memory.sh new file mode 100644 index 0000000..779b90c --- /dev/null +++ b/backend/scripts/memory.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Returns used and total memory (in MB) of all machines in the cluster +# Example output: steffe1 141 3814 + +parallel --nonall --slf /home/rock/macchine.txt 'echo $HOSTNAME $(free -m | awk '\''/Mem/{print $3" "$2}'\'')' diff --git a/backend/scripts/network.sh b/backend/scripts/network.sh new file mode 100644 index 0000000..424315f --- /dev/null +++ b/backend/scripts/network.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Returns received and transmitted bytes of all machines in the cluster +# Example output: steffe14 3581663131 3305835017 + +parallel --nonall --slf /home/rock/macchine.txt 'echo $HOSTNAME $(cat /sys/class/net/[e]*/statistics/{r,t}x_bytes)' diff --git a/backend/scripts/storage.sh b/backend/scripts/storage.sh new file mode 100644 index 0000000..d29397f --- /dev/null +++ b/backend/scripts/storage.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Returns used and free disk space of all machines in the cluster +# Example output: steffe8 9.2G 47G + +parallel --nonall --slf /home/rock/macchine.txt 'echo $HOSTNAME $(df -Ph | grep mmcblk0p5 | awk '\''{print $3" "$4}'\'')' diff --git a/backend/scripts/uptime.sh b/backend/scripts/uptime.sh new file mode 100644 index 0000000..68ca2df --- /dev/null +++ b/backend/scripts/uptime.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Returns Unix uptime, in seconds, of all machines in the cluster +# Example output: steffe1 1656959 + +parallel --nonall --slf /home/rock/macchine.txt 'echo $HOSTNAME $(cut -f1 -d. /proc/uptime)'