#!/bin/bash # this script is started: # - manual, from the monitor folder # - cronwise, from the project-HOME folder # usage: # ./createGraphs 1d # or 1h or 2w or 1y cd /opt/Monitor/fw # the output of this script can only be visualized under a webserver FOLDER='/var/www/suy.nl/m' function makegraphs { P=${1} rrdtool graph ${FOLDER}/${P}/ssh-auth.png \ --title "SSH attacks, last ${P}" \ --width 640 \ --height 240 \ --start -${P} \ --watermark "$(date)" \ --vertical-label 'Count' \ DEF:r0=auth.rrd:walled:AVERAGE \ AREA:r0#EB984E:"FW-walled" \ DEF:r1=auth.rrd:ssh:AVERAGE \ AREA:r1#F7DC6F:”SSH-walled” \ DEF:r3=auth.rrd:denied:AVERAGE \ LINE2:r3#FF0000:”FW-denied” rrdtool graph ${FOLDER}/${P}/services-auth.png \ --title "Service attacks, last ${P}" \ --width 640 \ --height 240 \ --upper-limit 5 \ --lower-limit 0 \ --start -${P} \ --vertical-label 'Count' \ --watermark "$(date)" \ DEF:r3=auth.rrd:other:AVERAGE \ AREA:r3#AAAAAA:”Others” \ DEF:r0=auth.rrd:flowers:AVERAGE \ AREA:r0#FFA500:"Flowers" \ DEF:r1=auth.rrd:gitea:AVERAGE \ STACK:r1#0000FF:”Gitea” \ DEF:r2=auth.rrd:cloud:AVERAGE \ STACK:r2#FF0000:”Cloud” } for var in "$@" do makegraphs "$var" done