diff --git a/Makefile b/Makefile index 427ddf4..5bea792 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE = Probe VERSION = 0.0.0 -SUBDIRS = data src +SUBDIRS = data src tools RM = rm -f LN = ln -f TAR = tar -czvf @@ -29,6 +29,9 @@ dist: $(PACKAGE)-$(VERSION)/src/damon.c \ $(PACKAGE)-$(VERSION)/src/Makefile \ $(PACKAGE)-$(VERSION)/src/project.conf \ + $(PACKAGE)-$(VERSION)/tools/Makefile \ + $(PACKAGE)-$(VERSION)/tools/create.sh \ + $(PACKAGE)-$(VERSION)/tools/project.conf \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/COPYING \ $(PACKAGE)-$(VERSION)/config.h \ diff --git a/project.conf b/project.conf index 4a3d909..73afda7 100644 --- a/project.conf +++ b/project.conf @@ -2,5 +2,5 @@ package=Probe version=0.0.0 config=h -subdirs=data,src +subdirs=data,src,tools dist=Makefile,COPYING,config.h diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..7ae6224 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,13 @@ + + +all: + +clean: + +distclean: clean + +install: all + +uninstall: + +.PHONY: all clean distclean install uninstall diff --git a/tools/create.sh b/tools/create.sh new file mode 100755 index 0000000..2e3cd39 --- /dev/null +++ b/tools/create.sh @@ -0,0 +1,98 @@ +#/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 diff --git a/tools/project.conf b/tools/project.conf new file mode 100644 index 0000000..6932c00 --- /dev/null +++ b/tools/project.conf @@ -0,0 +1 @@ +dist=Makefile,create.sh