S
S
serious9112017-01-08 16:38:48
MongoDB
serious911, 2017-01-08 16:38:48

MongoDB + monit?

Hello.
Ubuntu 14.04 LTS server has MongoDB installed. Monit + Munin is used for monitoring. You need to add MongoDB monitoring to monit.
Pid file /var/run/mongod.pid is present:

$ ls -la /var/run/mongod.pid 
-rw-r--r-- 1 root root 6 Jan  7 17:58 /var/run/mongod.pid

I add the following configuration to /etc/monit/monitrc:
check process mongod with pidfile /var/run/mongod.pid
    start program = "/sbin/start mongod"
    stop program = "/sbin/stop mongod"
    if failed host 127.0.0.1 port 27017 then restart
    if cpu > 60% for 2 cycles then alert
    if cpu > 85% for 5 cycles then restart
    if 5 restarts within 5 cycles then timeout

The problem is that it doesn't quite work. There is a service in monit, but it is constantly "Not monitored" or "Execution failed". However, the base itself works well.
I suspect the problem is here:
start program = "/sbin/start mongod"
    stop program = "/sbin/stop mongod"

Other services in monit are started via /etc/init.d, but in mongo there is no file to start there, only in /etc/init/mongod.conf.
start program = "/etc/init.d/nginx start"
    stop program = "/etc/init.d/nginx stop"

I also tried to add such a file to init.d , but it does not help.
Can you please tell me what could be the problem or what am I doing wrong?
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question