Bug fix pcp-5.3.5-4 update resolving QE-detected issues

Resolves: rhbz#2030138
This commit is contained in:
Nathan Scott 2021-12-17 10:47:12 +11:00
parent 51663f5738
commit 0b7bdac2cc
3 changed files with 545 additions and 108 deletions

View File

@ -15,6 +15,7 @@ Patch3: redhat-bugzilla-2027753.patch
Patch4: redhat-bugzilla-2030140.patch
Patch5: redhat-bugzilla-2024982.patch
Patch6: redhat-bugzilla-2024980.patch
Patch7: redhat-bugzilla-1973833.patch
%if 0%{?fedora} >= 26 || 0%{?rhel} > 7
%global __python2 python2
@ -2290,6 +2291,7 @@ updated policy package.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
# the buildsubdir macro gets defined in %setup and is apparently only available in the next step (i.e. the %build step)
@ -2969,40 +2971,36 @@ then
# stop daemons before erasing the package
%if !%{disable_systemd}
%systemd_preun pmlogger.service
%systemd_preun pmlogger_check.timer
%systemd_preun pmlogger_daily.timer
%systemd_preun pmlogger_farm.service
%systemd_preun pmlogger_farm_check.service
%systemd_preun pmlogger_farm_check.timer
%systemd_preun pmie.service
%systemd_preun pmie_check.timer
%systemd_preun pmie_daily.timer
%systemd_preun pmie_farm.service
%systemd_preun pmie_farm_check.service
%systemd_preun pmie_farm_check.timer
%systemd_preun pmproxy.service
%systemd_preun pmfind.service
%systemd_preun pmcd.service
%systemd_preun pmlogger_daily.timer
%systemd_preun pmlogger_check.timer
%systemd_preun pmlogger_farm_check.timer
%systemd_preun pmie_daily.timer
%systemd_preun pmie_check.timer
%systemd_preun pmie_farm_check.timer
systemctl stop pmlogger.service >/dev/null 2>&1
systemctl stop pmlogger_farm.service >/dev/null 2>&1
systemctl stop pmie.service >/dev/null 2>&1
systemctl stop pmie_farm.service >/dev/null 2>&1
systemctl stop pmproxy.service >/dev/null 2>&1
systemctl stop pmfind.service >/dev/null 2>&1
systemctl stop pmcd.service >/dev/null 2>&1
%else
/sbin/service pmlogger stop >/dev/null 2>&1
/sbin/service pmlogger_farm stop >/dev/null 2>&1
/sbin/service pmie stop >/dev/null 2>&1
/sbin/service pmie_farm stop >/dev/null 2>&1
/sbin/service pmproxy stop >/dev/null 2>&1
/sbin/service pmcd stop >/dev/null 2>&1
/sbin/chkconfig --del pcp >/dev/null 2>&1
/sbin/chkconfig --del pmcd >/dev/null 2>&1
/sbin/chkconfig --del pmlogger >/dev/null 2>&1
/sbin/chkconfig --del pmlogger_farm >/dev/null 2>&1
/sbin/chkconfig --del pmie >/dev/null 2>&1
/sbin/chkconfig --del pmie_farm >/dev/null 2>&1
/sbin/chkconfig --del pmproxy >/dev/null 2>&1
%endif
# cleanup namespace state/flag, may still exist
@ -3075,12 +3073,8 @@ PCP_LOG_DIR=%{_logsdir}
/sbin/service pmcd condrestart
/sbin/chkconfig --add pmlogger >/dev/null 2>&1
/sbin/service pmlogger condrestart
/sbin/chkconfig --add pmlogger_farm >/dev/null 2>&1
/sbin/service pmlogger_farm condrestart
/sbin/chkconfig --add pmie >/dev/null 2>&1
/sbin/service pmie condrestart
/sbin/chkconfig --add pmie_farm >/dev/null 2>&1
/sbin/service pmie_farm condrestart
/sbin/chkconfig --add pmproxy >/dev/null 2>&1
/sbin/service pmproxy condrestart
%endif
@ -3380,11 +3374,12 @@ PCP_LOG_DIR=%{_logsdir}
%files zeroconf -f pcp-zeroconf-files.rpm
%changelog
* Wed Dec 15 2021 Nathan Scott <nathans@redhat.com> - 5.3.5-4
* Fri Dec 17 2021 Nathan Scott <nathans@redhat.com> - 5.3.5-4
- pmdabcc: resolve compilation issues of some bcc PMDA modules on
aarch64, ppc64le and s390x (BZ 2024982)
- pmdabpf: support arm and powerpc architectures (BZ 2024980)
- TODO
- Further improve pmlogger service startup latency (BZ 1973833)
- Additional improvements to farm systemd services (BZ 2030138)
* Thu Dec 09 2021 Nathan Scott <nathans@redhat.com> - 5.3.5-3
- Resolve failure in the Nvidia metrics agent (BZ 2030123)

