我正在生产服务器上运行多个独angular兽进程。 现在我想检查我的服务的个人服务正常运行时间。 例如,如果任何独angular兽进程自动重启,它应该开始logging它的正常运行时间。 通过这种方式,我想计算自上次start/restart/reload以来服务的正常运行时间。注意:这里我不是在说服务器正常运行时间,可以通过使用如下的uptime命令来了解服务器的运行uptime 。
$ uptime 19:11:25 up 2 days, 21:28, 1 user, load average: 0.11, 0.09, 0.11
我想知道nginx的正常运行时间等个人服务的正常运行时间
有可能以某种方式知道吗?
Monit非常适合这个。
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