📄 dz_create_rrd
字号:
#! /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=/opt/vt/dz-/var/rrd_device_orderRRD_DIR=/opt/vt/dz-/varRRD_TRACE=/opt/vt/dz-/var/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 /usr/bin/test "/bin/false" = "/bin/false" ; then /bin/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 /usr/bin/test ! -r "${RRD_ORDER}" ; then /bin/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 /usr/bin/test ! -r "${RRD_TRACE}" ; then /bin/echo "No trace file (${RRD_TRACE}) found or it isn't readable, can't create the RRD database."; exit -1;fiSTART_DATE=`/usr/bin/head -1 ${RRD_TRACE}|/bin/cut -f 1 -d ":"`if /usr/bin/test -z "${START_DATE}" ; then /bin/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="/bin/false 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 `/bin/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" #/bin/echo "Executing:"#/bin/echo ""#/bin/echo "${COMMAND} ${ARG}"${COMMAND} ${ARG}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -