| Message ID | 20220730022802.3653144-1-jon.murphy@ipfire.org | 
|---|---|
| State | Superseded | 
| Headers | Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LvpGG570qz3x1v for <patchwork@web04.haj.ipfire.org>; Sat, 30 Jul 2022 02:28:22 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LvpGD3sBwzf9; Sat, 30 Jul 2022 02:28:20 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LvpGD29kjz2ypj; Sat, 30 Jul 2022 02:28:20 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LvpGC0BNcz2yCy for <development@lists.ipfire.org>; Sat, 30 Jul 2022 02:28:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4LvpGB1KK7z9Q; Sat, 30 Jul 2022 02:28:18 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1659148098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ijQiL5yCgF/Axil1Ewkx6Bub1rku5qaF2gKEDlbYlK0=; b=aI4dgTpzvYRIYhzFP/LMc+LTdy7wHAnkCLm/oOuoNVqd90wc2bZ4xvQjiuxMxQN1Ba4kCB gOVX05jIh+iZ6ZBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1659148098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ijQiL5yCgF/Axil1Ewkx6Bub1rku5qaF2gKEDlbYlK0=; b=wqzV6m+XMCXrmnN+defPfNbUs3lb9p/eRqrLs6kOLjge13lhMeqHmQz100AOjcR4F9kkuL ds/3/hKql7Fhn14KHr87a12Yh+QSYHENT3U2/w3F28VrUjeS9CM9qOfMfYsQbYzyfunKmK 9QcVj/OmgdNEMVvFGVzghesHVniZSVwk+PxR8uJCW7lhjP6kwUt2okEFeHOUfYc/ZNKs+t IcNkRFw/WnjAok7GPXEpHpKnGqB46R777zjFuA7s7tkVOIqJPTKDbpcfIAwT+nnWYA2FGn usIjakAuXasygpj0X5j7Uqsv+EXFe4jswSYemiROXOwkuYUw0QnASUi26uoBOg== From: Jon Murphy <jon.murphy@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH] update.sh: clean out old collectd process statistics Date: Fri, 29 Jul 2022 21:28:02 -0500 Message-Id: <20220730022802.3653144-1-jon.murphy@ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> | 
| Series | update.sh: clean out old collectd process statistics
       | 
 | 
Commit Message
    Jon Murphy
    30 Jul 2022, 2:28 a.m. UTC
  
  
- processes-mysqld
- processes-snort
- processes-rtorrent
- processes-asterisk
- processes-java
- processes-spamd
Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
---
 config/rootfiles/core/170/update.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  
Comments
Hello Jon,
thank you for submitting this. Regarding the "rm" calls, I have two comments:
(a) For transparency reasons, I have shifted to always adding "-v" argument to
     rm calls during a Core Update, so deleted files are logged. In case of
     troubleshooting, this should make (our) lives a bit easier since it is clear
     what has been deleted.
(b) This could have been one single rm call, i.e.:
rm -rvf \
	file A \
	file B \
	... \
	file N
     The update.sh script for Core Update 170 should feature such a (lengthy)
     rm call, if I am not mistaken.
Thanks, and best regards,
Peter Müller
> - processes-mysqld
> - processes-snort
> - processes-rtorrent
> - processes-asterisk
> - processes-java
> - processes-spamd
> 
> Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
> ---
>   config/rootfiles/core/170/update.sh | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/config/rootfiles/core/170/update.sh b/config/rootfiles/core/170/update.sh
> index cbac8572e..ec6c5ad09 100644
> --- a/config/rootfiles/core/170/update.sh
> +++ b/config/rootfiles/core/170/update.sh
> @@ -170,6 +170,20 @@ sed -i /etc/collectd.conf \
>   	-e "/LoadPlugin entropy/d"
>   /etc/init.d/collectd restart
>   
> +# Stop collectd Sevice
> +/etc/init.d/collectd stop
> +
> +# Cleanup old collectd statistics...
> +rm -rf /var/log/rrd/collectd/localhost/processes-mysqld
> +rm -rf /var/log/rrd/collectd/localhost/processes-snort
> +rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent
> +rm -rf /var/log/rrd/collectd/localhost/processes-asterisk
> +rm -rf /var/log/rrd/collectd/localhost/processes-java
> +rm -rf /var/log/rrd/collectd/localhost/processes-spamd
> +#
> +# Start collectd
> +/etc/init.d/collectd start
> +
>   # Start services
>   /etc/init.d/rc.d/unbound start
>   /etc/init.d/rc.d/suricata start
  
Peter - I did a make build with the changes but now I am confused.
My changes look like this (V1 to V2)
 # Stop collectd Sevice
 /etc/init.d/collectd stop
 
 # Cleanup old collectd statistics...
