From dc623ed9620635a08708d8e62dab252f7be7bcee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Fri, 2 Jun 2023 08:15:12 +0200 Subject: [PATCH] Collectd improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Increase the service stop timeout to give collectd time to flush the values to RRD files on the disk. It currently takes ~1m30s, setting the timeout to 5m - add the unix socket plugin and configure the CGI to make use of it to request a flush of the RRD values when a graph is generated - add SELinux permissions to allow those two to talk to each other Signed-off-by: Aurélien Bompard --- .../base/files/selinux/fi-collectd.mod | Bin 4112 -> 4479 bytes .../base/files/selinux/fi-collectd.pp | Bin 4128 -> 4495 bytes .../base/files/selinux/fi-collectd.te | 11 +++++++++- roles/collectd/server/files/collection.conf | 2 +- .../server/files/service.timeout.conf | 3 +++ roles/collectd/server/files/unixsock.conf | 7 +++++++ roles/collectd/server/tasks/main.yml | 19 ++++++++++++++++++ 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 roles/collectd/server/files/service.timeout.conf create mode 100644 roles/collectd/server/files/unixsock.conf diff --git a/roles/collectd/base/files/selinux/fi-collectd.mod b/roles/collectd/base/files/selinux/fi-collectd.mod index e349334f388077a2a84b3c0e47e96686d248957f..591c3685b8f7ab0e7b07a4f571aee645f4305665 100644 GIT binary patch delta 469 zcmX|7OG^S#6!toE=i!WwX_VwZ7SSeX6FqimxljUaVT)FiOhTf}h)ucm4}`(DidNC4 zMM2=AMT_VcxabE&&_08pMGL!kd@K&mhx!UcI)+u?Hya^<)+mDrc4@hs0^JQ*LtDv9`<6){FsA03JrqHv^DohoDUt8~1I1ri=IsY<6+*4cqeHyv3I(nkp(t|x=~f-Lu(ZR*Ry}s1p-rc)99=yroRq5rDDLj|Uar9XSh5WB&)0V*{2;4|sA&Jk@ zqwqXP+6Sj$Ge`v`R+a$LI+LgBOR|}rDJN;g%^*5VgVdp(f|9(#%xULDo@MG(UCUL* zGi8KPNKJ*BdSBULMrPWb{Z`OwNBsGs)B>y5F{;Fkha#ULkHa)m7ZCu zqo^Qs@gF!ih`*qNKR|@;^}Y0CxZHE^J@@N8WNzo*?g>7bfhSTkX(SR+xdq3y%PP{* zzG?GlY%!cl4pt7LBPRc>E${Kk3JZ)&_|h0Kz)PLvS6OL1ZgWYrtB zz^|5@e$(PS6@StaiHDpGIYIOgRpcDe1Y(tHg)_xf2EOGYF^5d5(lMKm+H;4ElV z>Z8Gomt2(TCP|>KG&Cvp`*gjfpmlA$emM?VBRnl!qMvodu@twY= zp=8=^$-pmLB?Az14Tr`wI!3yCV??7g6dB7>G9!kJO$a@Ca3pcJ6EBja5MWXnzK))i F`v;BjdvpK* delta 333 zcmX9(Jxc>Y6wF@sHk;e~QV;_dPzbgnXpv5%7Kw!)Xek^T6b|I>I4@Cb;y(yDmJ$4D z6f6QKTH4xKS*5YJNF!L-xEqUkGjC>i@Vb@j>HZbbSuU4jxFv1OXy2ACHw9OMqo4OC z;^;U%3{L&HwSN>e{glhZQVH(zRYFJVCvOv5DJM>%rXL=pe(K1cjyXC@%u(lzj+4Sj z-P0OjN{Jv0WK)+-1FpVKgmUfnUg9UM@c%?nT4j9b%f!VeTfr+U zAzQ$}RDK DataSources value DSName "value Bytes/s" diff --git a/roles/collectd/server/files/service.timeout.conf b/roles/collectd/server/files/service.timeout.conf new file mode 100644 index 0000000000..2259924df7 --- /dev/null +++ b/roles/collectd/server/files/service.timeout.conf @@ -0,0 +1,3 @@ +# Give collectd the time to flush data to rrd files on disk +[Service] +TimeoutStopSec=5m diff --git a/roles/collectd/server/files/unixsock.conf b/roles/collectd/server/files/unixsock.conf new file mode 100644 index 0000000000..6a275abb13 --- /dev/null +++ b/roles/collectd/server/files/unixsock.conf @@ -0,0 +1,7 @@ +LoadPlugin unixsock + + SocketFile "/var/run/collectd-unixsock" + SocketGroup "apache" + SocketPerms "0660" + DeleteSocket true + diff --git a/roles/collectd/server/tasks/main.yml b/roles/collectd/server/tasks/main.yml index af84619da1..2b273f40f4 100644 --- a/roles/collectd/server/tasks/main.yml +++ b/roles/collectd/server/tasks/main.yml @@ -50,6 +50,7 @@ loop: - rrdtool.conf - fmn.conf + - unixsock.conf notify: - restart collectd tags: @@ -85,3 +86,21 @@ tags: - config - collectd/server + +- name: create the service configuration directory + file: + path: /etc/systemd/system/collectd.service.d + type: directory + tags: + - config + - collectd/server + +- name: override the timeout for stopping collectd + copy: + src: service.timeout.conf + dest: /etc/systemd/system/collectd.service.d/timeout.conf + notify: + - reload systemd + tags: + - config + - collectd/server