summaryrefslogtreecommitdiff
path: root/man/html/importdata
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
commit47e6e7c84f008a53061e661f31ae96629bc694ef (patch)
tree648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /man/html/importdata
downloadpcp-debian.tar.gz
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'man/html/importdata')
-rw-r--r--man/html/importdata/GNUmakefile20
-rw-r--r--man/html/importdata/README9
-rwxr-xr-xman/html/importdata/mk.mover.log35
-rw-r--r--man/html/importdata/mover.log161
-rwxr-xr-xman/html/importdata/mover2pcp277
-rwxr-xr-xman/html/importdata/moverv126
-rwxr-xr-xman/html/importdata/moverv229
-rwxr-xr-xman/html/importdata/moverv340
-rwxr-xr-xman/html/importdata/moverv454
9 files changed, 651 insertions, 0 deletions
diff --git a/man/html/importdata/GNUmakefile b/man/html/importdata/GNUmakefile
new file mode 100644
index 0000000..2fa2570
--- /dev/null
+++ b/man/html/importdata/GNUmakefile
@@ -0,0 +1,20 @@
+TOPDIR = ../../..
+include $(TOPDIR)/src/include/builddefs
+
+BUNDLE = importdata
+SCRIPT = mover2pcp
+LSRCFILES = $(SCRIPT) \
+ README moverv1 moverv2 moverv3 moverv4 \
+ mk.mover.log mover.log
+
+default:
+
+include $(BUILDRULES)
+
+install install-dev: default
+ $(INSTALL) -m 755 -d $(PCP_BOOKS_DIR)/html/$(BUNDLE)
+ $(INSTALL) -m 644 $(SCRIPT) $(PCP_BOOKS_DIR)/html/$(BUNDLE)/$(SCRIPT)
+
+default_pcp : default
+
+install_pcp : install
diff --git a/man/html/importdata/README b/man/html/importdata/README
new file mode 100644
index 0000000..befc9e2
--- /dev/null
+++ b/man/html/importdata/README
@@ -0,0 +1,9 @@
+mover2pcp - example used in lab.importdata.html in pcp-doc
+
+ mover.log - sample log file
+ mk.mover.log - script to create fake mover.log
+ moverv1 - minimalist version 1
+ moverv2 - minimalist version 2
+ moverv3 - minimalist version 3
+ moverv4 - minimalist version 4
+ mover2pcp - final script
diff --git a/man/html/importdata/mk.mover.log b/man/html/importdata/mk.mover.log
new file mode 100755
index 0000000..0d182d6
--- /dev/null
+++ b/man/html/importdata/mk.mover.log
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Generate a mover.log to be used with mover2pcp
+#
+
+find $HOME -type f \
+| sed -e 5000q \
+| while read f
+do
+ stat --format="%n %s" "$f"
+done \
+| awk '
+BEGIN { now = systime(); start = now - 30*24*3600
+ maxbatch = 60;
+ want = int(rand()*maxbatch);
+ n = c[0] = c[1] = c[2] = max_b = b = 0
+ }
+ #debug# { print }
+ { want--;
+ if (want < 0) {
+ if (rand() < 0.15) {
+ # 15% of the time, output a no activity line
+ n = c[0] = c[1] = c[2] = max_b = b = 0
+ }
+ printf "%s %d files (%d, %d, %d) %d bytes (%d)\n", strftime("%Y-%m-%d %H:%M:%S", start), n, c[0], c[1], c[2], b, max_b
+ start += 30;
+ want = int(rand()*maxbatch);
+ n = c[0] = c[1] = c[2] = max_b = b = 0
+ }
+ n++; b += $2
+ if ($2 <= 1024) c[0]++
+ else if ($2 <= 1024*1024) c[1]++
+ else c[2]++
+ if ($2 > max_b) max_b = $2
+ }'
diff --git a/man/html/importdata/mover.log b/man/html/importdata/mover.log
new file mode 100644
index 0000000..70700cd
--- /dev/null
+++ b/man/html/importdata/mover.log
@@ -0,0 +1,161 @@
+2010-07-04 13:46:29 14 files (6, 8, 0) 142512 bytes (92098)
+2010-07-04 13:46:59 51 files (28, 23, 0) 132761 bytes (33239)
+2010-07-04 13:47:29 36 files (23, 12, 1) 5733152 bytes (5688400)
+2010-07-04 13:47:59 49 files (40, 9, 0) 118418 bytes (70669)
+2010-07-04 13:48:29 30 files (7, 23, 0) 210531 bytes (52261)
+2010-07-04 13:48:59 23 files (6, 17, 0) 81048 bytes (15175)
+2010-07-04 13:49:29 55 files (31, 24, 0) 190841 bytes (27908)
+2010-07-04 13:49:59 54 files (49, 5, 0) 14078 bytes (1213)
+2010-07-04 13:50:29 38 files (19, 19, 0) 82398 bytes (16781)
+2010-07-04 13:50:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 13:51:29 31 files (8, 23, 0) 202755 bytes (41984)
+2010-07-04 13:51:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 13:52:29 7 files (4, 3, 0) 15954 bytes (8789)
+2010-07-04 13:52:59 1 files (1, 0, 0) 719 bytes (719)
+2010-07-04 13:53:29 7 files (2, 5, 0) 28976 bytes (10804)
+2010-07-04 13:53:59 16 files (5, 11, 0) 619501 bytes (471054)
+2010-07-04 13:54:29 54 files (24, 28, 2) 4097068 bytes (1451420)
+2010-07-04 13:54:59 44 files (11, 33, 0) 280558 bytes (35925)
+2010-07-04 13:55:29 56 files (16, 40, 0) 209611 bytes (27890)
+2010-07-04 13:55:59 54 files (13, 41, 0) 265851 bytes (23801)
+2010-07-04 13:56:29 20 files (5, 15, 0) 63906 bytes (21526)
+2010-07-04 13:56:59 60 files (19, 41, 0) 149357 bytes (59852)
+2010-07-04 13:57:29 43 files (13, 30, 0) 204814 bytes (105994)
+2010-07-04 13:57:59 57 files (20, 37, 0) 257186 bytes (30296)
+2010-07-04 13:58:29 7 files (2, 5, 0) 47402 bytes (28647)
+2010-07-04 13:58:59 34 files (17, 17, 0) 110547 bytes (43668)
+2010-07-04 13:59:29 5 files (0, 5, 0) 16039 bytes (5628)
+2010-07-04 13:59:59 12 files (1, 11, 0) 92010 bytes (19725)
+2010-07-04 14:00:29 39 files (11, 28, 0) 224461 bytes (78750)
+2010-07-04 14:00:59 3 files (1, 2, 0) 3257 bytes (2123)
+2010-07-04 14:01:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:01:59 10 files (3, 7, 0) 22664 bytes (8319)
+2010-07-04 14:02:29 42 files (15, 27, 0) 158907 bytes (63403)
+2010-07-04 14:02:59 42 files (14, 28, 0) 179235 bytes (45308)
+2010-07-04 14:03:29 28 files (4, 24, 0) 89672 bytes (21398)
+2010-07-04 14:03:59 28 files (3, 25, 0) 410717 bytes (221626)
+2010-07-04 14:04:29 6 files (0, 6, 0) 20810 bytes (5443)
+2010-07-04 14:04:59 57 files (8, 49, 0) 242260 bytes (40168)
+2010-07-04 14:05:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:05:59 15 files (6, 9, 0) 61522 bytes (14739)
+2010-07-04 14:06:29 27 files (11, 16, 0) 146905 bytes (86884)
+2010-07-04 14:06:59 53 files (16, 37, 0) 272658 bytes (103530)
+2010-07-04 14:07:29 57 files (1, 56, 0) 672539 bytes (66131)
+2010-07-04 14:07:59 51 files (24, 27, 0) 197605 bytes (48368)
+2010-07-04 14:08:29 36 files (23, 13, 0) 220569 bytes (53235)
+2010-07-04 14:08:59 20 files (0, 20, 0) 141069 bytes (31880)
+2010-07-04 14:09:29 55 files (1, 54, 0) 335190 bytes (30038)
+2010-07-04 14:09:59 51 files (0, 51, 0) 189665 bytes (17426)
+2010-07-04 14:10:29 30 files (0, 30, 0) 126407 bytes (16961)
+2010-07-04 14:10:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:11:29 26 files (3, 23, 0) 440333 bytes (295831)
+2010-07-04 14:11:59 7 files (6, 1, 0) 5362 bytes (2892)
+2010-07-04 14:12:29 38 files (25, 13, 0) 83338 bytes (19874)
+2010-07-04 14:12:59 47 files (21, 26, 0) 146862 bytes (21194)
+2010-07-04 14:13:29 60 files (35, 25, 0) 110686 bytes (30581)
+2010-07-04 14:13:59 39 files (19, 20, 0) 75524 bytes (13688)
+2010-07-04 14:14:29 58 files (36, 22, 0) 158258 bytes (33037)
+2010-07-04 14:14:59 14 files (2, 11, 1) 6739584 bytes (4808802)
+2010-07-04 14:15:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:15:59 17 files (8, 9, 0) 35206 bytes (12257)
+2010-07-04 14:16:29 23 files (11, 12, 0) 82701 bytes (27815)
+2010-07-04 14:16:59 53 files (31, 22, 0) 83209 bytes (13686)
+2010-07-04 14:17:29 60 files (35, 25, 0) 125315 bytes (21077)
+2010-07-04 14:17:59 33 files (20, 13, 0) 41639 bytes (9772)
+2010-07-04 14:18:29 47 files (29, 18, 0) 91435 bytes (21920)
+2010-07-04 14:18:59 44 files (28, 16, 0) 88960 bytes (21124)
+2010-07-04 14:19:29 29 files (22, 7, 0) 67806 bytes (22687)
+2010-07-04 14:19:59 52 files (35, 17, 0) 48792 bytes (6431)
+2010-07-04 14:20:29 24 files (16, 8, 0) 64065 bytes (30170)
+2010-07-04 14:20:59 13 files (8, 5, 0) 23280 bytes (13729)
+2010-07-04 14:21:29 21 files (15, 6, 0) 22200 bytes (5657)
+2010-07-04 14:21:59 27 files (16, 11, 0) 55662 bytes (21158)
+2010-07-04 14:22:29 39 files (23, 16, 0) 126781 bytes (20554)
+2010-07-04 14:22:59 54 files (36, 18, 0) 122433 bytes (21976)
+2010-07-04 14:23:29 39 files (28, 11, 0) 616714 bytes (439081)
+2010-07-04 14:23:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:24:29 37 files (8, 29, 0) 204193 bytes (36438)
+2010-07-04 14:24:59 21 files (2, 19, 0) 196555 bytes (27156)
+2010-07-04 14:25:29 25 files (7, 16, 2) 22880215 bytes (12439460)
+2010-07-04 14:25:59 59 files (9, 50, 0) 1375709 bytes (365788)
+2010-07-04 14:26:29 41 files (0, 41, 0) 187455 bytes (37965)
+2010-07-04 14:26:59 52 files (0, 52, 0) 311272 bytes (40326)
+2010-07-04 14:27:29 37 files (3, 34, 0) 1272456 bytes (502112)
+2010-07-04 14:27:59 9 files (0, 9, 0) 55111 bytes (16345)
+2010-07-04 14:28:29 23 files (0, 23, 0) 128851 bytes (18182)
+2010-07-04 14:28:59 39 files (5, 34, 0) 129389 bytes (18724)
+2010-07-04 14:29:29 34 files (2, 32, 0) 219142 bytes (44562)
+2010-07-04 14:29:59 58 files (5, 53, 0) 630739 bytes (118843)
+2010-07-04 14:30:29 26 files (13, 13, 0) 50311 bytes (14925)
+2010-07-04 14:30:59 57 files (39, 17, 1) 5712423 bytes (5561008)
+2010-07-04 14:31:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:31:59 58 files (2, 56, 0) 397563 bytes (30632)
+2010-07-04 14:32:29 45 files (0, 45, 0) 414913 bytes (37794)
+2010-07-04 14:32:59 34 files (6, 28, 0) 256229 bytes (35787)
+2010-07-04 14:33:29 43 files (16, 27, 0) 233841 bytes (37056)
+2010-07-04 14:33:59 30 files (14, 16, 0) 55166 bytes (8639)
+2010-07-04 14:34:29 44 files (5, 39, 0) 396444 bytes (71954)
+2010-07-04 14:34:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:35:29 3 files (1, 2, 0) 4285 bytes (2847)
+2010-07-04 14:35:59 51 files (18, 33, 0) 341742 bytes (81285)
+2010-07-04 14:36:29 36 files (9, 26, 1) 1779423 bytes (1309108)
+2010-07-04 14:36:59 8 files (0, 8, 0) 77751 bytes (22172)
+2010-07-04 14:37:29 2 files (0, 2, 0) 42270 bytes (36992)
+2010-07-04 14:37:59 21 files (0, 21, 0) 196535 bytes (30632)
+2010-07-04 14:38:29 30 files (0, 30, 0) 244081 bytes (56840)
+2010-07-04 14:38:59 14 files (1, 13, 0) 156581 bytes (39576)
+2010-07-04 14:39:29 21 files (1, 20, 0) 176378 bytes (22528)
+2010-07-04 14:39:59 47 files (1, 46, 0) 472401 bytes (37794)
+2010-07-04 14:40:29 19 files (0, 19, 0) 258176 bytes (41172)
+2010-07-04 14:40:59 55 files (5, 50, 0) 547908 bytes (41113)
+2010-07-04 14:41:29 35 files (5, 30, 0) 797776 bytes (205952)
+2010-07-04 14:41:59 2 files (0, 2, 0) 15628 bytes (8584)
+2010-07-04 14:42:29 31 files (7, 24, 0) 714775 bytes (430807)
+2010-07-04 14:42:59 38 files (10, 28, 0) 340243 bytes (86242)
+2010-07-04 14:43:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:43:59 51 files (3, 48, 0) 729936 bytes (102096)
+2010-07-04 14:44:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:44:59 40 files (19, 21, 0) 199313 bytes (49400)
+2010-07-04 14:45:29 26 files (1, 25, 0) 373460 bytes (76020)
+2010-07-04 14:45:59 17 files (2, 15, 0) 160348 bytes (53724)
+2010-07-04 14:46:29 21 files (7, 14, 0) 218240 bytes (81617)
+2010-07-04 14:46:59 3 files (2, 1, 0) 3035 bytes (1961)
+2010-07-04 14:47:29 51 files (15, 36, 0) 380236 bytes (58229)
+2010-07-04 14:47:59 8 files (1, 7, 0) 111551 bytes (47836)
+2010-07-04 14:48:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:48:59 36 files (8, 28, 0) 349285 bytes (47973)
+2010-07-04 14:49:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:49:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:50:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:50:59 14 files (3, 11, 0) 306151 bytes (150867)
+2010-07-04 14:51:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:51:59 17 files (0, 17, 0) 560532 bytes (102773)
+2010-07-04 14:52:29 40 files (9, 31, 0) 700198 bytes (171887)
+2010-07-04 14:52:59 15 files (7, 7, 1) 2365905 bytes (2170898)
+2010-07-04 14:53:29 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:53:59 3 files (0, 3, 0) 21068 bytes (18393)
+2010-07-04 14:54:29 56 files (12, 44, 0) 588239 bytes (65080)
+2010-07-04 14:54:59 2 files (0, 2, 0) 13714 bytes (12623)
+2010-07-04 14:55:29 9 files (0, 9, 0) 93199 bytes (30398)
+2010-07-04 14:55:59 19 files (5, 14, 0) 275232 bytes (46694)
+2010-07-04 14:56:29 17 files (6, 11, 0) 259098 bytes (60240)
+2010-07-04 14:56:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:57:29 39 files (11, 28, 0) 1666180 bytes (640932)
+2010-07-04 14:57:59 22 files (0, 22, 0) 752584 bytes (102773)
+2010-07-04 14:58:29 14 files (3, 11, 0) 313501 bytes (96965)
+2010-07-04 14:58:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 14:59:29 7 files (0, 7, 0) 133949 bytes (74888)
+2010-07-04 14:59:59 10 files (2, 8, 0) 33537 bytes (7069)
+2010-07-04 15:00:29 34 files (20, 14, 0) 242703 bytes (171887)
+2010-07-04 15:00:59 26 files (20, 6, 0) 52686 bytes (18979)
+2010-07-04 15:01:29 13 files (8, 5, 0) 26281 bytes (7141)
+2010-07-04 15:01:59 11 files (5, 5, 1) 2061332 bytes (1903984)
+2010-07-04 15:02:29 49 files (24, 25, 0) 378404 bytes (203072)
+2010-07-04 15:02:59 40 files (17, 23, 0) 86640 bytes (11000)
+2010-07-04 15:03:29 19 files (9, 10, 0) 128134 bytes (82733)
+2010-07-04 15:03:59 18 files (13, 4, 1) 5854464 bytes (5359033)
+2010-07-04 15:04:29 49 files (25, 24, 0) 249161 bytes (109605)
+2010-07-04 15:04:59 42 files (11, 31, 0) 1508473 bytes (1041876)
+2010-07-04 15:05:29 17 files (0, 17, 0) 191522 bytes (36384)
+2010-07-04 15:05:59 0 files (0, 0, 0) 0 bytes (0)
+2010-07-04 15:06:29 9 files (1, 8, 0) 58844 bytes (16627)
diff --git a/man/html/importdata/mover2pcp b/man/html/importdata/mover2pcp
new file mode 100755
index 0000000..8d45e1a
--- /dev/null
+++ b/man/html/importdata/mover2pcp
@@ -0,0 +1,277 @@
+#!/usr/bin/perl
+#
+# Import mover.log data and create a PCP archive
+#
+# mover.log lines ...
+# 2010-07-04 13:50:32 54 files (24, 28, 2) 4097068 bytes (1451420)
+# date
+# time
+# number of files moved
+# number with size <= 1K
+# number with size <= 1M
+# number with size >1M
+# aggregate size of moved files
+# max file size
+#
+# Copyright (c) 2010 Ken McDonell. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+
+use strict;
+use warnings;
+
+use Getopt::Std;
+use Date::Parse;
+use Date::Format;
+use PCP::LogImport;
+
+my $line = 0; # input line number
+my $basedate = undef;
+my $basetime = "00:00:00";
+my $host = undef;
+my $zone = "UTC"; # default timezone unless -Z on command line
+my $sts;
+my %options; # for command line arguments
+my @handle = (); # pmi* handles, one per metric-instance pair
+my $h = 0; # index into handle[]
+my %inst_map = (); # key=indom value=last_inst_assigned, and
+ # key=indom.instance value=inst
+my $putsts = 0; # pmiPutValue() errors are only checked @ end of loop
+my $sz_indom = pmInDom_build(PMI_DOMAIN, 0);
+my $nfile = 0;
+my $nbyte = 0;
+my @nfile_by_size = (0,0,0);
+
+# Initialize the PCP archive label fields
+#
+# PCP expects a $TZ style timezone in the archive label, so we have
+# to make up a PCP-xx:xx timezone.
+# Note this involves a sign reversal!
+#
+sub do_label()
+{
+ my $label_zone = $zone;
+ if ($zone =~ /^[-+][0-9][0-9][0-9][0-9]/) {
+ $label_zone =~ s/^\+/PCP-/;
+ $label_zone =~ s/^-/PCP+/;
+ $label_zone =~ s/(..)$/:$1/;
+ }
+ elsif ($zone ne "UTC") {
+ print "mover2pcp: Warning: unexpected timezone ($zone), reverting to UTC\n";
+ $zone = "UTC";
+ $label_zone = "UTC";
+ }
+ pmiSetTimezone($label_zone) >= 0
+ or die "pmiSetTimezone($label_zone): " . pmiErrStr(-1) . "\n";
+
+ if (defined($host)) {
+ pmiSetHostname($host) >= 0
+ or die "pmiSetHostname($host): " . pmiErrStr(-1) . "\n";
+ }
+}
+
+# Handle metrics with the a singular value, calling pmiAddMetric() and
+# pmiGetHandle()
+#
+sub def_single($)
+{
+ my ($name) = @_;
+ my $sts;
+ my $type = PM_TYPE_U32;
+ my $sem = PM_SEM_COUNTER;
+ my $units = pmiUnits(1,0,0,PM_SPACE_BYTE,0,0);
+ if ($name eq "mover.nfile") {
+ $units = pmiUnits(0,0,1,0,0,PM_COUNT_ONE);
+ }
+ elsif ($name eq "mover.nbyte") {
+ $type = PM_TYPE_U64;
+ }
+ elsif ($name eq "mover.max_file_size") {
+ $type = PM_TYPE_U64;
+ $sem = PM_SEM_INSTANT;
+ }
+ if (pmiAddMetric($name, PM_ID_NULL, $type, PM_INDOM_NULL, $sem, $units) < 0) {
+ pmiDump();
+ die "pmiAddMetric($name, ...): " . pmiErrStr(-1) . "\n";
+ }
+ $sts = pmiGetHandle($name, "");
+ if ($sts < 0) {
+ pmiDump();
+ die "pmiGetHandle($name, ...): " . pmiErrStr($sts) . "\n";
+ }
+ push(@handle, $sts);
+}
+
+# Handle metrics with multiple values, calling pmiAddMetric().
+# Defer to pmiGetHandle() to def_metric_inst().
+#
+sub def_multi($$)
+{
+ my ($name,$indom) = @_;
+ my $type = PM_TYPE_U32;
+ my $sem = PM_SEM_COUNTER;
+ my $units = pmiUnits(0,0,1,0,0,PM_COUNT_ONE);
+ if (pmiAddMetric($name, PM_ID_NULL, $type, $indom, $sem, $units) < 0) {
+ pmiDump();
+ die "pmiAddMetric($name, ...): " . pmiErrStr(-1) . "\n";
+ }
+}
+
+# Deal with metric-instance pairs.
+# If first time this instance has been seen for this indom, add it to
+# the instance domain.
+# Get a handle and add it to handle[].
+#
+sub def_metric_inst($$$)
+{
+ my ($name,$indom,$instance) = @_;
+ my $sts;
+ # inst_map{} holds the last allocated inst number with $indom as the
+ # key, and marks the instance as known with $indom . $instance as the
+ # key
+ if (!exists($inst_map{$indom . $instance})) {
+ my $inst;
+ if (exists($inst_map{$indom})) {
+ $inst_map{$indom}++;
+ $inst = $inst_map{$indom};
+ }
+ else {
+ $inst_map{$indom} = 0;
+ $inst = 0;
+ }
+ if (pmiAddInstance($indom, $instance, $inst) < 0) {
+ pmiDump();
+ die "pmiAddInstance([$name], $instance, $inst): " . pmiErrStr(-1) . "\n";
+ }
+ $inst_map{$indom . $instance} = $inst;
+ }
+ $sts = pmiGetHandle($name, $instance);
+ if ($sts < 0) {
+ pmiDump();
+ die "pmiGetHandle($name, $instance): " . pmiErrStr($sts) . "\n";
+ }
+ push(@handle, $sts);
+}
+
+# wrapper for pmiPutValueHandle(), using @handle
+#
+sub put($)
+{
+ my ($value) = @_;
+ my $sts;
+ if (!exists($handle[$h])) {
+ pmiDump();
+ die <<EOF
+put($value): No handle[] entry for index $h.
+Check Handles in dump above.
+EOF
+ }
+ $sts = pmiPutValueHandle($handle[$h], $value);
+ if ($sts < 0 && $putsts == 0) { $putsts = $sts };
+ $h++;
+}
+
+$sts = getopts('h:Z:', \%options);
+
+if (!defined($sts) || $#ARGV != 1) {
+ print "Usage: mover2pcp [-h host] [-Z timezone] infile outfile\n";
+ exit(1);
+}
+
+exists($options{h}) and $host = $options{t};
+if (exists($options{Z})) {
+ $zone = $options{Z};
+ if ($zone !~ /^[-+][0-9][0-9][0-9][0-9]$/ && $zone ne "UTC") {
+ print "mover2pcp: Illegal -Z value, must be +NNNN or -NNNN or UTC\n";
+ exit(1);
+ }
+}
+
+pmiStart($ARGV[1], 0);
+do_label();
+
+open(INFILE, "<" . $ARGV[0])
+ or die "mover2pcp: Failed to open infile \"$ARGV[0]\"\n";
+
+# define metadata
+def_single("mover.nfile");
+def_multi("mover.nfile_by_size", $sz_indom);
+def_metric_inst("mover.nfile_by_size", $sz_indom, "<=1Kbyte");
+def_metric_inst("mover.nfile_by_size", $sz_indom, "<=1Mbyte");
+def_metric_inst("mover.nfile_by_size", $sz_indom, ">1Mbyte");
+def_single("mover.nbyte");
+def_single("mover.max_file_size");
+
+while (<INFILE>) {
+ my @part;
+ chomp;
+ $line++;
+ print "[" . $line . "] $_\n";
+
+ # 2010-07-04 13:47:59 49 files (40, 9, 0) 118418 bytes (70669)
+ s/[(),]//g; # remove all (, ) and ,
+
+ @part = split(/\s+/, $_);
+ if ($#part != 9) {
+ print "[$line] $_\n";
+ die "Number of values? expected 10, found " . ($#part+1) . "\n";
+ }
+
+ $nfile += $part[2];
+ put($nfile);
+ $nfile_by_size[0] += $part[4];
+ put($nfile_by_size[0]);
+ $nfile_by_size[1] += $part[5];
+ put($nfile_by_size[1]);
+ $nfile_by_size[2] += $part[6];
+ put($nfile_by_size[2]);
+ $nbyte += $part[7];
+ put($nbyte);
+ put($part[9]);
+
+ if ($putsts < 0) {
+ pmiDump();
+ die "pmiPutValue: Failed @ $part[0] $part[1]: " . pmiErrStr($putsts) . "\n";
+ }
+ if (pmiWrite(str2time($part[0] . "T" . $part[1], $zone), 0) < 0) {
+ pmiDump();
+ die "pmiWrite: @ $part[0] $part[1]: " . pmiErrStr(-1) . "\n";
+ }
+ $h = 0;
+ $putsts = 0;
+}
+
+pmiEnd();
+
+exit(0);
+
+=pod
+
+=head1 NAME
+
+mover2pcp - Import mover.log and create a PCP archive
+
+=head1 SYNOPSIS
+
+B<mover2pcp> [B<-Z> I<timezone>] I<infile> I<outfile>
+
+=head1 DESCRIPTION
+
+Add description here.
+
+=head1 SEE ALSO
+
+B<LOGIMPORT>(3),
+B<PCP::LogImport>(3pm),
+B<pmchart>(1),
+B<pmie>(1) and
+B<pmlogger>(1).
diff --git a/man/html/importdata/moverv1 b/man/html/importdata/moverv1
new file mode 100755
index 0000000..431ffbe
--- /dev/null
+++ b/man/html/importdata/moverv1
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+#
+# Minimalist Version 1.
+#
+
+use strict;
+use warnings;
+use Date::Parse;
+use Date::Format;
+use PCP::LogImport;
+
+pmiStart("mover_v1", 0);
+pmiAddMetric("mover.nfile",
+ PM_ID_NULL, PM_TYPE_U32, PM_INDOM_NULL,
+ PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
+
+open(INFILE, "<mover.log");
+while (<INFILE>) {
+ my @part;
+ chomp;
+ @part = split(/\s+/, $_);
+ pmiPutValue("mover.nfile", "", $part[2]);
+ pmiWrite(str2time($part[0] . "T" . $part[1], "UTC"), 0);
+}
+
+pmiEnd();
diff --git a/man/html/importdata/moverv2 b/man/html/importdata/moverv2
new file mode 100755
index 0000000..4c376b8
--- /dev/null
+++ b/man/html/importdata/moverv2
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+#
+# Minimalist Version 2.
+#
+
+use strict;
+use warnings;
+use Date::Parse;
+use Date::Format;
+use PCP::LogImport;
+
+my $nfile = 0;
+
+pmiStart("mover_v2", 0);
+pmiAddMetric("mover.nfile",
+ PM_ID_NULL, PM_TYPE_U32, PM_INDOM_NULL,
+ PM_SEM_COUNTER, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
+
+open(INFILE, "<mover.log");
+while (<INFILE>) {
+ my @part;
+ chomp;
+ @part = split(/\s+/, $_);
+ $nfile += $part[2];
+ pmiPutValue("mover.nfile", "", $nfile);
+ pmiWrite(str2time($part[0] . "T" . $part[1], "UTC"), 0);
+}
+
+pmiEnd();
diff --git a/man/html/importdata/moverv3 b/man/html/importdata/moverv3
new file mode 100755
index 0000000..3899f75
--- /dev/null
+++ b/man/html/importdata/moverv3
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+#
+# Minimalist Version 3.
+#
+
+use strict;
+use warnings;
+use Date::Parse;
+use Date::Format;
+use PCP::LogImport;
+
+my $nfile = 0;
+my $nbyte = 0;
+
+pmiStart("mover_v3", 0);
+pmiAddMetric("mover.nfile",
+ PM_ID_NULL, PM_TYPE_U32, PM_INDOM_NULL,
+ PM_SEM_COUNTER, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
+pmiAddMetric("mover.nbyte",
+ PM_ID_NULL, PM_TYPE_U64, PM_INDOM_NULL,
+ PM_SEM_COUNTER, pmiUnits(1,0,0,PM_SPACE_BYTE,0,0));
+pmiAddMetric("mover.max_file_size",
+ PM_ID_NULL, PM_TYPE_U64, PM_INDOM_NULL,
+ PM_SEM_INSTANT, pmiUnits(1,0,0,PM_SPACE_BYTE,0,0));
+
+open(INFILE, "<mover.log");
+while (<INFILE>) {
+ my @part;
+ chomp;
+ s/[(),]//g; # all remove (, ) and ,
+ @part = split(/\s+/, $_);
+ $nfile += $part[2];
+ pmiPutValue("mover.nfile", "", $nfile);
+ $nbyte += $part[7];
+ pmiPutValue("mover.nbyte", "", $nbyte);
+ pmiPutValue("mover.max_file_size", "", $part[9]);
+ pmiWrite(str2time($part[0] . "T" . $part[1], "UTC"), 0);
+}
+
+pmiEnd();
diff --git a/man/html/importdata/moverv4 b/man/html/importdata/moverv4
new file mode 100755
index 0000000..a84d085
--- /dev/null
+++ b/man/html/importdata/moverv4
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+#
+# Minimalist Version 4.
+#
+
+use strict;
+use warnings;
+use Date::Parse;
+use Date::Format;
+use PCP::LogImport;
+
+my $nfile = 0;
+my $nbyte = 0;
+my $sz_indom = pmInDom_build(PMI_DOMAIN, 0);
+my @nfile_by_size = (0,0,0);
+
+pmiStart("mover_v4", 0);
+pmiAddMetric("mover.nfile",
+ PM_ID_NULL, PM_TYPE_U32, PM_INDOM_NULL,
+ PM_SEM_COUNTER, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
+pmiAddMetric("mover.nfile_by_size",
+ PM_ID_NULL, PM_TYPE_U32, $sz_indom,
+ PM_SEM_COUNTER, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));
+pmiAddInstance($sz_indom, "<=1Kbyte", 0);
+pmiAddInstance($sz_indom, "<=1Mbyte", 1);
+pmiAddInstance($sz_indom, ">1Mbyte", 2);
+pmiAddMetric("mover.nbyte",
+ PM_ID_NULL, PM_TYPE_U64, PM_INDOM_NULL,
+ PM_SEM_COUNTER, pmiUnits(1,0,0,PM_SPACE_BYTE,0,0));
+pmiAddMetric("mover.max_file_size",
+ PM_ID_NULL, PM_TYPE_U64, PM_INDOM_NULL,
+ PM_SEM_INSTANT, pmiUnits(1,0,0,PM_SPACE_BYTE,0,0));
+
+open(INFILE, "<mover.log");
+while (<INFILE>) {
+ my @part;
+ chomp;
+ s/[(),]//g; # all remove (, ) and ,
+ @part = split(/\s+/, $_);
+ $nfile += $part[2];
+ pmiPutValue("mover.nfile", "", $nfile);
+ $nfile_by_size[0] += $part[4];
+ pmiPutValue("mover.nfile_by_size", "<=1Kbyte", $nfile_by_size[0]);
+ $nfile_by_size[1] += $part[5];
+ pmiPutValue("mover.nfile_by_size", "<=1Mbyte", $nfile_by_size[1]);
+ $nfile_by_size[2] += $part[6];
+ pmiPutValue("mover.nfile_by_size", ">1Mbyte", $nfile_by_size[2]);
+ $nbyte += $part[7];
+ pmiPutValue("mover.nbyte", "", $nbyte);
+ pmiPutValue("mover.max_file_size", "", $part[9]);
+ pmiWrite(str2time($part[0] . "T" . $part[1], "UTC"), 0);
+}
+
+pmiEnd();