-rm -rf /var/log/rrd/collectd/localhost/processes-mysqld
-rm -rf /var/log/rrd/collectd/localhost/processes-snort
-rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent
-rm -rf /var/log/rrd/collectd/localhost/processes-asterisk
-rm -rf /var/log/rrd/collectd/localhost/processes-java
-rm -rf /var/log/rrd/collectd/localhost/processes-spamd
+rm -rvf /var/log/rrd/collectd/localhost/processes-mysqld \
+       /var/log/rrd/collectd/localhost/processes-snort \
+       /var/log/rrd/collectd/localhost/processes-rtorrent \
+       /var/log/rrd/collectd/localhost/processes-asterisk \
+       /var/log/rrd/collectd/localhost/processes-java \
+       /var/log/rrd/collectd/localhost/processes-spamd
 #
 # Start collectd
 /etc/init.d/collectd start
Instead of this ("next" to V2)
+# Stop collectd Sevice
+/etc/init.d/collectd stop
+
+# Cleanup old collectd statistics...
+rm -rf /var/log/rrd/collectd/localhost/processes-mysqld \
	/var/log/rrd/collectd/localhost/processes-snort \
	/var/log/rrd/collectd/localhost/processes-rtorrent \
	/var/log/rrd/collectd/localhost/processes-asterisk \
	/var/log/rrd/collectd/localhost/processes-java \
	/var/log/rrd/collectd/localhost/processes-spamd
+#
+# Start collectd
+/etc/init.d/collectd start
+
What should they look like?  Do I start from scratch?
Jon
> On Jul 30, 2022, at 2:33 AM, Peter Müller <peter.mueller@ipfire.org> wrote:
> 
> Hello Jon,
> 
> thank you for submitting this. Regarding the "rm" calls, I have two comments:
> 
> (a) For transparency reasons, I have shifted to always adding "-v" argument to
>    rm calls during a Core Update, so deleted files are logged. In case of
>    troubleshooting, this should make (our) lives a bit easier since it is clear
>    what has been deleted.
> 
> (b) This could have been one single rm call, i.e.:
> 
> rm -rvf \
> 	file A \
> 	file B \
> 	... \
> 	file N
> 
>    The update.sh script for Core Update 170 should feature such a (lengthy)
>    rm call, if I am not mistaken.
> 
> Thanks, and best regards,
> Peter Müller
> 
> 
>> - processes-mysqld
>> - processes-snort
>> - processes-rtorrent
>> - processes-asterisk
>> - processes-java
>> - processes-spamd
>> Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
>> ---
>>  config/rootfiles/core/170/update.sh | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>> diff --git a/config/rootfiles/core/170/update.sh b/config/rootfiles/core/170/update.sh
>> index cbac8572e..ec6c5ad09 100644
>> --- a/config/rootfiles/core/170/update.sh
>> +++ b/config/rootfiles/core/170/update.sh
>> @@ -170,6 +170,20 @@ sed -i /etc/collectd.conf \
>>  	-e "/LoadPlugin entropy/d"
>>  /etc/init.d/collectd restart
>>  +# Stop collectd Sevice
>> +/etc/init.d/collectd stop
>> +
>> +# Cleanup old collectd statistics...
>> +rm -rf /var/log/rrd/collectd/localhost/processes-mysqld
>> +rm -rf /var/log/rrd/collectd/localhost/processes-snort
>> +rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent
>> +rm -rf /var/log/rrd/collectd/localhost/processes-asterisk
>> +rm -rf /var/log/rrd/collectd/localhost/processes-java
>> +rm -rf /var/log/rrd/collectd/localhost/processes-spamd
>> +#
>> +# Start collectd
>> +/etc/init.d/collectd start
>> +
>>  # Start services
>>  /etc/init.d/rc.d/unbound start
>>  /etc/init.d/rc.d/suricata start
  
