3 # Check that timestamps are monotonic increasing for archives
4 # created by libpcp_import. Based on
5 # https://bugzilla.redhat.com/show_bug.cgi?id=958745
7 # Copyright (c) 2013 Red Hat, Inc. and Ken McDonell. All Rights Reserved.
11 echo "QA output created by $seq"
13 # get standard environment, filters and checks
18 [ -f ${PCP_LIB_DIR}/libpcp_import.
${DSO_SUFFIX} ] || \
19 _notrun
"No support for libpcp_import"
20 perl
-e "use PCP::LogImport" 2>/dev
/null || \
21 _notrun
"Perl PCP::LogImport module is not installed"
26 # make deterministic tmp file names
27 # dodge buglet in die() line# handling for some perl versions
30 -e "s;line 0\.000.*$;line 2.;g" \
31 -e "s;line NaN\.$;line 2.;g" \
35 status
=1 # failure is the default!
36 $sudo rm -rf $tmp.
* $seq.full
37 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
41 cat <<'End-of-File' >$tmp.gfs_inodes.csv
42 Date,Time,Device,inodes
43 2013-04-18,13:40,/dev/dm-12,102808
44 2013-04-18,13:45,/dev/dm-12,102798
45 2013-04-18,13:50,/dev/dm-12,102799
46 2013-04-18,13:55,/dev/dm-12,102808
47 2013-04-18,14:00,/dev/dm-12,102804
48 2013-04-18,14:05,/dev/dm-12,103182
49 2013-04-18,14:10,/dev/dm-12,102864
50 2013-04-18,14:15,/dev/dm-12,102810
51 2013-04-18,14:20,/dev/dm-12,102805
56 cat <<'End-of-File' >$tmp.gfs_metadata.csv
58 2013-04-18,13:40,/dev/dm-12,3712689
59 2013-04-18,13:45,/dev/dm-12,3712699
60 2013-04-18,13:50,/dev/dm-12,3712698
61 2013-04-18,13:55,/dev/dm-12,3712689
62 2013-04-18,14:00,/dev/dm-12,3712693
63 2013-04-18,14:05,/dev/dm-12,3712273
64 2013-04-18,14:10,/dev/dm-12,3712349
65 2013-04-18,14:15,/dev/dm-12,3711980
66 2013-04-18,14:20,/dev/dm-12,3711842
71 cat <<'End-of-File' >$tmp.pl
81 echo "pmiStart(\"$tmp.gfs\", 0);" >>$tmp.pl
82 cat <<'End-of-File' >>$tmp.pl
83 $_ = pmiSetTimezone('UTC');
84 $_ == 0 || die "pmiSetTimezone(UTC): " . pmiErrStr($_);
86 $_ = pmiAddMetric("gfs.inodes",
87 PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
88 PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
89 $_ == 0 || die "pmiAddMetric(gfs.inodes): " . pmiErrStr($_);
93 echo "open(INFILE, \"<$tmp.gfs_inodes.csv\");" >>$tmp.pl
94 cat <<'End-of-File' >>$tmp.pl
98 my @part = split(/,/, $_);
100 $_ = pmiPutValue("gfs.inodes", "", $part[3]);
101 $_ == 0 || die "pmiPutValue(gfs.inodes): " . pmiErrStr($_);
103 $_ = pmiWrite(str2time($part[0] . "T" . $part[1] . ":00", 'UTC'), 0);
104 $_ == 0 || die "pmiWrite(gfs.fmb): " . pmiErrStr($_);
109 $_ = pmiAddMetric("gfs.fmb",
110 PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
111 PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
112 $_ == 0 || die "pmiAddMetric(gfs.fmb): " . pmiErrStr($_);
115 echo "open(INFILE, \"<$tmp.gfs_metadata.csv\");" >>$tmp.pl
116 cat <<'End-of-File' >>$tmp.pl
120 my @part = split(/,/, $_);
122 $_ = pmiPutValue("gfs.fmb", "", $part[3]);
123 $_ == 0 || die "pmiPutValue(gfs.fmb): " . pmiErrStr($_);
125 $_ = pmiWrite(str2time($part[0] . "T" . $part[1] . ":00", 'UTC'), 0);
126 $_ == 0 || die "pmiWrite(gfs.fmb): " . pmiErrStr($_);
134 # real QA test starts here
135 perl
$tmp.pl
2>&1 | _filter
137 for part
in 0 meta index
139 [ -f $tmp.
$part ] && echo "oops, .$part file created"