做一个服务器监控程序,需要监控核心进程,有几个疑问请教一下:
指令
ps -ef|grep -v grep|grep redis
结果:
redis 20508 1 1 Jan21 ? 01:30:10 /usr/sbin/redis-server /etc/redis.conf
疑问
1.以上结果中哪个值(字段)可以作为进程监控的依据?
2.如果以上指令不能很好的监控,请问有什么更好的指令?
伊谢尔伦2017-04-17 14:02:17
ps -ef|grep command is mainly to filter out whether the process you want to check is running, and it will return the process ID which can be used for subsequent operations;
The above results show:
The redis process exists, that is, redis has been started and did not exit abnormally;
The redis process number is 20508, you can kill it by kill 20508;
This redis process is started through the /usr/sbin/redis-server file, and the configuration file used is /etc/redis.conf
The start time of this redis process is Jan21 (January 21) 01:30:10
This redis process is started using the ? account (the user is not displayed, only the ? number is displayed)
怪我咯2017-04-17 14:02:17
Looking at this can tell whether the process is dead or not, but there is not a lot of useful information
First think clearly about the purpose of your monitoring and which indicators can meet your purpose