Hello Jon, apologies for the belated reply. The second version of your patch looks quite good to me, I just reviewed it and will merge it soon. :-) Thanks, and best regards, Peter Müller P.S.: On the occasion of yesterdays' monthly video conference, I just wanted to relay that we (= all the other folks usually hanging around there) would be thrilled to have you as well, should you have time and motivation to join. No pressure or any obligations though. :-) > Peter - I did a make build with the changes but now I am confused. > > My changes look like this (V1 to V2) > # Stop collectd Sevice > /etc/init.d/collectd stop > > # Cleanup old collectd statistics... > -rm -rf /var/log/rrd/collectd/localhost/processes-mysqld > -rm -rf /var/log/rrd/collectd/localhost/processes-snort > -rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent > -rm -rf /var/log/rrd/collectd/localhost/processes-asterisk > -rm -rf /var/log/rrd/collectd/localhost/processes-java > -rm -rf /var/log/rrd/collectd/localhost/processes-spamd > +rm -rvf /var/log/rrd/collectd/localhost/processes-mysqld \ > + /var/log/rrd/collectd/localhost/processes-snort \ > + /var/log/rrd/collectd/localhost/processes-rtorrent \ > + /var/log/rrd/collectd/localhost/processes-asterisk \ > + /var/log/rrd/collectd/localhost/processes-java \ > + /var/log/rrd/collectd/localhost/processes-spamd > # > # Start collectd > /etc/init.d/collectd start > > > Instead of this ("next" to V2) > > +# Stop collectd Sevice > +/etc/init.d/collectd stop > + > +# Cleanup old collectd statistics... > +rm -rf /var/log/rrd/collectd/localhost/processes-mysqld \ > /var/log/rrd/collectd/localhost/processes-snort \ > /var/log/rrd/collectd/localhost/processes-rtorrent \ > /var/log/rrd/collectd/localhost/processes-asterisk \ > /var/log/rrd/collectd/localhost/processes-java \ > /var/log/rrd/collectd/localhost/processes-spamd > +# > +# Start collectd > +/etc/init.d/collectd start > + > > What should they look like? Do I start from scratch? > > > Jon > > > >> On Jul 30, 2022, at 2:33 AM, Peter Müller <peter.mueller@ipfire.org> wrote: >> >> Hello Jon, >> >> thank you for submitting this. Regarding the "rm" calls, I have two comments: >> >> (a) For transparency reasons, I have shifted to always adding "-v" argument to >> rm calls during a Core Update, so deleted files are logged. In case of >> troubleshooting, this should make (our) lives a bit easier since it is clear >> what has been deleted. >> >> (b) This could have been one single rm call, i.e.: >> >> rm -rvf \ >> file A \ >> file B \ >> ... \ >> file N >> >> The update.sh script for Core Update 170 should feature such a (lengthy) >> rm call, if I am not mistaken. >> >> Thanks, and best regards, >> Peter Müller >> >> >>> - processes-mysqld >>> - processes-snort >>> - processes-rtorrent >>> - processes-asterisk >>> - processes-java >>> - processes-spamd >>> Signed-off-by: Jon Murphy <jon.murphy@ipfire.org> >>> --- >>> config/rootfiles/core/170/update.sh | 14 ++++++++++++++ >>> 1 file changed, 14 insertions(+) >>> diff --git a/config/rootfiles/core/170/update.sh b/config/rootfiles/core/170/update.sh >>> index cbac8572e..ec6c5ad09 100644 >>> --- a/config/rootfiles/core/170/update.sh >>> +++ b/config/rootfiles/core/170/update.sh >>> @@ -170,6 +170,20 @@ sed -i /etc/collectd.conf \ >>> -e "/LoadPlugin entropy/d" >>> /etc/init.d/collectd restart >>> +# Stop collectd Sevice >>> +/etc/init.d/collectd stop >>> + >>> +# Cleanup old collectd statistics... >>> +rm -rf /var/log/rrd/collectd/localhost/processes-mysqld >>> +rm -rf /var/log/rrd/collectd/localhost/processes-snort >>> +rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent >>> +rm -rf /var/log/rrd/collectd/localhost/processes-asterisk >>> +rm -rf /var/log/rrd/collectd/localhost/processes-java >>> +rm -rf /var/log/rrd/collectd/localhost/processes-spamd >>> +# >>> +# Start collectd >>> +/etc/init.d/collectd start >>> + >>> # Start services >>> /etc/init.d/rc.d/unbound start >>> /etc/init.d/rc.d/suricata start > >
diff --git a/config/rootfiles/core/170/update.sh b/config/rootfiles/core/170/update.sh index cbac8572e..ec6c5ad09 100644 --- a/config/rootfiles/core/170/update.sh +++ b/config/rootfiles/core/170/update.sh @@ -170,6 +170,20 @@ sed -i /etc/collectd.conf \ -e "/LoadPlugin entropy/d" /etc/init.d/collectd restart +# Stop collectd Sevice +/etc/init.d/collectd stop + +# Cleanup old collectd statistics... +rm -rf /var/log/rrd/collectd/localhost/processes-mysqld +rm -rf /var/log/rrd/collectd/localhost/processes-snort +rm -rf /var/log/rrd/collectd/localhost/processes-rtorrent +rm -rf /var/log/rrd/collectd/localhost/processes-asterisk +rm -rf /var/log/rrd/collectd/localhost/processes-java +rm -rf /var/log/rrd/collectd/localhost/processes-spamd +# +# Start collectd +/etc/init.d/collectd start + # Start services /etc/init.d/rc.d/unbound start /etc/init.d/rc.d/suricata start