View File

@ -0,0 +1,193 @@
commit 6b907e90c74fce82d6b712493d8b362bdd1a1ec1
Author: Nathan Scott <nathans@redhat.com>
Date: Tue Dec 14 08:54:14 2021 +1100
pmlogconf: switch to the bulk pmLookupDescs(3) interface
No functional change, all existing regression tests pass.
Related to Red Hat BZ #1973833.
diff --git a/src/pmlogconf/pmlogconf.c b/src/pmlogconf/pmlogconf.c
index fa1156859d..ef4fc08bbd 100644
--- a/src/pmlogconf/pmlogconf.c
+++ b/src/pmlogconf/pmlogconf.c
@@ -473,13 +473,19 @@ fetch_groups(void)
{
static pmResult *result;
const char **names;
+ pmDesc *descs;
pmID *pmids;
- int i, n, sts;
+ int i, n, sts, count;
- /* prepare arrays of names and identifiers for PMAPI metric lookup */
+ /* prepare arrays of names, descriptors and IDs for PMAPI metric lookup */
if ((names = calloc(ngroups, sizeof(char *))) == NULL)
return -ENOMEM;
+ if ((descs = calloc(ngroups, sizeof(pmDesc))) == NULL) {
+ free(names);
+ return -ENOMEM;
+ }
if ((pmids = calloc(ngroups, sizeof(pmID))) == NULL) {
+ free(descs);
free(names);
return -ENOMEM;
}
@@ -490,15 +496,16 @@ fetch_groups(void)
continue;
names[n++] = (const char *)groups[i].metric;
}
+ count = n;
- if ((sts = pmLookupName(n, names, pmids)) < 0) {
- if (n == 1)
+ if ((sts = pmLookupName(count, names, pmids)) < 0) {
+ if (count == 1)
groups[0].pmid = PM_ID_NULL;
else
fprintf(stderr, "%s: cannot lookup metric names: %s\n",
pmGetProgname(), pmErrStr(sts));
}
- else if ((sts = pmFetch(n, pmids, &result)) < 0) {
+ else if ((sts = pmFetch(count, pmids, &result)) < 0) {
fprintf(stderr, "%s: cannot fetch metric values: %s\n",
pmGetProgname(), pmErrStr(sts));
}
@@ -510,6 +517,13 @@ fetch_groups(void)
else
groups[i].pmid = pmids[n++];
}
+ /* descriptor lookup, descs_hash handles failure here */
+ (void) pmLookupDescs(count, pmids, descs);
+
+ /* create a hash over the descs for quick PMID lookup */
+ if ((sts = descs_hash(count, descs)) < 0)
+ fprintf(stderr, "%s: cannot hash metric descs: %s\n",
+ pmGetProgname(), pmErrStr(sts));
/* create a hash over the result for quick PMID lookup */
if ((sts = values_hash(result)) < 0)
fprintf(stderr, "%s: cannot hash metric values: %s\n",
@@ -806,14 +820,16 @@ evaluate_string_regexp(group_t *group, regex_cmp_t compare)
int i, found;
pmValueSet *vsp;
pmValue *vp;
+ pmDesc *dp;
pmAtomValue atom;
regex_t regex;
int sts, type;
- if ((vsp = metric_values(group->pmid)) == NULL)
+ if ((vsp = metric_values(group->pmid)) == NULL ||
+ (dp = metric_desc(group->pmid)) == NULL)
return 0;
- type = metric_type(group->pmid);
+ type = dp->type;
if (type < 0 || type > PM_TYPE_STRING) {
fprintf(stderr, "%s: %s uses regular expression on non-scalar metric\n",
pmGetProgname(), group->tag);
@@ -849,11 +865,14 @@ evaluate_string_regexp(group_t *group, regex_cmp_t compare)
static int
evaluate_values(group_t *group, numeric_cmp_t ncmp, string_cmp_t scmp)
{
- int type = metric_type(group->pmid);
+ pmDesc *dp;
+
+ if ((dp = metric_desc(group->pmid)) == NULL)
+ return 0;
- if (type == PM_TYPE_STRING)
+ if (dp->type == PM_TYPE_STRING)
return evaluate_string_values(group, scmp);
- return evaluate_number_values(group, type, ncmp);
+ return evaluate_number_values(group, dp->type, ncmp);
}
int
diff --git a/src/pmlogconf/util.c b/src/pmlogconf/util.c
index d44c2e529a..293eb2eca3 100644
--- a/src/pmlogconf/util.c
+++ b/src/pmlogconf/util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Red Hat. All Rights Reserved.
+ * Copyright (c) 2020-2021 Red Hat. 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
@@ -14,7 +14,7 @@
#include "util.h"
static __pmHashCtl valuesctl; /* pointers to values in pmResult */
-static __pmHashCtl typesctl; /* metric types from pmLookupDesc */
+static __pmHashCtl descsctl; /* metric descs from pmLookupDesc */
int
values_hash(pmResult *result)
@@ -47,27 +47,33 @@ metric_values(pmID pmid)
}
int
-metric_type(pmID pmid)
+descs_hash(int numpmid, pmDesc *descs)
{
- __pmHashNode *node;
- pmDesc desc;
- int sts, *data;
+ unsigned int i;
+ pmDesc *dp;
+ int sts;
- if (pmid == PM_IN_NULL)
- return PM_TYPE_UNKNOWN;
- if ((node = __pmHashSearch(pmid, &typesctl)) == NULL) {
- if ((sts = pmLookupDesc(pmid, &desc)) < 0)
- return sts;
- if ((data = malloc(sizeof(int))) == NULL)
- return sts;
- *data = desc.type;
- if ((sts = __pmHashAdd(pmid, data, &typesctl)) < 0) {
- free(data);
+ if ((sts = __pmHashPreAlloc(numpmid, &descsctl)) < 0)
+ return sts;
+
+ for (i = 0; i < numpmid; i++) {
+ dp = &descs[i];
+ if ((sts = __pmHashAdd(dp->pmid, dp, &descsctl)) < 0)
return sts;
- }
- return *data;
}
- return *(int *)node->data;
+ return numpmid;
+}
+
+pmDesc *
+metric_desc(pmID pmid)
+{
+ __pmHashNode *node;
+
+ if (pmid == PM_IN_NULL)
+ return NULL;
+ if ((node = __pmHashSearch(pmid, &descsctl)) == NULL)
+ return NULL;
+ return (pmDesc *)node->data;
}
int
diff --git a/src/pmlogconf/util.h b/src/pmlogconf/util.h
index 17d856a0d7..a11350d899 100644
--- a/src/pmlogconf/util.h
+++ b/src/pmlogconf/util.h
@@ -34,7 +34,9 @@ extern void fmt(const char *, char *, size_t, int, int, fmt_t, void *);
extern int values_hash(pmResult *);
extern pmValueSet *metric_values(pmID);
-extern int metric_type(pmID);
+
+extern int descs_hash(int, pmDesc *);
+extern pmDesc *metric_desc(pmID);
typedef int (*numeric_cmp_t)(double, double);
extern int number_equal(double, double);

View File

@ -1,92 +1,51 @@
commit b076a10d6901338707cb5e5d503fc25e2f36ba94
Author: Nathan Scott <nathans@redhat.com>
Date: Wed Dec 8 15:24:49 2021 +1100
Resolve inconsistencies in new 'farm' and other systemd units
This change most importantly introduces the Wants= line Mark
(and Jan earlier, indirectly) proposed to make pmlogger_farm
handling function as end-users will expect when manipulating
the pmlogger.service. Ditto for pmie.
There's also several cleanups of things that are inconsistent
and just plain wrong or missing, particularly in spec files.
This supercedes PR #1492 and PR #1489.
This resolves Red Hat BZ #2027753.
diff --git a/src/pmie/pmie.service.in b/src/pmie/pmie.service.in
index d234c8a5e5..bf4e64980a 100644
--- a/src/pmie/pmie.service.in
+++ b/src/pmie/pmie.service.in
@@ -4,7 +4,7 @@ Documentation=man:pmie(1)
After=network-online.target pmcd.service
Before=pmie_check.timer pmie_daily.timer
BindsTo=pmie_check.timer pmie_daily.timer
-Wants=pmcd.service
+Wants=pmcd.service pmie_farm.service
diff -Naurp pcp-5.3.5.orig/src/pmie/GNUmakefile pcp-5.3.5/src/pmie/GNUmakefile
--- pcp-5.3.5.orig/src/pmie/GNUmakefile 2021-11-09 10:50:58.000000000 +1100
+++ pcp-5.3.5/src/pmie/GNUmakefile 2021-12-15 16:51:51.306200748 +1100
@@ -84,7 +84,6 @@ pmie.service : pmie.service.in
pmie_farm.service : pmie_farm.service.in
$(SED) <$< >$@ \
- -e 's;@CRONTAB_PATH@;'$(CRONTAB_PATH)';' \
-e 's;@PCP_SYSCONFIG_DIR@;'$(PCP_SYSCONFIG_DIR)';' \
-e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
-e 's;@PCP_VAR_DIR@;'$(PCP_VAR_DIR)';' \
@@ -95,7 +94,9 @@ pmie_farm.service : pmie_farm.service.in
pmie_farm_check.service : pmie_farm_check.service.in
$(SED) <$< >$@ \
+ -e 's;@CRONTAB_PATH@;'$(CRONTAB_PATH)';' \
-e 's;@PCP_BIN_DIR@;'$(PCP_BIN_DIR)';' \
+ -e 's;@PCP_VAR_DIR@;'$(PCP_VAR_DIR)';' \
# END
pmie_check.service : pmie_check.service.in
diff -Naurp pcp-5.3.5.orig/src/pmie/pmie_farm_check.service.in pcp-5.3.5/src/pmie/pmie_farm_check.service.in
--- pcp-5.3.5.orig/src/pmie/pmie_farm_check.service.in 2021-11-09 10:50:58.000000000 +1100
+++ pcp-5.3.5/src/pmie/pmie_farm_check.service.in 2021-12-15 16:51:51.306200748 +1100
@@ -1,7 +1,7 @@
[Unit]
-Description=Check and migrate non-primary pmie instances to pmie_farm
-Documentation=man:pmie_check(1)
-# TODO non-systemd ConditionPathExists=!/etc/cron.d/pcp-pmie
+Description=Check and migrate non-primary pmie farm instances
+Documentation=man:pmiectl(1)
+ConditionPathExists=!@CRONTAB_PATH@
[Service]
Type=notify
diff --git a/src/pmie/pmie_farm.service.in b/src/pmie/pmie_farm.service.in
index 6679e48ba1..5459adb310 100644
--- a/src/pmie/pmie_farm.service.in
+++ b/src/pmie/pmie_farm.service.in
@@ -22,6 +22,3 @@ User=@PCP_USER@
[Install]
WantedBy=multi-user.target
Type=exec
@@ -9,8 +9,7 @@ Restart=no
TimeoutStartSec=4h
TimeoutStopSec=120
ExecStart=@PCP_BIN_DIR@/pmiectl -m check
-WorkingDirectory=/var/lib/pcp
-
-# This dependency will be removed in PCPv6.
-WantedBy=pmie.service
diff --git a/src/pmlogger/pmlogger.service.in b/src/pmlogger/pmlogger.service.in
index de0df29db1..59299ac15d 100644
--- a/src/pmlogger/pmlogger.service.in
+++ b/src/pmlogger/pmlogger.service.in
@@ -4,7 +4,7 @@ Documentation=man:pmlogger(1)
After=network-online.target pmcd.service
Before=pmlogger_check.timer pmlogger_daily.timer
BindsTo=pmlogger_check.timer pmlogger_daily.timer
-Wants=pmcd.service
+Wants=pmcd.service pmlogger_farm.service
[Service]
Type=notify
diff --git a/src/pmlogger/pmlogger_farm.service.in b/src/pmlogger/pmlogger_farm.service.in
index fe753afdf6..3bfa2e7098 100644
--- a/src/pmlogger/pmlogger_farm.service.in
+++ b/src/pmlogger/pmlogger_farm.service.in
@@ -22,6 +22,3 @@ User=@PCP_USER@
[Install]
WantedBy=multi-user.target
-
-# This dependency will be removed in PCPv6.
-WantedBy=pmlogger.service
commit cc2dddfb7a04d98f97bdf759f057bae2727260ff
Author: Nathan Scott <nathans@redhat.com>
Date: Thu Dec 9 10:41:22 2021 +1100
Resolve inconsistencies in new 'farm' systemd timers
When the farm systemd timers were introduced the check interval
was drastically reduced from half hourly to 5 minutely. There
wasn't any discussion about rationales for this and its now not
consistent (does not dovetail at all) with the primary pmlogger
and pmie service. If startup takes a long time (large farms or
slow networks) these will likely overlap constantly, and timing
should be such that we work with the primary services in mind.
Reset to half hourly for these checks, and lets revisit this in
the new year when the other systemd changes are being proposed.
Related to https://github.com/performancecopilot/pcp/pull/1495
diff --git a/src/pmie/pmie_farm_check.timer b/src/pmie/pmie_farm_check.timer
index ee7aa21242..97dc061af2 100644
--- a/src/pmie/pmie_farm_check.timer
+++ b/src/pmie/pmie_farm_check.timer
+WorkingDirectory=@PCP_VAR_DIR@
# root so pmiectl can migrate pmie processes to the pmie_farm service
Group=root
User=root
diff -Naurp pcp-5.3.5.orig/src/pmie/pmie_farm_check.timer pcp-5.3.5/src/pmie/pmie_farm_check.timer
--- pcp-5.3.5.orig/src/pmie/pmie_farm_check.timer 2021-11-04 08:26:15.000000000 +1100
+++ pcp-5.3.5/src/pmie/pmie_farm_check.timer 2021-12-15 16:51:49.649229430 +1100
@@ -1,10 +1,11 @@
[Unit]
-Description=5 minute check of pmie farm instances
@ -102,10 +61,87 @@ index ee7aa21242..97dc061af2 100644
[Install]
WantedBy=timers.target
diff --git a/src/pmlogger/pmlogger_farm_check.timer b/src/pmlogger/pmlogger_farm_check.timer
index 094fb4505d..f234ef7839 100644
--- a/src/pmlogger/pmlogger_farm_check.timer
+++ b/src/pmlogger/pmlogger_farm_check.timer
diff -Naurp pcp-5.3.5.orig/src/pmie/pmie_farm.service.in pcp-5.3.5/src/pmie/pmie_farm.service.in
--- pcp-5.3.5.orig/src/pmie/pmie_farm.service.in 2021-11-04 08:26:15.000000000 +1100
+++ pcp-5.3.5/src/pmie/pmie_farm.service.in 2021-12-15 16:51:51.306200748 +1100
@@ -1,9 +1,8 @@
[Unit]
Description=pmie farm service
-Documentation=man:pmie(1)
-After=network-online.target pmcd.service
-Before=pmie_check.timer pmie_daily.timer
-BindsTo=pmie_farm_check.timer pmie_check.timer pmie_daily.timer
+Documentation=man:pmie_check(1)
+Before=pmie_farm_check.timer
+BindsTo=pmie_farm_check.timer
[Service]
Type=@SD_SERVICE_TYPE@
@@ -15,13 +14,9 @@ TimeoutStopSec=120
Environment="PMIE_CHECK_PARAMS=--skip-primary"
EnvironmentFile=-@PCP_SYSCONFIG_DIR@/pmie_timers
ExecStart=@PCP_BINADM_DIR@/pmie_farm $PMIE_CHECK_PARAMS
-
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
[Install]
-WantedBy=multi-user.target
-
-# This dependency will be removed in PCPv6.
-WantedBy=pmie.service
+RequiredBy=pmie.service
diff -Naurp pcp-5.3.5.orig/src/pmlogger/GNUmakefile pcp-5.3.5/src/pmlogger/GNUmakefile
--- pcp-5.3.5.orig/src/pmlogger/GNUmakefile 2021-11-09 09:08:40.000000000 +1100
+++ pcp-5.3.5/src/pmlogger/GNUmakefile 2021-12-15 16:51:51.306200748 +1100
@@ -99,7 +99,6 @@ pmlogger.service : pmlogger.service.in
pmlogger_farm.service : pmlogger_farm.service.in
$(SED) <$< >$@ \
- -e 's;@CRONTAB_PATH@;'$(CRONTAB_PATH)';' \
-e 's;@PCP_SYSCONFIG_DIR@;'$(PCP_SYSCONFIG_DIR)';' \
-e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
-e 's;@PCP_VAR_DIR@;'$(PCP_VAR_DIR)';' \
@@ -110,7 +109,9 @@ pmlogger_farm.service : pmlogger_farm.se
pmlogger_farm_check.service : pmlogger_farm_check.service.in
$(SED) <$< >$@ \
+ -e 's;@CRONTAB_PATH@;'$(CRONTAB_PATH)';' \
-e 's;@PCP_BIN_DIR@;'$(PCP_BIN_DIR)';' \
+ -e 's;@PCP_VAR_DIR@;'$(PCP_VAR_DIR)';' \
# END
pmlogger_daily.service : pmlogger_daily.service.in
diff -Naurp pcp-5.3.5.orig/src/pmlogger/pmlogger_farm_check.service.in pcp-5.3.5/src/pmlogger/pmlogger_farm_check.service.in
--- pcp-5.3.5.orig/src/pmlogger/pmlogger_farm_check.service.in 2021-11-09 09:08:40.000000000 +1100
+++ pcp-5.3.5/src/pmlogger/pmlogger_farm_check.service.in 2021-12-15 16:51:51.307200731 +1100
@@ -1,7 +1,7 @@
[Unit]
-Description=Check and migrate non-primary pmlogger instances to pmlogger_farm
-Documentation=man:pmlogger_check(1)
-# TODO non-systemd ConditionPathExists=!/etc/cron.d/pcp-pmlogger
+Description=Check and migrate non-primary pmlogger farm instances
+Documentation=man:pmlogctl(1)
+ConditionPathExists=!@CRONTAB_PATH@
[Service]
Type=exec
@@ -9,9 +9,8 @@ Restart=no
TimeoutStartSec=4h
TimeoutStopSec=120
ExecStart=@PCP_BIN_DIR@/pmlogctl -m check
-WorkingDirectory=/var/lib/pcp
-
-# root so pmlogctl can migrate pmloggers to the pmlogger_farm service
+WorkingDirectory=@PCP_VAR_DIR@
+# root so pmlogctl can migrate pmlogger processes to the pmlogger_farm service
Group=root
User=root
diff -Naurp pcp-5.3.5.orig/src/pmlogger/pmlogger_farm_check.timer pcp-5.3.5/src/pmlogger/pmlogger_farm_check.timer
--- pcp-5.3.5.orig/src/pmlogger/pmlogger_farm_check.timer 2021-11-04 08:26:15.000000000 +1100
+++ pcp-5.3.5/src/pmlogger/pmlogger_farm_check.timer 2021-12-15 16:51:49.649229430 +1100
@@ -1,10 +1,11 @@
[Unit]
-Description=5 minute check of pmlogger farm instances
@ -121,3 +157,216 @@ index 094fb4505d..f234ef7839 100644
[Install]
WantedBy=timers.target
diff -Naurp pcp-5.3.5.orig/src/pmlogger/pmlogger_farm.service.in pcp-5.3.5/src/pmlogger/pmlogger_farm.service.in
--- pcp-5.3.5.orig/src/pmlogger/pmlogger_farm.service.in 2021-11-04 08:26:15.000000000 +1100
+++ pcp-5.3.5/src/pmlogger/pmlogger_farm.service.in 2021-12-15 16:51:51.306200748 +1100
@@ -1,9 +1,8 @@
[Unit]
Description=pmlogger farm service
-Documentation=man:pmlogger(1)
-After=network-online.target pmcd.service
-Before=pmlogger_check.timer pmlogger_daily.timer
-BindsTo=pmlogger_farm_check.timer pmlogger_check.timer pmlogger_daily.timer
+Documentation=man:pmlogger_check(1)
+Before=pmlogger_farm_check.timer
+BindsTo=pmlogger_farm_check.timer
[Service]
Type=@SD_SERVICE_TYPE@
@@ -15,13 +14,9 @@ TimeoutStopSec=120
Environment="PMLOGGER_CHECK_PARAMS=--skip-primary"
EnvironmentFile=-@PCP_SYSCONFIG_DIR@/pmlogger_timers
ExecStart=@PCP_BINADM_DIR@/pmlogger_farm $PMLOGGER_CHECK_PARAMS
-
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
[Install]
-WantedBy=multi-user.target
-
-# This dependency will be removed in PCPv6.
-WantedBy=pmlogger.service
+RequiredBy=pmlogger.service
commit 7d6e266d0a15ba0fd0894a059257a502f19b7fe9
Author: Nathan Scott <nathans@redhat.com>
Date: Thu Dec 16 17:38:33 2021 +1100
pmlogger/pmie farms: further consistency changes and hard dep fix
Several inconsistencies between various pmie/pmlogger systemd units
resolved. Most importantly, add BindsTo lines to ensure the farms
get started and stopped along with the underlying service, always.
diff --git a/src/pmie/pmie.service.in b/src/pmie/pmie.service.in
index d234c8a5e5..d659c39c65 100644
--- a/src/pmie/pmie.service.in
+++ b/src/pmie/pmie.service.in
@@ -2,8 +2,8 @@
Description=Performance Metrics Inference Engine
Documentation=man:pmie(1)
After=network-online.target pmcd.service
-Before=pmie_check.timer pmie_daily.timer
-BindsTo=pmie_check.timer pmie_daily.timer
+Before=pmie_farm.service pmie_check.timer pmie_daily.timer
+BindsTo=pmie_farm.service pmie_check.timer pmie_daily.timer
Wants=pmcd.service
[Service]
diff --git a/src/pmie/pmie_daily.service.in b/src/pmie/pmie_daily.service.in
index e93446ce83..ca49945905 100644
--- a/src/pmie/pmie_daily.service.in
+++ b/src/pmie/pmie_daily.service.in
@@ -2,13 +2,18 @@
Description=Process PMIE logs
Documentation=man:pmie_daily(1)
ConditionPathExists=!@CRONTAB_PATH@
+PartOf=pmie.service
[Service]
Type=@SD_SERVICE_TYPE@
Restart=no
+TimeoutStartSec=1h
Environment="PMIE_DAILY_PARAMS=-X xz -x 3"
EnvironmentFile=-@PCP_SYSCONFIG_DIR@/pmie_timers
ExecStart=@PCP_BINADM_DIR@/pmie_daily $PMIE_DAILY_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
+
+[Install]
+RequiredBy=pmie.service
diff --git a/src/pmie/pmie_daily.timer b/src/pmie/pmie_daily.timer
index 42b86333be..67742a070e 100644
--- a/src/pmie/pmie_daily.timer
+++ b/src/pmie/pmie_daily.timer
@@ -1,7 +1,9 @@
[Unit]
Description=Daily processing of PMIE logs
+PartOf=pmie.service
[Timer]
+Persistent=true
OnCalendar=*-*-* 00:08:00
[Install]
diff --git a/src/pmie/pmie_farm.service.in b/src/pmie/pmie_farm.service.in
index 0f7e7e46b8..e119388b4b 100644
--- a/src/pmie/pmie_farm.service.in
+++ b/src/pmie/pmie_farm.service.in
@@ -3,6 +3,7 @@ Description=pmie farm service
Documentation=man:pmie_check(1)
Before=pmie_farm_check.timer
BindsTo=pmie_farm_check.timer
+PartOf=pmie.service
[Service]
Type=@SD_SERVICE_TYPE@
diff --git a/src/pmie/pmie_farm.sh b/src/pmie/pmie_farm.sh
index f2771ad43b..400e790cae 100644
--- a/src/pmie/pmie_farm.sh
+++ b/src/pmie/pmie_farm.sh
@@ -12,8 +12,8 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
-# Administrative script to start the pmlogger_farm service.
-# All arguments to pmlogger_check are passed from pmlogger_farm.service.
+# Administrative script to start the pmie_farm service.
+# All arguments to pmie_check are passed from pmie_farm.service.
#
. $PCP_DIR/etc/pcp.env
diff --git a/src/pmie/pmie_farm_check.service.in b/src/pmie/pmie_farm_check.service.in
index 64f822ad53..01d83390a9 100644
--- a/src/pmie/pmie_farm_check.service.in
+++ b/src/pmie/pmie_farm_check.service.in
@@ -2,6 +2,7 @@
Description=Check and migrate non-primary pmie farm instances
Documentation=man:pmiectl(1)
ConditionPathExists=!@CRONTAB_PATH@
+PartOf=pmie_farm.service
[Service]
Type=exec
diff --git a/src/pmlogger/pmlogger.service.in b/src/pmlogger/pmlogger.service.in
index de0df29db1..b0d706027a 100644
--- a/src/pmlogger/pmlogger.service.in
+++ b/src/pmlogger/pmlogger.service.in
@@ -2,8 +2,8 @@
Description=Performance Metrics Archive Logger
Documentation=man:pmlogger(1)
After=network-online.target pmcd.service
-Before=pmlogger_check.timer pmlogger_daily.timer
-BindsTo=pmlogger_check.timer pmlogger_daily.timer
+Before=pmlogger_farm.service pmlogger_check.timer pmlogger_daily.timer
+BindsTo=pmlogger_farm.service pmlogger_check.timer pmlogger_daily.timer
Wants=pmcd.service
[Service]
diff --git a/src/pmlogger/pmlogger_check.service.in b/src/pmlogger/pmlogger_check.service.in
index 8fcef57e0f..db7edf0b0f 100644
--- a/src/pmlogger/pmlogger_check.service.in
+++ b/src/pmlogger/pmlogger_check.service.in
@@ -2,6 +2,7 @@
Description=Check pmlogger instances are running
Documentation=man:pmlogger_check(1)
ConditionPathExists=!@CRONTAB_PATH@
+PartOf=pmlogger.service
[Service]
Type=@SD_SERVICE_TYPE@
diff --git a/src/pmlogger/pmlogger_check.timer b/src/pmlogger/pmlogger_check.timer
index e3f3c4fc40..ddffc7584a 100644
--- a/src/pmlogger/pmlogger_check.timer
+++ b/src/pmlogger/pmlogger_check.timer
@@ -1,5 +1,6 @@
[Unit]
Description=Half-hourly check of pmlogger instances
+PartOf=pmlogger.service
[Timer]
# if enabled, runs 1m after boot and every half hour
diff --git a/src/pmlogger/pmlogger_daily.service.in b/src/pmlogger/pmlogger_daily.service.in
index 8a07f5caa3..9a3cbf42b1 100644
--- a/src/pmlogger/pmlogger_daily.service.in
+++ b/src/pmlogger/pmlogger_daily.service.in
@@ -2,6 +2,7 @@
Description=Process archive logs
Documentation=man:pmlogger_daily(1)
ConditionPathExists=!@CRONTAB_PATH@
+PartOf=pmlogger.service
[Service]
Type=@SD_SERVICE_TYPE@
@@ -13,3 +14,6 @@ ExecStart=@PCP_BINADM_DIR@/pmlogger_daily $PMLOGGER_DAILY_PARAMS
WorkingDirectory=@PCP_VAR_DIR@
Group=@PCP_GROUP@
User=@PCP_USER@
+
+[Install]
+RequiredBy=pmlogger.service
diff --git a/src/pmlogger/pmlogger_farm.service.in b/src/pmlogger/pmlogger_farm.service.in
index a194ac39c7..a67e25f312 100644
--- a/src/pmlogger/pmlogger_farm.service.in
+++ b/src/pmlogger/pmlogger_farm.service.in
@@ -3,6 +3,7 @@ Description=pmlogger farm service
Documentation=man:pmlogger_check(1)
Before=pmlogger_farm_check.timer
BindsTo=pmlogger_farm_check.timer
+PartOf=pmlogger.service
[Service]
Type=@SD_SERVICE_TYPE@
diff --git a/src/pmlogger/pmlogger_farm_check.service.in b/src/pmlogger/pmlogger_farm_check.service.in
index 2ec3a5446b..de5e59a7f5 100644
--- a/src/pmlogger/pmlogger_farm_check.service.in
+++ b/src/pmlogger/pmlogger_farm_check.service.in
@@ -2,6 +2,7 @@
Description=Check and migrate non-primary pmlogger farm instances
Documentation=man:pmlogctl(1)
ConditionPathExists=!@CRONTAB_PATH@
+PartOf=pmlogger_farm.service
[Service]
Type=exec