Este contenido no está disponible en el idioma seleccionado.
Chapter 9. Monitoring performance with Performance Co-Pilot
Performance Co-Pilot (PCP) is a suite of tools, services, and libraries for monitoring, visualizing, storing, and analyzing system-level performance measurements.
As a system administrator, you can monitor the system’s performance using the PCP application in Red Hat Enterprise Linux 9.
9.1. Monitoring postfix with pmda-postfix Copiar enlaceEnlace copiado en el portapapeles!
This procedure describes how to monitor performance metrics of the postfix mail server with pmda-postfix. It helps to check how many emails are received per second.
Prerequisites
- PCP is installed. For more information, see Installing and enabling PCP.
-
The
pmloggerservice is enabled. For more information, see Enabling the pmlogger service.
Procedure
Install the following packages:
Install the
pcp-system-tools:dnf install pcp-system-tools
# dnf install pcp-system-toolsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
pmda-postfixpackage to monitorpostfix:dnf install pcp-pmda-postfix postfix
# dnf install pcp-pmda-postfix postfixCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the logging daemon:
dnf install rsyslog
# dnf install rsyslogCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the mail client for testing:
dnf install mutt
# dnf install muttCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Enable the
postfixandrsyslogservices:systemctl enable postfix rsyslog systemctl restart postfix rsyslog
# systemctl enable postfix rsyslog # systemctl restart postfix rsyslogCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the SELinux boolean, so that
pmda-postfixcan access the required log files:setsebool -P pcp_read_generic_logs=on
# setsebool -P pcp_read_generic_logs=onCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
PMDA:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the
pmda-postfixoperation:echo testmail | mutt root
echo testmail | mutt rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the available metrics:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2. Visually tracing PCP log archives with the PCP Charts application Copiar enlaceEnlace copiado en el portapapeles!
After recording metric data, you can replay the PCP log archives as graphs. The metrics are sourced from one or more live hosts with alternative options to use metric data from PCP log archives as a source of historical data. To customize the PCP Charts application interface to display the data from the performance metrics, you can use line plot, bar graphs, or utilization graphs.
Using the PCP Charts application, you can:
- Replay the data in the PCP Charts application application and use graphs to visualize the retrospective data alongside live data of the system.
- Plot performance metric values into graphs.
- Display multiple charts simultaneously.
Prerequisites
- PCP is installed. For more information, see Installing and enabling PCP.
-
Logged performance data with the
pmlogger. For more information, see Logging performance data with pmlogger. Install the
pcp-guipackage:dnf install pcp-gui
# dnf install pcp-guiCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Launch the PCP Charts application from the command line:
pmchart
# pmchartCopy to Clipboard Copied! Toggle word wrap Toggle overflow Figure 9.1. PCP Charts application
The
pmtimeserver settings are located at the bottom. The start and pause button allows you to control:- The interval in which PCP polls the metric data
- The date and time for the metrics of historical data
- Click File and then New Chart to select metric from both the local machine and remote machines by specifying their host name or address. Advanced configuration options include the ability to manually set the axis values for the chart, and to manually choose the color of the plots.
Record the views created in the PCP Charts application:
Following are the options to take images or record the views created in the PCP Charts application:
- Click File and then Export to save an image of the current view.
- Click Record and then Start to start a recording. Click Record and then Stop to stop the recording. After stopping the recording, the recorded metrics are archived to be viewed later.
Optional: In the PCP Charts application, the main configuration file, known as the view, allows the metadata associated with one or more charts to be saved. This metadata describes all chart aspects, including the metrics used and the chart columns. Save the custom view configuration by clicking File and then Save View, and load the view configuration later.
The following example of the PCP Charts application view configuration file describes a stacking chart graph showing the total number of bytes read and written to the given XFS file system
loop1:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.3. Collecting data from SQL server using PCP Copiar enlaceEnlace copiado en el portapapeles!
The SQL Server agent is available in Performance Co-Pilot (PCP), which helps you to monitor and analyze database performance issues.
This procedure describes how to collect data for Microsoft SQL Server via pcp on your system.
Prerequisites
- You have installed Microsoft SQL Server for Red Hat Enterprise Linux and established a 'trusted' connection to an SQL server.
- You have installed the Microsoft ODBC driver for SQL Server for Red Hat Enterprise Linux.
Procedure
Install PCP:
dnf install pcp-zeroconf
# dnf install pcp-zeroconfCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install packages required for the
pyodbcdriver:dnf install python3-pyodbc
# dnf install python3-pyodbcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
mssqlagent:Install the Microsoft SQL Server domain agent for PCP:
dnf install pcp-pmda-mssql
# dnf install pcp-pmda-mssqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/etc/pcp/mssql/mssql.conffile to configure the SQL server account’s username and password for themssqlagent. Ensure that the account you configure has access rights to performance data.username: user_name password: user_password
username: user_name password: user_passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace user_name with the SQL Server account and user_password with the SQL Server user password for this account.
Install the agent:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Using the
pcpcommand, verify if the SQL Server PMDA (mssql) is loaded and running:Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the complete list of metrics that PCP can collect from the SQL Server:
pminfo mssql
# pminfo mssqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow After viewing the list of metrics, you can report the rate of transactions. For example, to report on the overall transaction count per second, over a five second time window:
pmval -t 1 -T 5 mssql.databases.transactions
# pmval -t 1 -T 5 mssql.databases.transactionsCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
View the graphical chart of these metrics on your system by using the
pmchartcommand. For more information, see Visually tracing PCP log archives with the PCP Charts application.
9.4. Generating PCP archives from sadc archives Copiar enlaceEnlace copiado en el portapapeles!
You can use the sadf tool provided by the sysstat package to generate PCP archives from native sadc archives.
Prerequisites
A
sadcarchive has been created:/usr/lib64/sa/sadc 1 5 -
# /usr/lib64/sa/sadc 1 5 -Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example,
sadcis sampling system data 1 time in a 5 second interval. The outfile is specified as-which results insadcwriting the data to the standard system activity daily data file. This file is named saDD and is located in the /var/log/sa directory by default.
Procedure
Generate a PCP archive from a
sadcarchive:sadf -l -O pcparchive=/tmp/recording -2
# sadf -l -O pcparchive=/tmp/recording -2Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, using the
-2option results insadfgenerating a PCP archive from asadcarchive recorded 2 days ago.
Verification
You can use PCP commands to inspect and analyze the PCP archive generated from a sadc archive as you would a native PCP archive. For example:
To show a list of metrics in the PCP archive generated from an
sadcarchive archive, run:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To show the timespace of the archive and hostname of the PCP archive, run:
pmdumplog --label /tmp/recording
$ pmdumplog --label /tmp/recording Log Label (Log Format Version 2) Performance metrics from host shard commencing Tue Jul 20 00:10:30.642477 2021 ending Wed Jul 21 00:10:30.222176 2021Copy to Clipboard Copied! Toggle word wrap Toggle overflow To plot performance metrics values into graphs, run:
pmchart --archive /tmp/recording
$ pmchart --archive /tmp/recordingCopy to Clipboard Copied! Toggle word wrap Toggle overflow