I setup monit on Ubuntu 16.04.
sudo monit --version
This is Monit version 5.16
Built with ssl, with pam and with large files
For a given process, it currently lists below:
status Running
monitoring status Monitored
pid 8724
parent pid 8691
uid 0
effective uid 0
gid 0
uptime 6d 23h 36m
threads 7
children 0
memory 190.6 MB
memory total 190.6 MB
memory percent 19.2%
memory percent total 19.2%
cpu percent 6.8%
cpu percent total 6.8%
data collected Sat, 07 Oct 2017 22:41:49
My question is that is there a way I can also list process arguments in this list? Basically, I would like to monitor not only matrices like uptime, load etc. but also what arguments the process is called and running with? Are there any other alternatives to monit that could provide a similar json based response?
Thanks.
There is a way to do what you want. On any Linux based system, you can use:
xargs -0 < /proc/<pid>/cmdline
Make sure you replace <pid>
with your processes pid. That command will show the command that started the pid
you inserted into that path, with args and all. You can even make a shell script to run monit and parse the pid section from the output and use that for xargs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.