mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin
@ 2017-04-21 20:42 Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 2/7] collectd: improve systemd service file Clemens Gruber
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Also select RRDTOOL_RRDCACHED if rrdcached plugin is used.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 projectroot/etc/collectd.d/memory.conf    |  1 +
 projectroot/etc/collectd.d/ping.conf      |  5 +++++
 projectroot/etc/collectd.d/rrdcached.conf |  7 +++++++
 rules/collectd.in                         | 28 ++++++++++++++++++++++++++--
 rules/collectd.make                       |  6 +++---
 5 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 projectroot/etc/collectd.d/memory.conf
 create mode 100644 projectroot/etc/collectd.d/ping.conf
 create mode 100644 projectroot/etc/collectd.d/rrdcached.conf

diff --git a/projectroot/etc/collectd.d/memory.conf b/projectroot/etc/collectd.d/memory.conf
new file mode 100644
index 000000000..249ff7f2e
--- /dev/null
+++ b/projectroot/etc/collectd.d/memory.conf
@@ -0,0 +1 @@
+LoadPlugin memory
diff --git a/projectroot/etc/collectd.d/ping.conf b/projectroot/etc/collectd.d/ping.conf
new file mode 100644
index 000000000..f8d63a1bb
--- /dev/null
+++ b/projectroot/etc/collectd.d/ping.conf
@@ -0,0 +1,5 @@
+LoadPlugin ping
+
+<Plugin "ping">
+  Host 8.8.8.8 # changeme
+</Plugin>
diff --git a/projectroot/etc/collectd.d/rrdcached.conf b/projectroot/etc/collectd.d/rrdcached.conf
new file mode 100644
index 000000000..9e8206677
--- /dev/null
+++ b/projectroot/etc/collectd.d/rrdcached.conf
@@ -0,0 +1,7 @@
+LoadPlugin rrdcached
+
+<Plugin "rrdcached">
+  DaemonAddress "unix:/tmp/rrdcached.sock"
+  DataDir "/var/lib/collectd/rrd"
+  CreateFiles true
+</Plugin>
diff --git a/rules/collectd.in b/rules/collectd.in
index ba359f092..015e4b6fe 100644
--- a/rules/collectd.in
+++ b/rules/collectd.in
@@ -2,8 +2,10 @@
 
 menuconfig COLLECTD
 	tristate
-	select RRDTOOL		if COLLECTD_RRDTOOL
-	select LM_SENSORS	if COLLECTD_SENSORS
+	select LIBOPING			if COLLECTD_PING
+	select RRDTOOL			if COLLECTD_RRDTOOL || COLLECTD_RRDCACHED
+	select RRDTOOL_RRDCACHED	if COLLECTD_RRDCACHED
+	select LM_SENSORS		if COLLECTD_SENSORS
 	prompt "collectd                      "
 	help
 	  collectd is a daemon which collects system performance statistics
@@ -35,6 +37,13 @@ config COLLECTD_RRDTOOL
 	  With the RRDtool plugin, collectd writes values into a
 	  round-robin database, using librrd.
 
+config COLLECTD_RRDCACHED
+	bool
+	prompt "rrdcached"
+	help
+	  Connects to the RRD caching daemon and submits updates
+	  for RRD files to that daemon.
+
 comment "Read Plugins"
 
 config COLLECTD_CPU
@@ -44,6 +53,21 @@ config COLLECTD_CPU
 	  The CPU plugin collects data about what your CPU is actually doing,
 	  and if it is being idle or in the various states.
 
+config COLLECTD_MEMORY
+	bool
+	prompt "memory"
+	help
+	  The Memory plugin collects physical memory utilization.
+
+config COLLECTD_PING
+	bool
+	prompt "ping"
+	help
+	  The Ping plugin starts a new thread which sends ICMP "ping" packets
+	  to the configured hosts periodically and measures the network
+	  latency.
+
+
 config COLLECTD_SENSORS
 	bool
 	prompt "sensors"
