low overhead monitoring system

experiments linux monitoring

With just the sysstats we can monitor and build a static web page containing a svg without installing anything else.


#!/bin/bash - 
#===============================================================================
#
#          FILE: sadf.sh
# 
#         USAGE: ./sadf.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR:  Max , 
#  ORGANIZATION: Max @ MRS
#       CREATED: 24/02/18 13:15:33
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error
sadf -g  /var/log/sysstat/sa`date +%d` -O showinfo,skipempty -T  -- -r -w - -q   -dp --dev=sda -S -n DEV -n EDEV -P all -m CPU,FREQ,TEMP,IN |sed  -e s/"text x"/"text font-family='Noto Sans' x"/ -e s/"2: coretemp-isa-0000"/AVG/ -e s/"3: coretemp-isa-0000"/"CPU 1"/  -e s/"4: coretemp-isa-0000"/"CPU 2"/  -e s/"5: coretemp-isa-0000"/"CPU 3"/ -e s/"6: coretemp-isa-0000"/"CPU 4"/ -e s/'x= "0"'/'x="250"'/ -e s/'stroke="brown"'/'style="fill: darkorange; stroke: none; font-weight: bold;"'/  > /media/sda2/monitoring/zbox_`date +%y%m%d`.svg

cat /media/sda2/monitoring/index.html | sed -e s/XXX/"`date +%y%m%d`"/ > /media/sda2/monitoring/index.htm
sync

curl --key ~/.ssh/id_ecdsa -k  -T "/media/sda2/monitoring/index.htm"  sftp://xxxx  -u user:passwd