Added a script to generate the RRD databases

This commit is contained in:
Pierre Pronchery 2009-11-23 23:19:46 +00:00
parent 0345228d19
commit 0ec1dd194e
5 changed files with 117 additions and 2 deletions

View File

@ -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 \

View File

@ -2,5 +2,5 @@ package=Probe
version=0.0.0
config=h
subdirs=data,src
subdirs=data,src,tools
dist=Makefile,COPYING,config.h

13
tools/Makefile Normal file
View File

@ -0,0 +1,13 @@
all:
clean:
distclean: clean
install: all
uninstall:
.PHONY: all clean distclean install uninstall

98
tools/create.sh Executable file
View File

@ -0,0 +1,98 @@
#/bin/sh
#$Id$
#Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
#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

1
tools/project.conf Normal file
View File

@ -0,0 +1 @@
dist=Makefile,create.sh