监控服务名称错误

发布于 2024-12-20 07:17:26 字数 707 浏览 6 评论 0原文

因此,我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

黎歌 2024-12-27 07:17:26

如果服务器的主机名是“apache”,则与监视系统负载的默认规则存在冲突。

Monit 似乎有“检查系统主机名”的隐式规则,其中主机名是 hostname 命令的输出。

您可以通过添加一行来覆盖它,例如

check system newhostname

check system localhost

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:

check system newhostname

For example:

check system localhost
灵芸 2024-12-27 07:17:26

当我忘记注释掉

include /etc/monit/conf.d/*

自定义 /etc/monit/conf.d/myprogram.conf 文件中的行:时,我看到了此错误,因此它递归地包含该文件。

I saw this error when I forgot to comment out the line:

include /etc/monit/conf.d/*

in a custom /etc/monit/conf.d/myprogram.conf file, so it was recursively including that file.

淡紫姑娘! 2024-12-27 07:17:26

您是否有可能在此条目下或在单独的 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?

沉默的熊 2024-12-27 07:17:26

您多次定义相同的服务。检查该服务的所有 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.

自此以后,行同陌路 2024-12-27 07:17:26

非常非常重要的事情:你需要 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

暖树树初阳… 2024-12-27 07:17:26

对于我的情况,我只需重新启动 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

七堇年 2024-12-27 07:17:26

检查 /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 added nginx for my puma.conf and ran into the same error before.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文