I used Ubuntu 16.04. And I find some services will show cpu and memory usage via systemctl status <name>.service
:
$ systemctl status nginx
● nginx.service - LSB: Stop/start nginx
Loaded: loaded (/etc/init.d/nginx; bad; vendor preset: enabled)
Active: active (running) since 五 2017-04-07 09:21:25 CST; 4h 59min ago
Docs: man:systemd-sysv-generator(8)
Process: 2677 ExecStart=/etc/init.d/nginx start (code=exited, status=0/SUCCESS)
Tasks: 2
Memory: 2.5M
CPU: 12ms
CGroup: /system.slice/nginx.service
├─2695 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.con
└─2697 nginx: worker process
But on another host, I find the systemctl status
will not show cpu and memory usage:
$ systemctl status nginx
● nginx.service - LSB: Stop/start nginx
Loaded: loaded (/etc/init.d/nginx; bad; vendor preset: enabled)
Active: active (running) since 四 2017-04-06 20:57:15 CST; 17h ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/nginx.service
├─29668 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.con
├─29669 nginx: worker process
├─29670 nginx: worker process
├─29671 nginx: worker process
└─29672 nginx: worker process
Why? Both of the nginx
were installed from nginx official repo apt install -y nginx
. Even though on the same host, some services will not show cpu and memory usage.
And how to show the cpu and memory usage in systemctl status?