#!/bin/bash RRDTOOL=/usr/bin/rrdtool RRDDIR=/var/lib/rrdtool function create_database(){ rrdtool create $RRDDIR/$1 \ DS:in:DERIVE:600:0:U \ DS:out:DERIVE:600:0:U \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 \ RRA:MAX:0.5:24:775 \ RRA:MAX:0.5:288:797 \ RRA:MIN:0.5:1:600 \ RRA:MIN:0.5:6:700 \ RRA:MIN:0.5:24:775 \ RRA:MIN:0.5:288:797 \ RRA:LAST:0.5:1:600 \ RRA:LAST:0.5:6:700 \ RRA:LAST:0.5:24:775 \ RRA:LAST:0.5:288:797 } function u_int32_to_ip() { ip1=$((($1 >> 24) & 0xff)) ip2=$((($1 >> 16) & 0xff)) ip3=$((($1 >> 8) & 0xff)) ip4=$(($1 & 0xff)) echo -n "${ip1}.${ip2}.${ip3}.${ip4}" } # adres poczatkowy: 192.168.0.0 ip_begin=$((192 << 24 | 168 << 16 | 0 << 8 | 0)) # adres końcowy 192.168.0.255 ip_end=$((192 << 24 | 168<< 16 | 0 << 8 | 255)) for (( ip = ip_begin ; ip <= ip_end ; ip++ )); do ip_text=$( u_int32_to_ip ${ip} ) create_database bits-${ip_text}.rrd done exit 0