diff --git a/rules/collectd.make b/rules/collectd.make
index 73d1a1154..0c1a11330 100644
--- a/rules/collectd.make
+++ b/rules/collectd.make
@@ -119,7 +119,7 @@ COLLECTD_ENABLE-				+= mbmon
 COLLECTD_ENABLE-				+= md
 COLLECTD_ENABLE-				+= memcachec
 COLLECTD_ENABLE-				+= memcached
-COLLECTD_ENABLE-				+= memory
+COLLECTD_ENABLE-$(PTXCONF_COLLECTD_MEMORY)	+= memory
 COLLECTD_ENABLE-				+= mic
 COLLECTD_ENABLE-				+= modbus
 COLLECTD_ENABLE-				+= mqtt
@@ -144,7 +144,7 @@ COLLECTD_ENABLE-				+= oracle
 COLLECTD_ENABLE-				+= perl
 COLLECTD_ENABLE-				+= pf
 COLLECTD_ENABLE-				+= pinba
-COLLECTD_ENABLE-				+= ping
+COLLECTD_ENABLE-$(PTXCONF_COLLECTD_PING)	+= ping
 COLLECTD_ENABLE-				+= postgresql
 COLLECTD_ENABLE-				+= powerdns
 COLLECTD_ENABLE-				+= processes
@@ -152,7 +152,7 @@ COLLECTD_ENABLE-				+= protocols
 COLLECTD_ENABLE-				+= python
 COLLECTD_ENABLE-				+= redis
 COLLECTD_ENABLE-				+= routeros
-COLLECTD_ENABLE-				+= rrdcached
+COLLECTD_ENABLE-$(PTXCONF_COLLECTD_RRDCACHED)	+= rrdcached
 COLLECTD_ENABLE-$(PTXCONF_COLLECTD_RRDTOOL)	+= rrdtool
 COLLECTD_ENABLE-$(PTXCONF_COLLECTD_SENSORS)	+= sensors
 COLLECTD_ENABLE-				+= serial
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 2/7] collectd: improve systemd service file
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-28 12:47   ` Michael Olbrich
  2017-04-21 20:42 ` [ptxdist] [PATCH 3/7] collectd: version bump 5.7.0 -> 5.7.1 Clemens Gruber
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

collectd supports systemd notify. Also add requirements and increase
RestartSec. This is the Debian service file without docs and default
env file.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 projectroot/lib/systemd/system/collectd.service | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/projectroot/lib/systemd/system/collectd.service b/projectroot/lib/systemd/system/collectd.service
index 752245c05..5748a6438 100644
--- a/projectroot/lib/systemd/system/collectd.service
+++ b/projectroot/lib/systemd/system/collectd.service
@@ -1,9 +1,16 @@
 [Unit]
-Description=statistics collection daemon
+Description=Statistics collection and monitoring daemon
+After=local-fs.target network.target
+Requires=local-fs.target network.target
+ConditionPathExists=/etc/collectd/collectd.conf
 
 [Service]
-ExecStart=/usr/sbin/collectd -f
+Type=notify
+NotifyAccess=main
+ExecStartPre=/usr/sbin/collectd -t
+ExecStart=/usr/sbin/collectd
 Restart=always
+RestartSec=10
 
 [Install]
 WantedBy=multi-user.target
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 3/7] collectd: version bump 5.7.0 -> 5.7.1
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 2/7] collectd: improve systemd service file Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 4/7] ethtool: version bump 4.8 -> 4.10 Clemens Gruber
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 rules/collectd.make | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rules/collectd.make b/rules/collectd.make
index 0c1a11330..820b452a4 100644
--- a/rules/collectd.make
+++ b/rules/collectd.make
@@ -17,11 +17,11 @@ PACKAGES-$(PTXCONF_COLLECTD) += collectd
 #
 # Paths and names
 #
-COLLECTD_VERSION	:= 5.7.0
+COLLECTD_VERSION	:= 5.7.1
 COLLECTD		:= collectd-$(COLLECTD_VERSION)
 COLLECTD_SUFFIX		:= tar.bz2
 COLLECTD_URL		:= http://collectd.org/files/${COLLECTD}.${COLLECTD_SUFFIX}
