SHEET2PCP(1)
π SHEET2PCP(1) π
okay bestie, welcome to the General Commands Manual entry for sheet2pcp β yes it's a real one, yes it eats spreadsheets for breakfast, and yes we're gonna get through the whole thing together. grab a boba. π§β¨
β¨ NAME β¨
sheet2pcp β the lil glow-up machine that imports spreadsheet data and creates a PCP archive π¦
πΈ SYNOPSIS πΈ
sheet2pcp [-h host] [-V version] [-Z timezone] infile mapfile outfile
π DESCRIPTION π
so like. sheet2pcp is literally built to read a data spreadsheet (infile) and translate it into a Performance Co-Pilot (PCP) archive whose basename is outfile. that's the whole vibe. π
the input spreadsheet can be in any of the common formats β provided the right Perl modules are installed (go peek at the CAVEATS section below, iykyk). and the spreadsheet has to be βnormalizedβ, okay? that means every row holds data for the same time interval, and one of the columns has the date and time for the data in each row. no chaotic rows allowed, we're keeping it consistent bestie. β
the resulting PCP archive can be used with all the PCP client tools β graph subsets of the data with pmchart(1), do data reduction and reporting, filter with the PCP inference engine pmie(1), etc. etc. it's giving versatile. π₯
the mapfile is the main character here β it controls the import process and defines the data mapping from the spreadsheet columns onto the PCP data model. it's written in XML and follows the syntax laid out in the MAPPING CONFIGURATION section below. π
a series of physical files gets created with the prefix outfile:
outfile.0β the performance dataoutfile.metaβ the metadata that describes the performance dataoutfile.indexβ a temporal index to improve efficiency of replay operations for the archive
β οΈ if any of those files already exists, sheet2pcp will not overwrite them and will exit with an error message. it's respectful like that. π
the -h option is an alternate to the hostname attribute of the <sheet> element in mapfile (described below). if both are specified, the value from mapfile wins. periodt. π
the -V option specifies the version for the output PCP archive. by default the archive version $PCP_ARCHIVE_VERSION is used (set to 3 in current PCP releases), and the only values currently supported for version are 2 or 3. don't try anything else, bestie. π
the -Z option is an alternate to the timezone attribute of the <sheet> element in mapfile (described below). if both are specified, the value from mapfile wins again. mapfile stays undefeated. πͺ
sheet2pcp is a Perl script that uses the PCP::LogImport Perl wrapper around the PCP libpcp_import library, and as such it could be used as an example to develop new tools to import other types of performance data and create PCP archives. so it's not just a tool, it's inspiration. main character energy fr fr. π
π MAPPING CONFIGURATION π
the mapfile contains specifications in standard XML format. β¨
the whole specification is wrapped in a <sheet> ... </sheet> element. the sheet tag supports the following optional attributes:
headingβ specifies the number of heading rows to skip at the start of the spreadsheet before processing data. example:heading="1". bye bye header row πhostnameβ set the source hostname in the PCP archive (the default is to use the hostname of the local host). example:hostname="some.where.com".timezoneβ set the source timezone in the PCP archive (the default is to use UTC). the timezone must have the format+HHMM(for hours and minutes East of UTC) or-HHMM(for hours and minutes West of UTC). note in particular that neither the zoneinfo (aka Olson) format, e.g.Europe/Paris, nor the Posix TZ format, e.g.EST+5is allowed. example:timezone="+1100". don't try to be cute with the format, it WILL not work πdatefmtβ the format of the date imported from the spreadsheet may be specified as a concatenation of values that specify the order of the year (Y), month (M) and day (D) fields in a date. the supported variants areDMY(the default),MDYandYMD. example:datefmt="YMD".
a <sheet> element contains one or more metric specifications of the form <metric>metricname</metric>. the metric tag supports the following optional attributes:
pmidβ the Performance Metrics Identifier (PMID), specified as 3 numbers separated by a periods (.) to set the domain, cluster and item fields of the PMID, seePMNS(5)for more details of PMIDs. if omitted, the PMID will be automatically assigned bypmiAddMetric(3). the valuePM_ID_NULLmay be used to explicitly nominate the default behaviour. examples:pmid="60.0.2",pmid="PM_ID_NULL".indomβ each metric may have one or more values. if a metric always has one value, it is singular and the Instance Domain should be set toPM_INDOM_NULL. otherwiseindomshould be specified as 2 numbers separated by a period (.) to set the domain and ordinal fields of the Instance Domain. examples:indom="PM_INDOM_NULL",indom="60.3",indom="PMI_DOMAIN.4".- more than one metric can share the same Instance Domain when the metrics have defined values over similar sets of instances, e.g. all the metrics for each network interface. π₯οΈ
- it is standard practice for the domain field to be the same for the
pmidand theindom; if thepmidattribute is missing, then the domain field for theindomshould be the reserved domainPMI_DOMAIN. - if the
indomattribute is omitted then the default Instance Domain for the metric isPM_INDOM_NULL.
unitsβ the scale and dimension of the metric values along the axes of space, time and count (events, messages, packets, etc.) is specified with a 6-tuple. these values are passed to thepmiUnits(3)function to generate apmUnitsstructure. refer topmLookupDesc(3)for a full description of all the fields of this structure. the default is to assign no scale or dimension to the metric, i.e.units="0,0,0,0,0,0". examples:units="0,1,0,0,PM_TIME_MSEC,0"(milliseconds)units="1,-1,0,PM_SPACE_MBYTE,PM_TIME_SEC,0"(Mbytes/sec)units="0,1,-1,0,PM_TIME_USEC,PM_COUNT_ONE"(microseconds/event)
typeβ defines the data type for the metric. refer topmLookupDesc(3)for a full description of the possible type values; the default isPM_TYPE_FLOAT. examples:type="PM_TYPE_32",type="PM_TYPE_U64",type="PM_TYPE_STRING".semβ defines the semantics of the metric. refer topmLookupDesc(3)for a full description of the possible values; the default isPM_SEM_INSTANT. examples:sem="PM_SEM_COUNTER",type="PM_SEM_DISCRETE".
the remaining specifications define the data columns in order using exactly one <datetime></datetime> element, one or more <data>metricspec</data> elements and one or more <skip></skip> elements. β
the <datetime> element defines the column in which a date and time will be found to form the timestamp in the PCP archive for all the data in each row of the PCP archive. π
for the <data> element, a metricspec consists of a metric name (as defined in an earlier <metric> element), optionally followed by an instance name that is enclosed by square brackets, e.g. <data>hinv.ncpu</data>, <data>kernel.all.load[1 minute]</data>.
the skip tag defines the column that should be skipped when preparing data for the PCP archive. not every column deserves to make it, and that's okay π«
the order of the <datetime>, <data> and <skip> elements matches the order of columns in the spreadsheet. if the number of elements is not the same as the number of columns, a warning is issued, and the extra elements or columns generate no metric values in the output archive. so like. count your columns bestie π
π EXAMPLE π
the mapfile...
<?xml version="1.0" encoding="UTF-8"?>
<sheet heading="1">
<!-- simple example -->
<metric pmid="60.0.2" indom="60.0" units="0,1,0,0,PM_TIME_MSEC,0"
type="PM_TYPE_U64" sem="PM_SEM_COUNTER">
kernel.percpu.cpu.sys</metric>
<datetime></datetime>
<skip></skip>
<data>kernel.percpu.cpu.sys[cpu0]</data>
<data>kernel.percpu.cpu.sys[cpu1]</data>
</sheet>
could be used for a spreadsheet in which the first few rows are...
Date;"Status";"SysTime - 0";"SysTime - 1";
26/01/2001 14:05:22;"Some Busy";0.750;0.133
26/01/2001 14:05:37;"OK";0.150;0.273
26/01/2001 14:05:52;"All Busy";0.733;0.653
like. look at that mapping go. iconic. π
β οΈ CAVEATS β οΈ
okay so the important stuff, no skipping bestie:
only the first sheet from infile will be processed. just the first one. the rest are getting ignored, sorry to them. π
additional Perl modules must be installed for the various spreadsheet formats, although these are checked for at run-time so only the modules required for the specific types of spreadsheets you wish to process need to be installed:
*.csvβ Spreadsheets in the Comma Separated Values (CSV) format requireText::CSV_XS(3pm).*.sxcor*.odsβ OpenOffice documents requireSpreadsheet::ReadSXC(3pm), which in turn requiresArchive::Zip(3pm).*.xlsβ Classical Microsoft Office documents requireSpreadsheet::ParseExcel(3pm), which in turn requiresOLE::Storage_Lite(3pm).*.xlsxβ Microsoft OpenXML documents requireSpreadsheet::XLSX(3pm).- > π¨ real talk:
sheet2pcpdoes not appear to work with OpenXML documents saved from OpenOffice. that's a genuine known thing, not me being dramatic.
- > π¨ real talk:
π PCP ENVIRONMENT π
environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. on each installation, the file /etc/pcp.conf contains the local values for these variables. the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5). β¨
for environment variables affecting PCP tools, see pmGetOptions(3).
π«Ά SEE ALSO π«Ά
the whole friend group, in order: pmchart(1), pmie(1), pmlogger(1), sed(1), pmiAddMetric(3), pmLookupDesc(3), pmiUnits(3), Archive::Zip(3pm), Date::Format(3pm), Date::Parse(3pm), PCP::LogImport(3pm), OLE::Storage_Lite(3pm), Spreadsheet::ParseExcel(3pm), Spreadsheet::ReadSXC(3pm), Spreadsheet::XLSX(3pm), Text::CSV_XS(3pm), XML::TokeParser(3pm) and LOGIMPORT(3).
that's the whole page bestie π brought to you by Performance Co-Pilot / PCP, page SHEET2PCP(1). go forth, import those spreadsheets, and slay. π¦β¨π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- debian trixie: pcp-import-sheet2pcp 6.3.8-1
- ubuntu questing: pcp-import-sheet2pcp 6.3.8-1
- ubuntu resolute: pcp-import-sheet2pcp 7.1.1-1
- ubuntu stonking: pcp-import-sheet2pcp 7.2.1-2build1
- Copyright (c) 2010 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms