[UPDATE] Add script sonde
This commit is contained in:
parent
c69661a84f
commit
ff1c26d7fb
@ -43,7 +43,9 @@ Actual :
|
|||||||
|
|
||||||
**file-present.sh** : check if a file (abosult path) is persent
|
**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
|
### tree
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
18
monithor-server/usr/local/bin/monithor-server.d/part-space.sh
Executable file
18
monithor-server/usr/local/bin/monithor-server.d/part-space.sh
Executable file
@ -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}"
|
||||||
11
monithor-server/usr/local/bin/monithor-server.d/process-present.sh
Executable file
11
monithor-server/usr/local/bin/monithor-server.d/process-present.sh
Executable file
@ -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"
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user