-COLLECTD_MD5		:= c5cbe74a5638cac793caa13b3df60ce1
+COLLECTD_MD5		:= dc36141ed3058c4919bbd54b87c07873
 COLLECTD_DIR		:= $(BUILDDIR)/$(COLLECTD)
 COLLECTD_SOURCE		:= $(SRCDIR)/$(COLLECTD).$(COLLECTD_SUFFIX)
 COLLECTD_LICENSE	:= GPL2
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 4/7] ethtool: version bump 4.8 -> 4.10
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 2/7] collectd: improve systemd service file Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 3/7] collectd: version bump 5.7.0 -> 5.7.1 Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 5/7] liboping: version bump 1.6.2 -> 1.9.0 Clemens Gruber
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 rules/ethtool.make | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rules/ethtool.make b/rules/ethtool.make
index dd91956f4..f1ec9e777 100644
--- a/rules/ethtool.make
+++ b/rules/ethtool.make
@@ -17,8 +17,8 @@ PACKAGES-$(PTXCONF_ETHTOOL) += ethtool
 #
 # Paths and names
 #
-ETHTOOL_VERSION	:= 4.8
-ETHTOOL_MD5	:= e9e7286178f172c9f21bafbfb978d6de
+ETHTOOL_VERSION	:= 4.10
+ETHTOOL_MD5	:= e462579c12bcf306730600d571b0458c
 ETHTOOL_SUFFIX	:= tar.xz
 ETHTOOL		:= ethtool-$(ETHTOOL_VERSION)
 ETHTOOL_URL	:= $(call ptx/mirror, KERNEL, ../software/network/ethtool/$(ETHTOOL).$(ETHTOOL_SUFFIX))
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 5/7] liboping: version bump 1.6.2 -> 1.9.0
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
                   ` (2 preceding siblings ...)
  2017-04-21 20:42 ` [ptxdist] [PATCH 4/7] ethtool: version bump 4.8 -> 4.10 Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 6/7] net-snmp: add patch for CVE-2015-5621 Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached Clemens Gruber
  5 siblings, 0 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 rules/liboping.make | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rules/liboping.make b/rules/liboping.make
index 596a8d067..9f38b53b5 100644
--- a/rules/liboping.make
+++ b/rules/liboping.make
@@ -16,8 +16,8 @@ PACKAGES-$(PTXCONF_LIBOPING) += liboping
 #
 # Paths and names
 #
-LIBOPING_VERSION	:= 1.6.2
-LIBOPING_MD5		:= 6f3e0d38ea03362476ac3be8b3fd961e
+LIBOPING_VERSION	:= 1.9.0
+LIBOPING_MD5		:= 28d085b95d1ca1acd541fc2606d5e02d
 LIBOPING		:= liboping-$(LIBOPING_VERSION)
 LIBOPING_SUFFIX		:= tar.gz
 LIBOPING_URL		:= http://verplant.org/liboping/files/$(LIBOPING).$(LIBOPING_SUFFIX)
@@ -35,7 +35,9 @@ LIBOPING_LICENSE	:= LGPL-2.1+
 LIBOPING_CONF_TOOL	:= autoconf
 LIBOPING_CONF_OPT	:= \
 	$(CROSS_AUTOCONF_USR) \
+	--enable-shared \
 	--disable-static \
