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 [ $PCP_VER -ge 30801 ] || _notrun libpcp_import fix is
in PCP
3.8.1
19 [ -f ${PCP_LIB_DIR}/libpcp_import.
${DSO_SUFFIX} ] || \
20 _notrun
"No support for libpcp_import"
21 perl
-e "use PCP::LogImport" 2>/dev
/null || \
22 _notrun
"Perl PCP::LogImport module is not installed"
31 status
=1 # failure is the default!
32 $sudo rm -rf $tmp.
* $seq.full
33 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
37 cat <<'End-of-File' >$tmp.gfs_inodes.csv
38 Date,Time,Device,inodes
39 2013-04-18,13:40,/dev/dm-12,102808
40 2013-04-18,13:45,/dev/dm-12,102798
41 2013-04-18,13:50,/dev/dm-12,102799
42 2013-04-18,13:55,/dev/dm-12,102808
43 2013-04-18,14:00,/dev/dm-12,102804
44 2013-04-18,14:05,/dev/dm-12,103182
45 2013-04-18,14:10,/dev/dm-12,102864
46 2013-04-18,14:15,/dev/dm-12,102810
47 2013-04-18,14:20,/dev/dm-12,102805
52 cat <<'End-of-File' >$tmp.gfs_metadata.csv
54 2013-04-18,13:40,/dev/dm-12,3712689
55 2013-04-18,13:45,/dev/dm-12,3712699
56 2013-04-18,13:50,/dev/dm-12,3712698
57 2013-04-18,13:55,/dev/dm-12,3712689
58 2013-04-18,14:00,/dev/dm-12,3712693
59 2013-04-18,14:05,/dev/dm-12,3712273
60 2013-04-18,14:10,/dev/dm-12,3712349
61 2013-04-18,14:15,/dev/dm-12,3711980
62 2013-04-18,14:20,/dev/dm-12,3711842
67 cat <<'End-of-File' >$tmp.pl
77 echo "pmiStart(\"$tmp.gfs\", 0);" >>$tmp.pl
78 cat <<'End-of-File' >>$tmp.pl
79 $_ = pmiSetTimezone('UTC');
80 $_ == 0 || die "pmiSetTimezone(UTC): " . pmiErrStr($_);
82 $_ = pmiAddMetric("gfs.inodes",
83 PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
84 PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
85 $_ == 0 || die "pmiAddMetric(gfs.inodes): " . pmiErrStr($_);
89 echo "open(INFILE, \"<$tmp.gfs_inodes.csv\");" >>$tmp.pl
90 cat <<'End-of-File' >>$tmp.pl
94 my @part = split(/,/, $_);
96 $_ = pmiPutValue("gfs.inodes", "", $part[3]);
97 $_ == 0 || die "pmiPutValue(gfs.inodes): " . pmiErrStr($_);
99 $_ = pmiWrite(str2time($part[0] . "T" . $part[1] . ":00", 'UTC'), 0);
100 $_ == 0 || die "pmiWrite(gfs.fmb): " . pmiErrStr($_);
105 $_ = pmiAddMetric("gfs.fmb",
106 PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
107 PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
108 $_ == 0 || die "pmiAddMetric(gfs.fmb): " . pmiErrStr($_);
111 echo "open(INFILE, \"<$tmp.gfs_metadata.csv\");" >>$tmp.pl
112 cat <<'End-of-File' >>$tmp.pl
116 my @part = split(/,/, $_);
118 $_ = pmiPutValue("gfs.fmb", "", $part[3]);
119 $_ == 0 || die "pmiPutValue(gfs.fmb): " . pmiErrStr($_);
121 $_ = pmiWrite(str2time($part[0] . "T" . $part[1] . ":00", 'UTC'), 0);
122 $_ == 0 || die "pmiWrite(gfs.fmb): " . pmiErrStr($_);
130 # real QA test starts here
131 perl
$tmp.pl
2>&1 | _filter
133 for part
in 0 meta index
135 [ -f $tmp.
$part ] && echo "oops, .$part file created"