monit監控自定義服務

版本:This is Monit version 5.25.1mysql

服務器上跑的公司本身的服務,查看網上寫的monit配置監控,都是一些監控常規應用(Nginx、Apache、mysql等)這些監控起來比較簡單,都有pid文件,tomcat能夠配置生成pid文件,可是公司本身的服務沒有pid文件,因而查看monit官網sql

Process

CHECK PROCESS <unique name> <PIDFILE <path> | MATCHING <regex>>

is the absolute path to the program's pid-file. A pid-file is a file, containing a Process's unique ID. If the pid-file does not exist or does not contain the PID number of a running process, Monit will call the entry's start method if defined.tomcat

is an alternative to using PID files and uses process name pattern matching to find the process to monitor. The top-most matching parent with highest uptime is selected, so this form of check is most useful if the process name is unique. Pid-file should be used where possible as it defines expected PID exactly. You can test if a process match a pattern from the command-line using monit procmatch "regex-pattern". This will lists all processes matching or not, the regex-pattern.服務器

除了監控pid文件,還能夠匹配進程名來監控this

因而我就試了一下spa

當進程不存在,則自動重啓並報警code

還算不錯,完事orm

相關文章
相關標籤/搜索