+	--disable-debug \
 	--without-perl-bindings
 
 # ----------------------------------------------------------------------------
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 6/7] net-snmp: add patch for CVE-2015-5621
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
                   ` (3 preceding siblings ...)
  2017-04-21 20:42 ` [ptxdist] [PATCH 5/7] liboping: version bump 1.6.2 -> 1.9.0 Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-21 20:42 ` [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached Clemens Gruber
  5 siblings, 0 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 ...02-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch | 128 +++++++++++++++++++++
 patches/net-snmp-5.7.3/series                      |   3 +-
 2 files changed, 130 insertions(+), 1 deletion(-)
 create mode 100644 patches/net-snmp-5.7.3/0002-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch

diff --git a/patches/net-snmp-5.7.3/0002-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch b/patches/net-snmp-5.7.3/0002-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch
new file mode 100644
index 000000000..7b804576b
--- /dev/null
+++ b/patches/net-snmp-5.7.3/0002-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch
@@ -0,0 +1,128 @@
+From: Hideki Yamane <henrich@debian.org>
+Date: Thu, 18 Jun 2015 06:21:20 +0900
+Subject: [PATCH] Bug#788964: net-snmp snmp_pdu_parse() DoS
+
+taken patch from https://sourceforge.net/p/net-snmp/code/ci/f23bcd3ac6ddee5d0a48f9703007ccc738914791/
+---
+ snmplib/snmp_api.c | 55 +++++++++++++++++++++++++++---------------------------
+ 1 file changed, 28 insertions(+), 27 deletions(-)
+
+diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
+index 191debf09a3d..adae4e4a9550 100644
+--- a/snmplib/snmp_api.c
++++ b/snmplib/snmp_api.c
+@@ -4350,10 +4350,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+     u_char          type;
+     u_char          msg_type;
+     u_char         *var_val;
+-    int             badtype = 0;
+     size_t          len;
+     size_t          four;
+-    netsnmp_variable_list *vp = NULL;
++    netsnmp_variable_list *vp = NULL, *vplast = NULL;
+     oid             objid[MAX_OID_LEN];
+     u_char         *p;
+ 
+@@ -4493,38 +4492,24 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+                               (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                               "varbinds");
+     if (data == NULL)
+-        return -1;
++        goto fail;
+ 
+     /*
+      * get each varBind sequence 
+      */
+     while ((int) *length > 0) {
+-        netsnmp_variable_list *vptemp;
+-        vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp));
+-        if (NULL == vptemp) {
+-            return -1;
+-        }
+-        if (NULL == vp) {
+-            pdu->variables = vptemp;
+-        } else {
+-            vp->next_variable = vptemp;
+-        }
+-        vp = vptemp;
++        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
++        if (NULL == vp)
++            goto fail;
+ 
+-        vp->next_variable = NULL;
+-        vp->val.string = NULL;
+         vp->name_length = MAX_OID_LEN;
+-        vp->name = NULL;
+-        vp->index = 0;
+-        vp->data = NULL;
+-        vp->dataFreeHook = NULL;
+         DEBUGDUMPSECTION("recv", "VarBind");
+         data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
+                                  &vp->val_len, &var_val, length);
+         if (data == NULL)
+-            return -1;
++            goto fail;
+         if (snmp_set_var_objid(vp, objid, vp->name_length))
+-            return -1;
++            goto fail;
+ 
+         len = MAX_PACKET_LENGTH;
+         DEBUGDUMPHEADER("recv", "Value");
+@@ -4604,7 +4589,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+                 vp->val.string = (u_char *) malloc(vp->val_len);
+             }
+             if (vp->val.string == NULL) {
+-                return -1;
++                goto fail;
+             }
+             p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
+                              &vp->val_len);
+@@ -4619,7 +4604,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+             vp->val_len *= sizeof(oid);
+             vp->val.objid = (oid *) malloc(vp->val_len);
+             if (vp->val.objid == NULL) {
+-                return -1;
++                goto fail;
+             }
+             memmove(vp->val.objid, objid, vp->val_len);
+             break;
+@@ -4631,7 +4616,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+         case ASN_BIT_STR:
+             vp->val.bitstring = (u_char *) malloc(vp->val_len);
+             if (vp->val.bitstring == NULL) {
+-                return -1;
++                goto fail;
+             }
+             p = asn_parse_bitstring(var_val, &len, &vp->type,
+                                 vp->val.bitstring, &vp->val_len);
+@@ -4640,12 +4625,28 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+             break;
+         default:
+             snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
+-            badtype = -1;
++            goto fail;
+             break;
+         }
+         DEBUGINDENTADD(-4);
++
++        if (NULL == vplast) {
++            pdu->variables = vp;
++        } else {
++            vplast->next_variable = vp;
++        }
++        vplast = vp;
++        vp = NULL;
+     }
+-    return badtype;
++    return 0;
++
++  fail:
++    DEBUGMSGTL(("recv", "error while parsing VarBindList\n"));
++    /** if we were parsing a var, remove it from the pdu and free it */
++    if (vp)
++        snmp_free_var(vp);
++
++    return -1;
+ }
+ 
+ /*
diff --git a/patches/net-snmp-5.7.3/series b/patches/net-snmp-5.7.3/series
index 301e15685..5552fe35a 100644
--- a/patches/net-snmp-5.7.3/series
+++ b/patches/net-snmp-5.7.3/series
@@ -2,7 +2,8 @@
 #tag:base --start-number 1
 #tag:upstream --start-number 1
 0001-configure-Eliminate-the-hard-coded-libnl-3-include-p.patch
+0002-Bug-788964-net-snmp-snmp_pdu_parse-DoS.patch
 #tag:ptx --start-number 200
 0200-net-snmp-config-add-SYSROOT-support.patch
 0201-Don-t-disable-udp-and-tcp-when-disable-agentx-dom-so.patch
-# 196faeb288f32b85724023f20b12de91  - git-ptx-patches magic
+# c5d69c906e0a34815049c84f73590cb2  - git-ptx-patches magic
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached
  2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
                   ` (4 preceding siblings ...)
  2017-04-21 20:42 ` [ptxdist] [PATCH 6/7] net-snmp: add patch for CVE-2015-5621 Clemens Gruber
@ 2017-04-21 20:42 ` Clemens Gruber
  2017-04-28 12:39   ` Michael Olbrich
  5 siblings, 1 reply; 10+ messages in thread
From: Clemens Gruber @ 2017-04-21 20:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 projectroot/lib/systemd/system/rrdcached.service |  5 +++++
 projectroot/lib/systemd/system/rrdcached.socket  |  8 ++++++++
 rules/rrdtool.in                                 | 12 ++++++++++++
 rules/rrdtool.make                               |  8 ++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 projectroot/lib/systemd/system/rrdcached.service
 create mode 100644 projectroot/lib/systemd/system/rrdcached.socket

diff --git a/projectroot/lib/systemd/system/rrdcached.service b/projectroot/lib/systemd/system/rrdcached.service
new file mode 100644
index 000000000..bb30a502e
--- /dev/null
+++ b/projectroot/lib/systemd/system/rrdcached.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=Data caching daemon for rrdtool
+
+[Service]
+ExecStart=/usr/bin/rrdcached -g
diff --git a/projectroot/lib/systemd/system/rrdcached.socket b/projectroot/lib/systemd/system/rrdcached.socket
new file mode 100644
index 000000000..d3f6b277f
--- /dev/null
+++ b/projectroot/lib/systemd/system/rrdcached.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=rrdcached socket
+
+[Socket]
+ListenStream=/tmp/rrdcached.sock
+
+[Install]
+WantedBy=sockets.target
diff --git a/rules/rrdtool.in b/rules/rrdtool.in
index fa7e1de1c..fb91a8b84 100644
--- a/rules/rrdtool.in
+++ b/rules/rrdtool.in
@@ -34,6 +34,18 @@ config RRDTOOL_RRDCACHED
 	  accumulates them and, if enough have been received or a defined
 	  time has passed, writes the updates to the RRD file.
 
+if RRDTOOL_RRDCACHED
+
+config RRDTOOL_RRDCACHED_SYSTEMD_UNIT
+	bool
+	default y
+	depends on SYSTEMD
+	prompt "install rrdcached systemd unit"
+	help
+	  Install and enable a systemd socket-activated service
+
+endif
+
 config RRDTOOL_RRDCGI
 	bool
 	depends on RRDTOOL_RRD_GRAPH
diff --git a/rules/rrdtool.make b/rules/rrdtool.make
index 2c7453811..d43dcac61 100644
--- a/rules/rrdtool.make
+++ b/rules/rrdtool.make
@@ -82,6 +82,14 @@ $(STATEDIR)/rrdtool.targetinstall:
 
 ifdef PTXCONF_RRDTOOL_RRDCACHED
 	@$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcached)
+ifdef PTXCONF_RRDTOOL_RRDCACHED_SYSTEMD_UNIT
+	@$(call install_alternative, rrdtool, 0, 0, 0644, \
+		/lib/systemd/system/rrdcached.service)
+	@$(call install_alternative, rrdtool, 0, 0, 0644, \
+		/lib/systemd/system/rrdcached.socket)
+	@$(call install_link, rrdtool, ../rrdcached.socket, \
+		/lib/systemd/system/sockets.target.wants/rrdcached.socket)
+endif
 endif
 ifdef PTXCONF_RRDTOOL_RRDCGI
 	@$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcgi)
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached
  2017-04-21 20:42 ` [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached Clemens Gruber
@ 2017-04-28 12:39   ` Michael Olbrich
  2017-04-28 12:46     ` Clemens Gruber
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Olbrich @ 2017-04-28 12:39 UTC (permalink / raw)
  To: ptxdist

On Fri, Apr 21, 2017 at 10:42:06PM +0200, Clemens Gruber wrote:
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  projectroot/lib/systemd/system/rrdcached.service |  5 +++++
>  projectroot/lib/systemd/system/rrdcached.socket  |  8 ++++++++

The source contains such files and installs them if enabled.
Any reason why you don't use those?

Michael

>  rules/rrdtool.in                                 | 12 ++++++++++++
>  rules/rrdtool.make                               |  8 ++++++++
>  4 files changed, 33 insertions(+)
>  create mode 100644 projectroot/lib/systemd/system/rrdcached.service
>  create mode 100644 projectroot/lib/systemd/system/rrdcached.socket
> 
> diff --git a/projectroot/lib/systemd/system/rrdcached.service b/projectroot/lib/systemd/system/rrdcached.service
> new file mode 100644
> index 000000000..bb30a502e
> --- /dev/null
> +++ b/projectroot/lib/systemd/system/rrdcached.service
> @@ -0,0 +1,5 @@
> +[Unit]
> +Description=Data caching daemon for rrdtool
> +
> +[Service]
> +ExecStart=/usr/bin/rrdcached -g
> diff --git a/projectroot/lib/systemd/system/rrdcached.socket b/projectroot/lib/systemd/system/rrdcached.socket
> new file mode 100644
> index 000000000..d3f6b277f
> --- /dev/null
> +++ b/projectroot/lib/systemd/system/rrdcached.socket
> @@ -0,0 +1,8 @@
> +[Unit]
> +Description=rrdcached socket
> +
> +[Socket]
> +ListenStream=/tmp/rrdcached.sock
> +
> +[Install]
> +WantedBy=sockets.target
> diff --git a/rules/rrdtool.in b/rules/rrdtool.in
> index fa7e1de1c..fb91a8b84 100644
> --- a/rules/rrdtool.in
> +++ b/rules/rrdtool.in
> @@ -34,6 +34,18 @@ config RRDTOOL_RRDCACHED
>  	  accumulates them and, if enough have been received or a defined
>  	  time has passed, writes the updates to the RRD file.
>  
> +if RRDTOOL_RRDCACHED
> +
> +config RRDTOOL_RRDCACHED_SYSTEMD_UNIT
> +	bool
> +	default y
> +	depends on SYSTEMD
> +	prompt "install rrdcached systemd unit"
> +	help
> +	  Install and enable a systemd socket-activated service
> +
> +endif
> +
>  config RRDTOOL_RRDCGI
>  	bool
>  	depends on RRDTOOL_RRD_GRAPH
> diff --git a/rules/rrdtool.make b/rules/rrdtool.make
> index 2c7453811..d43dcac61 100644
> --- a/rules/rrdtool.make
> +++ b/rules/rrdtool.make
> @@ -82,6 +82,14 @@ $(STATEDIR)/rrdtool.targetinstall:
>  
>  ifdef PTXCONF_RRDTOOL_RRDCACHED
>  	@$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcached)
> +ifdef PTXCONF_RRDTOOL_RRDCACHED_SYSTEMD_UNIT
> +	@$(call install_alternative, rrdtool, 0, 0, 0644, \
> +		/lib/systemd/system/rrdcached.service)
> +	@$(call install_alternative, rrdtool, 0, 0, 0644, \
> +		/lib/systemd/system/rrdcached.socket)
> +	@$(call install_link, rrdtool, ../rrdcached.socket, \
> +		/lib/systemd/system/sockets.target.wants/rrdcached.socket)
> +endif
>  endif
>  ifdef PTXCONF_RRDTOOL_RRDCGI
>  	@$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcgi)
> -- 
> 2.12.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached
  2017-04-28 12:39   ` Michael Olbrich
@ 2017-04-28 12:46     ` Clemens Gruber
  0 siblings, 0 replies; 10+ messages in thread
