check filesystem more than 80% usage

etc/scripts

·

1 min read

  • outline

Usage management of Linux filesystem is very important. Below scripts is check filesystem more than 80% usage on Linux machine.

  • script
#!/bin/bash

host_list=(host1, host2)

for i in ${host_list[@]}
do
        v=$(ssh $i 'df -t xfs -t ext4 --output=target,pcent | egrep "([80][0-9]|[90][0-9]|100)%" | grep -v loop' 2>/dev/null )
        if [ $? == 0 ]; then
                echo -e $i, $v
        else echo pass
        fi
done
  • reference

ssh options
https://ktg0210.hashnode.dev/ssh-client