参考:
https://feilong.me/2011/02/monitor-core-processes-with-monit
https://www.cnblogs.com/kevingrace/p/6322324.html
安装
- apt 安装即可
 - sudo apt install monit
 
配置
- 编辑/etc/monit/monitrc 放开web端口,不开放不能status
 
set httpd port 2812 and
#    use address localhost  # only accept connection from localhost (drop if you use M/Monit)
#    allow localhost        # allow localhost to connect to the server and
    allow admin:admin      # require user 'admin' with password 'monit'
- 同时建议把daemon时间调小,默认是120秒检查一次
 - 在/etc/monit/conf-available下新建一个文件
 - 监控openobserve进程参数配置如下
- 查了半开没找到怎么样以配置以用户身份运行,只有用su的方法
 
 
check process openobserve  MATCHING openobserve 
        start program = "/bin/su - ecs-user   /home/ecs-user/o2/start.sh" with timeout 10 seconds
- 把这个文件link到conf-enabled下
 - 然后 sudo monit reload
 - 然后sudo monit status即可看到 openobserve 服务运行情况及系统运行情况
 - 测试kill进程后10秒内会启动