From: Clemens Gruber @ 2017-04-28 12:46 UTC (permalink / raw)
  To: ptxdist

On Fri, Apr 28, 2017 at 02:39:46PM +0200, Michael Olbrich wrote:
> On Fri, Apr 21, 2017 at 10:42:06PM +0200, Clemens Gruber wrote:
> > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > ---
> >  projectroot/lib/systemd/system/rrdcached.service |  5 +++++
> >  projectroot/lib/systemd/system/rrdcached.socket  |  8 ++++++++
> 
> The source contains such files and installs them if enabled.
> Any reason why you don't use those?

Must have missed them. I will send a v2! Thanks.

Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ptxdist] [PATCH 2/7] collectd: improve systemd service file
  2017-04-21 20:42 ` [ptxdist] [PATCH 2/7] collectd: improve systemd service file Clemens Gruber
@ 2017-04-28 12:47   ` Michael Olbrich
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Olbrich @ 2017-04-28 12:47 UTC (permalink / raw)
  To: ptxdist

On Fri, Apr 21, 2017 at 10:42:01PM +0200, Clemens Gruber wrote:
> collectd supports systemd notify. Also add requirements and increase
> RestartSec. This is the Debian service file without docs and default
> env file.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  projectroot/lib/systemd/system/collectd.service | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/projectroot/lib/systemd/system/collectd.service b/projectroot/lib/systemd/system/collectd.service
> index 752245c05..5748a6438 100644
> --- a/projectroot/lib/systemd/system/collectd.service
> +++ b/projectroot/lib/systemd/system/collectd.service
> @@ -1,9 +1,16 @@
>  [Unit]
> -Description=statistics collection daemon
> +Description=Statistics collection and monitoring daemon

