📄 dz_rotate_rrd.in
字号:
#! @PERL@# $Id: dz_rotate_rrd.in,v 1.2 2004/02/29 18:16:44 vtt Exp $# This script rotates the RRD database.# These values are set forth by configure script.$RRD_DIR = "@RRD_DIR@";$RRD = "${RRD_DIR}/dz.rrd";# There'll be 20 copies by default - this will take a lot of space, however,# if you remember for a second that one RRD holds up to 3 years of data and# there's no backup (except for trace file, which may or may not exist), and# the network can easily accomodate more than 20 sensors, with late# additions likely to happen when some data is already in the RRD, this will# not seem excessive. All in all, you can delete extra RRDs manually, if you# want.$max_copies = 20;&rotate($RRD, 0);exit 0;sub rotate { my ( $target, $offset ) = @_; my $suffix = ".$offset"; my $next_suffix = ".".($offset + 1); if ( $suffix eq ".0" ) { $suffix = ""; } # If my copy doesn't exist, I just return unless ( -e "$RRD$suffix" ) { # print "$RRD$suffix doesn't exist, done\n"; return; } if ( (-e "$RRD$next_suffix") && ($offset < ($max_copies - 1)) ) { # Next one exists, and it is within numbers &rotate($RRD, $offset + 1); } # Now that the next copy is out of the way, let's move them rename("$RRD$suffix", "$RRD$next_suffix");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -