- changed component to Monit
Process Total Memory usage always 0 when monit not run as root
If run as a non-root user, even with identical monitrc file, memory total is 0.0 for all monitored processes.
If monit is run as root, “Memory Total” on html/status command are correct for all processes.
In this case my non-root user even happens to own all the processes that are being monitored.
$ monit -c ~/.monitrc
$ monit status | grep "memory total"
memory total 0.0% [0 B]
memory total 0.0% [0 B]
memory total 0.0% [0 B]
memory total 0.0% [0 B]
memory total 0.0% [0 B]
$ monit quit
$ sudo systemctl start monit
sudo monit status | grep "memory total"
memory total 31.3% [2.4 GB]
memory total 7.2% [564.5 MB]
memory total 0.2% [12.0 MB]
memory total 3.3% [255.5 MB]
memory total 22.4% [1.7 GB]
$ sudo diff -s /etc/monitrc ~/.monitrc
Files /etc/monitrc and /home/bfiedler/.monitrc are identical
Comments (8)
-
reporter -
reporter - edited description
-
Hello Ben,
the used monit is 5.27.0, but give some more information about the used Linux.With regards,
Lutz -
reporter I am using gentoo amd64.
$ uname -r
5.6.19-gentoo
Gentoo Base System release 2.7
$ equery depgraph app-admin/monit
* dependency graph for app-admin/monit-5.27.0
`-- app-admin/monit-5.27.0 ~amd64
`-- dev-libs/openssl-1.1.1g (dev-libs/openssl) amd64
`-- dev-libs/libressl-3.1.3 (dev-libs/libressl) amd64
`-- sys-libs/pam-1.4.0-r2 (sys-libs/pam) ~amd64
`-- sys-devel/flex-2.6.4-r1 (sys-devel/flex) amd64
`-- sys-devel/bison-3.6.4 (sys-devel/bison) ~amd64
`-- virtual/pkgconfig-2 (virtual/pkgconfig) amd64
I just tried emerging the previous versions of monit available in my portage tree: this definitely appears to be a new problem introduced in 5.27.0
$ monit --version && monit status | grep "memory total"
This is Monit version 5.25.3
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2019 Tildeslash Ltd. All Rights Reserved.
memory total 34.9% [2.7 GB]
memory total 5.7% [445.8 MB]
memory total 0.2% [15.0 MB]
memory total 4.7% [366.8 MB]
memory total 22.9% [1.8 GB]
$ monit --version && monit status | grep "memory total"
This is Monit version 5.26.0
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2019 Tildeslash Ltd. All Rights Reserved.
memory total 34.2% [2.6 GB]
memory total 5.5% [433.9 MB]
memory total 0.2% [14.6 MB]
memory total 4.6% [359.5 MB]
memory total 21.2% [1.6 GB]
-
Hello Ben,
you are right, I think, it does not fit well.top for the system gives me
Cpu(s): 2.5%us, 0.6%sy, 0.1%ni, 96.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 258352M total, 109939M used, 148413M free, 1609M buffers
and the stat for the process looks like this
cat /proc/225842/stat
225842 (grafana-server) S 1 224095 224095 0 -1 8192 405941 0 2988 0 137248 47981 0 0 20 0 81 0 3699597721 967450624 7879 230266843136 4194304 39171140 140737488349584 140737488348400 4617139 0 0 0 2143420159 18446744073709551615 0 0 17 24 0 0 35 0 0
and monit looks like this
monit status grafana | grep -e 'memory' -e 'cpu'
cpu 0.0%
cpu total 0.0%
memory 0.0% [30.8 MB]
memory total 0.0% [30.8 MB]
But it does not depend to monit running in root or non-root, monit collect the data all the time from “/proc/PID/stat”.
With regards,
Lutz -
repo owner I think the problem is fixed … when monit was running as non-root, it failed to collect the filedescriptors statistics and it terminated the process statistics collection.
Ben, please can you try with the development version of monit? (https://bitbucket.org/tildeslash/monit/src/master/). I’m unable to reproduce the problem with the development version.
-
reporter Confirmed, on the dev build running as non-root mem total works just fine.
monit --version && monit status | grep "memory total"
This is Monit version 5.28.0
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2020 Tildeslash Ltd. All Rights Reserved.
memory total 32.9% [2.5 GB]
memory total 0.2% [12.0 MB]
memory total 4.6% [363.7 MB]
memory total 19.0% [1.4 GB]
Thanks
-
repo owner - changed status to duplicate
Duplicate of
#916. - Log in to comment