📄 dz_create_rrd.in
字号:
#! /bin/sh# $Id: dz_create_rrd.in,v 1.2 2004/02/29 18:16:44 vtt Exp $# This script takes creates an RRD database according to a given order,# taken from a device order file, ${RRD_ORDER}. The database will be created# in ${RRD_DIR}. Starting time for the database will be taken from the data# in ${RRD_TRACE}.# These values are set forth by configure script.RRD_ORDER=@RRD_ORDER@RRD_DIR=@RRD_DIR@RRD_TRACE=@RRD_DIR@/traceRRD=${RRD_DIR}/dz.rrd# VT: NOTE: Of course, I could've provided different exit code for each# case, but who really cares?# Let's see if we have the rrdtoolif @TEST@ "@RRDTOOL@" = "/bin/false" ; then @ECHO@ "Sorry, you don't have rrdtool - install it and/or rerun configure"; exit -1;fi# If the order file doesn't exist, then you know whatif @TEST@ ! -r "${RRD_ORDER}" ; then @ECHO@ "No order file (${RRD_ORDER}) found or it isn't readable, can't create the RRD database."; exit -1;fi# Let's figure out the start date for the database. If the trace file# doesn't exist, then we won't bother. Otherwise, the time of the first# record in the trace file will be set as the start date for the database.if @TEST@ ! -r "${RRD_TRACE}" ; then @ECHO@ "No trace file (${RRD_TRACE}) found or it isn't readable, can't create the RRD database."; exit -1;fiSTART_DATE=`@HEAD@ -1 ${RRD_TRACE}|@CUT@ -f 1 -d ":"`if @TEST@ -z "${START_DATE}" ; then @ECHO@ "Can't get start date from ${RRD_TRACE}, it looks funny"; exit -1;fi# Adjust the start time so the first entry is not discarded - RRD doesn't# like the entry with the same timestamp as the database start timeSTART_DATE=$((${START_DATE}-10))COMMAND="@RRDTOOL@ create ${RRD} --start ${START_DATE} --step 30 ";# Let's put together the argument list nowARG=""# VT: Don't ask me about these numbers, I don't rememberfor DEVICE in `@CAT@ ${RRD_ORDER}` ; do ARG="${ARG} DS:${DEVICE}:GAUGE:90:0:50"doneARG="${ARG} \RRA:LAST:0.5:1:5760 \RRA:MAX:0.5:1:5760 \RRA:MIN:0.5:1:5760 \RRA:AVERAGE:0.5:5:13824 \RRA:MAX:0.5:5:13824 \RRA:MIN:0.5:5:13824 \RRA:AVERAGE:0.5:60:16704 \RRA:MAX:0.5:60:16704 \RRA:MIN:0.5:60:16704 \RRA:AVERAGE:0.5:1440:50000 \RRA:MAX:0.5:1440:50000 \RRA:MIN:0.5:1440:50000" #@ECHO@ "Executing:"#@ECHO@ ""#@ECHO@ "${COMMAND} ${ARG}"${COMMAND} ${ARG}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -