diff --git a/README.md b/README.md index ef9efc6..243d6e1 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,9 @@ Actual : **file-present.sh** : check if a file (abosult path) is persent -** +**part-space.sh** : check the partition % (arg are : PATH|Min%|Max% ex : /home/isen|50|80) + +**process-present.sh** : check if a process is running ### tree diff --git a/debs/monithor-client_1.0-0_noarch.deb b/debs/monithor-client_1.0-0_noarch.deb deleted file mode 100644 index ff44d7c..0000000 Binary files a/debs/monithor-client_1.0-0_noarch.deb and /dev/null differ diff --git a/debs/monithor-server_1.0-0_noarch.deb b/debs/monithor-server_1.0-0_noarch.deb deleted file mode 100644 index 7676284..0000000 Binary files a/debs/monithor-server_1.0-0_noarch.deb and /dev/null differ diff --git a/monithor-server/usr/local/bin/monithor-server.d/part-space.sh b/monithor-server/usr/local/bin/monithor-server.d/part-space.sh new file mode 100755 index 0000000..04c18b0 --- /dev/null +++ b/monithor-server/usr/local/bin/monithor-server.d/part-space.sh @@ -0,0 +1,18 @@ +#!/bin/bash + + +source $(dirname $0)/FunctionOutput + +Part="$(echo $1 | cut -d"|" -f1)" +Min="$(echo $1 | cut -d"|" -f2)" +Max="$(echo $1 | cut -d"|" -f3)" + +[[ -z ${Part} ]] && Exit "5|no argument" +[[ ! -d ${Part} ]] && Exit "2|Part $Part don't exist" +[[ -z $(mount | grep -w ${Part}) ]] && Exit "2|$Part is not a partition" + +Size=$(df -h ${Part} | grep -v Filesystem | awk '{print $5}' | sed "s#%##g") + +[[ ${Size} -lt ${Min} ]] && Exit "0|Part $Part is under ${Min}% : ${Size}" +[[ ${Size} -gt ${Max} ]] && Exit "2|Part $Part is over ${Max}% : ${Size}" +[[ ${Size} -gt ${Min} ]] && Exit "1|Part $Part is between ${Min}% and ${Max}% : ${Size}" diff --git a/monithor-server/usr/local/bin/monithor-server.d/process-present.sh b/monithor-server/usr/local/bin/monithor-server.d/process-present.sh new file mode 100755 index 0000000..1bb82bc --- /dev/null +++ b/monithor-server/usr/local/bin/monithor-server.d/process-present.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + +source $(dirname $0)/FunctionOutput + +Process="${1}" + +[[ -z ${Process} ]] && Exit "5|no argument" + +[[ ! -z $(ps axf | grep ${Process}| grep -v grep) ]] && Exit "0|Process $Process is running" || Exit "2|Process $Process is NOT running" +