#!/bin/bash
# runs every 2 minutes

echo "$( date ) monitor run5"

# log the busiest processes, for trouble shooting
echo "----------- $(date) --------------------------------------------" >>/tmp/processes.log
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -5 >>/tmp/processes.log

# check the most relevant services:
# ./checkProcesses

# all this is started from cron, met HOME folder -> the root of this project
cd monitor >/dev/null 2>&1 # this only works if we start it from CRON, else ignored

# monitorTop.sh
df | ./monitorDisks.py
free | ./monitorMem.py
# top -b -n 5 -p0 | tail -9 | ./monitorTop.py
uptime | ./monitorLoad.py
tail -5 /tmp/mpstat.log | grep all | tail -1 | ./monitorCpu.py

./monitorNet.sh &

./createGraphs 3h

