Ubuntu-16.04

使用 Monit 在 Ubuntu 16.0.4 上監控 solr 服務

  • July 29, 2017

我試圖弄清楚為什麼我的 Monit ( https://mmonit.com/monit/ ) 似乎不想監視我的 Solr 服務。我已經為其餘的服務工作了:

在此處輸入圖像描述

但由於某種原因,Solr 不想正確監控。

我按照這裡的例子:

https://www.webfoobar.com/node/61

對於我的伺服器,我對其進行了一些調整,因此服務是正確的,還有一些路徑:

## Solr monitoring.

## Test the solr service.
check process solr with pidfile /var/solr/solr-8983.pid
 group solr
 start program = "/etc/init.d/solr start"
 stop  program = "/etc/init.d/solr stop"
 restart program  = "/etc/init.d/solr restart"
 if failed port 8983 then restart
 if 3 restarts within 5 cycles then timeout
 depends on solr_bin
 depends on solr_init

## Test the process binary.
check file solr_bin with path /opt/solr/bin/solr
 group root
 if failed checksum then unmonitor
 if failed permission 755 then unmonitor
 if failed uid root then unmonitor
 if failed gid root then unmonitor

## Test the init scripts.
check file solr_init with path /etc/init.d/solr
 group root
 if failed checksum then unmonitor
 if failed permission 744 then unmonitor
 if failed uid root then unmonitor
 if failed gid root then unmonitor

檢查語法一切正常:

 monit -t
/etc/monit/monitrc:295: Include failed -- Success '/etc/monit/conf.d/*'
Control file syntax OK

關於我可以嘗試什麼的任何其他建議?

**更新:**我真的不明白為什麼這不起作用。所有權限和文件似乎都存在,並且設置正確:

root@admin:/etc/init.d# ls -l /var/solr/solr-8983.pid
-rw-rw-r-- 1 solr solr 6 Jul 28 05:41 /var/solr/solr-8983.pid


root@admin:/etc/init.d# ls -l /etc/init.d | grep solr
-rwxr--r-- 1 root root 2711 Jul 25 13:25 solr

root@admin:/etc/init.d# ls -l /opt/solr/bin/ | grep solr
-rwxr-xr-x 1 root root 12694 May 29 22:36 install_solr_service.sh
-rwxr-xr-x 1 root root  1255 Mar  9 20:00 oom_solr.sh
-rwxr-xr-x 1 root root 72389 May 30 00:25 solr
-rwxr-xr-x 1 root root 66010 May 30 00:25 solr.cmd
-rwxr-xr-x 1 root root  6204 May 30 00:25 solr.in.cmd.orig
-rwxr-xr-x 1 root root  6950 May 30 00:25 solr.in.sh.orig

**更新 2:**重新啟動 Monit 時,我在monit.log中得到了這個:

[UTC Jul 28 10:22:45] info     : Shutting down Monit HTTP server
[UTC Jul 28 10:22:45] info     : Monit HTTP server stopped
[UTC Jul 28 10:22:45] info     : Monit daemon with pid [26662] stopped
[UTC Jul 28 10:22:45] info     : 'admin.steampunkjunkies.com' Monit 5.16 stopped
[UTC Jul 28 10:22:45] info     : Starting Monit 5.16 daemon with http interface at [213.219.38.44]:2812
[UTC Jul 28 10:22:45] info     : Starting Monit HTTP server at [213.219.38.44]:2812
[UTC Jul 28 10:22:45] info     : Monit HTTP server started
[UTC Jul 28 10:22:45] info     : 'admin.steampunkjunkies.com' Monit 5.16 started

您的**/opt/solr/bin/solr**文件存在問題,導致它成為unmonitor。有了依賴關係,該過程不受監控檢查solr_bin的權限、所有權等

在某些時候,solr_bin存在問題,導致它不受監控,並且由於依賴關係,solr 程序不受監控。使用or更新校驗和後,您必須手動監視solr_bin並通過 UI 或從 Monit 命令請求進行處理**。**當某些東西不受監控時,它不會自動回到監控狀態。您必須明確提出要求。monit reload``service monit restart

引用自:https://serverfault.com/questions/865188