===== Links =====
* [[https://fluxcoil.net/files/speeches/20200811_pcp_cheat_sheet.pdf|20200811_pcp_cheat_sheet.pdf]] [[https://fluxcoil.net/files/speeches/20200811_pcp_cheat_sheet.tex|tex]]
===== Installation =====
dnf -y install pcp-zeroconf
# Verify pcp installation on application level:
pcp
===== Metrics and archives =====
# Which metrics are offered by the running pmcd?
pminfo
# Which metrics related to cpu are available?
pminfo | grep cpu
# Set a variable to current archive, and evaluate
# how many metrics are logged in the archive:
cd /var/log/pcp/pmlogger/
pminfo -a | wc -l
pminfo -a 20200731 | wc -l
# Have pmdiff point out ’significant peaks’ in archives:
pmdiff -a
# Accessing metrics
# Most basic access to metrics:
pmrep -a
pmrep -a 20200731 kernel.all.load
# Graphical access:
pmchart
===== Install PCP on clients, so they offer data for a collector =====
yum -y install pcp
firewall-cmd –permanent –zone=public –add-port=44321/tcp
firewall-cmd –reload
if grep -q PMCD_LOCAL /etc/sysconfig/pmcd; then
sed -ie ’s,PMCD_LOCAL.*,PMCD_LOCAL=0,’ /etc/sysconfig/pmcd
else
echo ’PMCD_LOCAL=0’ »/etc/sysconfig/pmcd
fi
grep PMCD_LOCAL /etc/sysconfig/pmcd
service pmcd restart
chkconfig pmcd on
===== Have PCP collect data from remote systems =====
On the collector, we install pcp-zeroconf which also sets up logging to archive files. We then set variable CLIENT to the clients name, create a config- and controlfile, and notify pmlogger of the changes.
yum -y install pcp-zeroconf
CLIENT=rhel7u8a
/usr/libexec/pcp/bin/pmlogconf \
/var/lib/pcp/config/pmlogger/config.$CLIENT
# optionally, execute the last command a second time
echo "$CLIENT.local n n PCP_LOG_DIR/pmlogger/$CLIENT.local" \
" -r -T30d -c config.$CLIENT" \
>/etc/pcp/pmlogger/control.d/$CLIENT
# Not have pmlogger perform the first data collection
/usr/libexec/pcp/bin/pmlogger_check
===== PCP dstat usage =====
# default dstat output, list plugins, customize output
pcp dstat
pcp dstat --list
pcp dstat --time --disk --cpu
pcp dstat -c -C 0,3,total
pcp dstat 10 # subsampling, 10sec
pcp dstat -n -N enp0s31f6,redhat0
# dstat archive access
ARCHIV=/var/log/pcp/pmlogger/fluxcoil/20200827.00.10
pmdumplog -l $ARCHIVE # log is from when, till when?
pcp --archive $ARCHIVE --start @10:30 dstat 10 5
pcp --archive $ARCHIVE --start @10:30 dstat --time 10 5
# how much traffic was there at midnight on my interface?
pcp --archive $ARCHIVE --start @0:00 dstat --time 60 30 -n -N ens3,lo
# dstat plugins
pcp dstat --redis
cat /etc/pcp/dstat/redis
pminfo redis
mkdir ~/.pcp/dstat
cp /etc/pcp/dstat/redis ~/.pcp/dstat/redis-extra
pcp dstat --list
pcp dstat --refis-extra