2024-04-18 08:15:36 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-10-20 09:54:28 +00:00
|
|
|
# Author: Ruben Blanco
|
2024-04-18 08:15:36 +00:00
|
|
|
|
|
|
|
mLine=`free | awk 'NR==2'`
|
|
|
|
mTotal=`echo $mLine| awk '{print $2}'`
|
|
|
|
mFree=`echo $mLine| awk '{print $4}'`
|
|
|
|
mUsed=`echo $mLine| awk '{print $3}'`
|
|
|
|
|
|
|
|
nagios_func(){
|
|
|
|
echo "$1 Memory Usage=$mUsed, From $mTotal | free_mem=$mFree;;; used_mem=$mUsed;4555555;9837470;";
|
|
|
|
}
|
|
|
|
|
|
|
|
nagios_unknown(){
|
|
|
|
echo "$1 No value as Argument";
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ "$#" -eq 0 ]]
|
|
|
|
then
|
|
|
|
nagios_unknown "UNKNOWN"; exit 3;
|
|
|
|
elif [[ $mUsed -gt $2 ]]
|
|
|
|
then
|
|
|
|
nagios_func "CRITICAL"; exit 2;
|
|
|
|
elif [[ $mUsed -gt $1 ]]
|
|
|
|
then
|
|
|
|
nagios_func "WARNING"; exit 1;
|
|
|
|
else
|
|
|
|
nagios_func "OK"; exit 0;
|
2024-10-20 09:54:28 +00:00
|
|
|
fi
|