Monit service name error

Therefore, in my monitrc file monitrc is the following:

 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:

 Error: service name conflict, apache already defined '/usr/local/apache/logs/httpd.pid' 
+6
source share
6 answers

If the server hostname is "apache", the conflict conflicts with the default rule to control system load.

Monit seems to have an implicit "check system hostname" rule, where hostname is the result of the hostname command.

You can overwrite this by adding only a line, for example:

 check system newhostname 

For instance:

 check system localhost 
+6
source

I saw this error when I forgot to comment on a line:

 include /etc/monit/conf.d/* 

in the user file /etc/monit/conf.d/myprogram.conf, so it was recursively included in this file.

+4
source

Should you have an entry with the apache host name under this entry or in a separate monit configuration file?

+2
source

Very important thing: you need monit 5.5 For example, in ubuntu 12.04, available only in repo only 5.3

So, you need to download and install from another 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

0
source

Check if you had any conflicts for Apache defined in any of the monit conf files in the monit conf directory, I accidentally added nginx for my puma.conf and had encountered the same error before.

0
source

In my case, I just had to restart monit to get rid of the service name error:

sudo service monit restart

0
source

Source: https://habr.com/ru/post/903410/


All Articles