我正在生产服务器上运行多个独角兽进程。现在,我想检查我的服务的单个服务正常运行时间。例如,如果任何独角兽进程自动重新启动,它应该开始记录其正常运行时间。通过这种方式,我想计算服务自上一次start/restart/reload
以来的正常运行时间,注意:这里我不是在讨论服务器正常运行时间,可以使用uptime
命令了解它,如下所示。
$ uptime
19:11:25 up 2 days, 21:28, 1 user, load average: 0.11, 0.09, 0.11
我想知道个人服务的正常运行时间,比如nginx的正常运行时间。
有可能不知何故知道吗?
发布于 2017-01-09 19:35:09
莫尼特在这方面做得很好。
monit status
命令清楚地显示了这些信息:
Process 'ssh'
status Running
monitoring status Monitored
pid 11239
parent pid 1
uid 0
effective uid 0
gid 0
uptime 32d 5h 1m
children 230
memory 1.2 MB
memory total 2.0 GB
memory percent 0.0%
memory percent total 0.6%
cpu percent 0.0%
cpu percent total 0.1%
data collected Mon, 09 Jan 2017 11:34:08
Process 'cron'
status Running
monitoring status Monitored
pid 669744
parent pid 1
uid 0
effective uid 0
gid 0
uptime 1m
children 0
memory 1.2 MB
memory total 1.2 MB
memory percent 0.0%
memory percent total 0.0%
cpu percent 0.0%
cpu percent total 0.0%
data collected Mon, 09 Jan 2017 11:34:08
Process 'newrelic'
status Running
monitoring status Monitored
pid 11377
parent pid 1
uid 495
effective uid 495
gid 495
uptime 32d 5h 1m
children 1
memory 500.0 kB
memory total 8.3 MB
memory percent 0.0%
memory percent total 0.0%
cpu percent 0.0%
cpu percent total 0.0%
data collected Mon, 09 Jan 2017 11:34:08
https://serverfault.com/questions/825150
复制相似问题