search

Home  >  Q&A  >  body text

grep - 请问监测linux服务关键进程主要是参考哪个值

做一个服务器监控程序,需要监控核心进程,有几个疑问请教一下:

指令

ps -ef|grep -v  grep|grep redis

结果:
redis 20508 1 1 Jan21 ? 01:30:10 /usr/sbin/redis-server /etc/redis.conf

疑问
1.以上结果中哪个值(字段)可以作为进程监控的依据?
2.如果以上指令不能很好的监控,请问有什么更好的指令?

迷茫迷茫2836 days ago761

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦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:

    1. The redis process exists, that is, redis has been started and did not exit abnormally;

    2. The redis process number is 20508, you can kill it by kill 20508;

    3. This redis process is started through the /usr/sbin/redis-server file, and the configuration file used is /etc/redis.conf

    4. The start time of this redis process is Jan21 (January 21) 01:30:10

    5. This redis process is started using the ? account (the user is not displayed, only the ? number is displayed)

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 14:02:17

    Is the poster referring to the process ID?

    reply
    0
  • 怪我咯

    怪我咯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

    reply
    0
  • Cancelreply