监控服务名称错误
因此,我的 monitrc
文件中有以下内容:
check process apache with pidfile /usr/local/apache/logs/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host XXX port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu 80% for 5 cycles then restart
if totalmem 500 MB for 5 cycles then restart
if children 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
但我不断收到以下错误:
Error: service name conflict, apache already defined '/usr/local/apache/logs/httpd.pid'
So I have the following in my monitrc
file:
check process apache with pidfile /usr/local/apache/logs/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host XXX port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu 80% for 5 cycles then restart
if totalmem 500 MB for 5 cycles then restart
if children 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
but I keep getting the error that:
Error: service name conflict, apache already defined '/usr/local/apache/logs/httpd.pid'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果服务器的主机名是“apache”,则与监视系统负载的默认规则存在冲突。
Monit 似乎有“检查系统主机名”的隐式规则,其中主机名是 hostname 命令的输出。
您可以通过添加一行来覆盖它,例如
:
If the hostname of the server is 'apache' then the conflict is with the default rule for monitoring the system load.
Monit seems to have the implicit rule of 'check system hostname', where the hostname is the output of hostname command.
You can overwrite that by adding just a line like:
For example:
当我忘记注释掉
自定义 /etc/monit/conf.d/myprogram.conf 文件中的行:时,我看到了此错误,因此它递归地包含该文件。
I saw this error when I forgot to comment out the line:
in a custom /etc/monit/conf.d/myprogram.conf file, so it was recursively including that file.
您是否有可能在此条目下或在单独的 monit 配置文件中存在主机名为 apache 的条目?
By any chance do you have an entry with a host name apache beneath this entry or in a separate monit config file?
您多次定义相同的服务。检查该服务的所有 monit 配置文件。这包括您的 monitrc 和“包含”部分下列出的所有文件(例如 include /etc/monit/conf.d/*)。
如果您在“包含”目录之一的文件中重新定义“包含”,您将遇到递归引用问题。
You have the same service defined more than once. Check all your monit config files for that service. This includes your monitrc and all files listed under the "Includes" section (like include /etc/monit/conf.d/*).
If you redefine "Includes" within a file in one of your "Includes" directories, you will run into recursive reference problems.
非常非常重要的事情:你需要 monit 5.5
例如,在 ubuntu 12.04 中,仅在存储库中提供 5.3,
因此您需要从其他存储库下载并安装。
我的解决方案,例如:
wget http:// /mirrors.kernel.org/ubuntu/pool/universe/m/monit/monit_5.5.1-1_amd64.deb && sudo dpkg -i monit_5.5.1-1_amd64.deb
Very very important thing : you need monit 5.5
For example in ubuntu 12.04 available in repo only 5.3
So you need to download and install from other repo.
Solution for me , for example :
wget http://mirrors.kernel.org/ubuntu/pool/universe/m/monit/monit_5.5.1-1_amd64.deb && sudo dpkg -i monit_5.5.1-1_amd64.deb
对于我的情况,我只需重新启动
monit
即可消除服务名称错误:sudo service monit restart
For my case, I simply had to restart
monit
to get rid of the service name error:sudo service monit restart
检查
/etc/monit.d/
目录下的任何monit conf
文件中定义的 Apache 是否存在任何冲突,我不小心添加了nginx< /code> 我的
puma.conf
之前遇到过同样的错误。Check if you have had any conflicts for Apache defined in any of the
monit conf
files under/etc/monit.d/
directory, I accidentally did addednginx
for mypuma.conf
and ran into the same error before.