Hi Jonathan,
On 3/28/20 2:20 AM, Jonathan Sloan wrote:
> I seem to be having some troubling getting NE to ignore a few devices
> 'sr0/sda[1-3]. I've tried multiple things to try and get this work,
> exact for manually telling it to ignore sr0|sda1|sda2|sda3 etc. When
> using the below command.
>
> |
> node_exporter
> --web.listen-address=0.0.0.0:9100--web.max-requests=16--collector.processes
> |
>
> It does not ignore sda[1-3] I know sr* is not part of the standard regex
> they use. But this standard regex doesn't appear to work with systemd
> because the \\d chars are removed from systemd.
>
> |
> /usr/sbin/node_exporter
> --web.listen-address=0.0.0.0:9100--web.max-requests=16--collector.processes
> --collector.diskstats.ignored-devices=^(sr|ram|loop|fd|(h|s|v|xv)d[a-z]|nvmed+nd+p)d+$
> --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+)($|/)--collector.filesystem.ignored-fs-types=^(rootfs|tmpfs|autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$
>
> |
>
> The issue appears to be around the char '\'. I believe systemd removes
> these chars and thus you need to encode them from my googling around
> with systemd-escape which I did shown below, but it still doesn't appear
> to work..
One simple solution would be moving the options to a seperate file. This
is what the suggested default config does:
https://github.com/prometheus/node_exporter/tree/master/examples/systemd
If you don't want to to this, it should still be possible to solve this
within the unit file.
I have posted an example below which seems to work for me. Neither the
ExecStart value nor the parameter values are quoted in my case.
Kind regards
Christian
# systemctl --version
systemd 245 (245.2-2-arch)
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS
+KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
# cat /etc/systemd/system/prometheus-node_exporter.service
[Unit]
Description=Node Exporter
[Service]
User=node_exporter
ExecStart=/usr/bin/prometheus-node-exporter
--collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$
[Install]
WantedBy=multi-user.target
# ps aux | grep node-exp
node_ex+ 3113 0.0 0.2 1161372 15848 ? Ssl 09:50 0:00
/usr/bin/prometheus-node-exporter
--collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\d+n\d+p)\d+$