> +After=local-fs.target network.target
> +Requires=local-fs.target network.target

local-fs.target is already implicitly set for both and network.target is
not well defined, but I don't mind if it is set.

> +ConditionPathExists=/etc/collectd/collectd.conf

We always install this, so this is not needed.

>  
>  [Service]
> -ExecStart=/usr/sbin/collectd -f
> +Type=notify
> +NotifyAccess=main

This is the default for Type=notify and can be removed.

> +ExecStartPre=/usr/sbin/collectd -t

Not sure if we need this. The config is quite static on a embedded system.

Michael

> +ExecStart=/usr/sbin/collectd
>  Restart=always
> +RestartSec=10
>  
>  [Install]
>  WantedBy=multi-user.target
> -- 
> 2.12.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-04-28 12:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 20:42 [ptxdist] [PATCH 1/7] collectd: add memory, ping and rrdcached plugin Clemens Gruber
2017-04-21 20:42 ` [ptxdist] [PATCH 2/7] collectd: improve systemd service file Clemens Gruber
2017-04-28 12:47   ` Michael Olbrich
2017-04-21 20:42 ` [ptxdist] [PATCH 3/7] collectd: version bump 5.7.0 -> 5.7.1 Clemens Gruber
2017-04-21 20:42 ` [ptxdist] [PATCH 4/7] ethtool: version bump 4.8 -> 4.10 Clemens Gruber
2017-04-21 20:42 ` [ptxdist] [PATCH 5/7] liboping: version bump 1.6.2 -> 1.9.0 Clemens Gruber
2017-04-21 20:42 ` [ptxdist] [PATCH 6/7] net-snmp: add patch for CVE-2015-5621 Clemens Gruber
2017-04-21 20:42 ` [ptxdist] [PATCH 7/7] rrdtool: add systemd unit for rrdcached Clemens Gruber
2017-04-28 12:39   ` Michael Olbrich
2017-04-28 12:46     ` Clemens Gruber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox