Monit进程监控

Agent通过Http与Monit守护进程通信,增加,移除,启动,停止,监护和取消监护任务进程。

查询状态

查看部署的任务的状态

$ bosh instances

Deployment `my-deployment'

Director task 10326

Task 10326 done

+----------------+---------+---------------+-------------+
| Instance       | State   | Resource Pool | IPs         |
+----------------+---------+---------------+-------------+
| redis-master/0 | running | redis-servers | 10.10.30.71 |
| redis-slave/0  | running | redis-servers | 10.10.30.72 |
| redis-slave/1  | failing | redis-servers | 10.10.30.73 |
+----------------+---------+---------------+-------------+

在VM上使用Monit

使用monitCLI你可以获取到BOSH管理的虚拟机中的任务进程的状态。需要使用root用户。每个可用的release 任务有其自己的目录在/var/vcap/jobs/目录下面。每个任务目录下面有monit file. 如:/var/vcap/jobs/redis-server/monit,配置文件中可指定哪些进程属于哪个任务,大部分任务仅启动单个进程。

查看所有进程状态:

$ monit summary

The Monit daemon 5.2.4 uptime: 1d 22h 7m

Process 'nats'                      running
Process 'redis'                     running
Process 'postgres'                  running
Process 'powerdns'                  running
Process 'blobstore_nginx'           running
Process 'director'                  running
Process 'worker_1'                  running
Process 'worker_2'                  running
Process 'worker_3'                  running
Process 'director_scheduler'        running
Process 'director_nginx'            running
Process 'registry'                  running
Process 'health_monitor'            running
System 'system_bm-24638eb6-55b9-4670-bb1a-23c9e3f77d91' running

it is usually useful to tell Monit to stop restarting the failing process. You can do so via monit stop <process-name>command. To start it back up use monit start <process-name> command 有时要看进程为啥失败,需要停止进程,未防止monit自动重启进程,使用如上命令。

results matching ""

    No results matching ""