#/bin/sh #$Id$ #Copyright (c) 2009 Pierre Pronchery */ #This file is part of DeforaOS Network Probe */ #Probe is not free software; you can redistribute it and/or modify it under #the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 #Unported as published by the Creative Commons organization. # #Probe is distributed in the hope that it will be useful, but WITHOUT ANY #WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR #A PARTICULAR PURPOSE. See the Creative Commons Attribution-NonCommercial- #ShareAlike 3.0 Unported license for more details. # #You should have received a copy of the Creative Commons Attribution- #NonCommercial-ShareAlike 3.0 along with Probe; if not, browse to #http://creativecommons.org/licenses/by-nc-sa/3.0/ #functions #create create() { mkdir -p "$i" rrdtool create "$i/uptime.rrd" --start "`date +%s`" \ --step 10 \ DS:uptime:GAUGE:120:0:U \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/load.rrd" --start "`date +%s`" \ --step 10 \ DS:load1:GAUGE:30:0:U \ DS:load5:GAUGE:30:0:U \ DS:load15:GAUGE:30:0:U \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/ram.rrd" --start "`date +%s`" \ --step 10 \ DS:ramtotal:GAUGE:30:0:U \ DS:ramfree:GAUGE:30:0:U \ DS:ramshared:GAUGE:30:0:U \ DS:rambuffer:GAUGE:30:0:U \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/swap.rrd" --start "`date +%s`" \ --step 10 \ DS:swaptotal:GAUGE:30:0:U \ DS:swapfree:GAUGE:30:0:U \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/users.rrd" --start "`date +%s`" \ --step 10 \ DS:users:GAUGE:30:0:65536 \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/procs.rrd" --start "`date +%s`" \ --step 10 \ DS:procs:GAUGE:30:0:65536 \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 rrdtool create "$i/eth0.rrd" --start "`date +%s`" \ --step 10 \ DS:ifrxbytes:COUNTER:30:0:U \ DS:iftxbytes:COUNTER:30:0:U \ RRA:AVERAGE:0.5:1:360 \ RRA:AVERAGE:0.5:24:360 \ RRA:AVERAGE:0.5:168:360 } #usage usage() { echo "Usage: create.sh host..." 1>&2 return 1; } #main if [ $# -lt 1 ]; then usage exit $? fi for i in $@; do create "$i" done