33 lines
714 B
Plaintext
33 lines
714 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
###########################
|
||
|
# Estado: Ok #
|
||
|
# Author: Rubenb #
|
||
|
# Fecha: 04/01/2024 #
|
||
|
###########################
|
||
|
|
||
|
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;
|
||
|
fi
|