A.6. Logging Performance Data (using pmlogger)
PCP allows you to log performance metric values which can replayed at a later date by creating archived logs of selected metrics on the system through the
pmlogger
tool. These metric archives may be played back at a later date to give retrospective performance analysis.
The
pmlogger
tool provides flexibility and control over the logged metrics by allowing you to specify which metrics are recorded on the system and at what frequency. By default, the configuration file for pmlogger
is stored at /var/lib/pcp/config/pmlogger/config.default
; the configuration file outlines which metrics are logged by the primary logging instance.
In order for
pmlogger
to log metric values on the local machine, a primary logging instance must be started. You can use systemctl
to ensure that pmlogger
is started as a service when the machine starts.
The following example shows an extract of a
pmlogger
configuration file which enables the recording of GFS2 performance metrics. This extract shows that pmlogger
will log the performance metric values for the PCP GFS2 latency metrics every 10 seconds, the top 10 worst glock metric every 30 seconds, the tracepoint data every minute, and it will log the data from the glock
, glstats
and sbstats
metrics every 10 minutes.
# It is safe to make additions from here on ... # log mandatory on every 5 seconds { gfs2.latency.grant gfs2.latency.queue gfs2.latency.demote gfs2.glocks } log mandatory on every 10 seconds { gfs2.worst_glock } log mandatory on every 30 seconds { gfs2.tracepoints } log mandatory on every 5 minutes { gfs2.glstats gfs2.sbstats } [access] disallow * : all; allow localhost : enquire;
注意
PCP comes with a default set of metrics which it will log on the host when
pmlogger
is enabled. However, no logging of GFS2 metrics occur with this default configuration.
After recording metric data, you have multiple options when it comes to the replaying of PCP log archives on the system. You can export the logs to text files and import them into spreadsheets, or you can replay them in the PCP-GUI application using graphs to visualize the retrospective data alongside live data of the system.
One of the tools available in PCP for viewing the log files is
pmdumptext
. This tool allows the user to parse the selected PCP log archive and export the values into an ASCII table. pmdumptext
can be used to dump the entire archive log or only select metric values from the log by specifying individual metrics through the command line. For more information on using pmdumptext
, see the pmdumptext
(1) man page.