How to properly configure monit config, with pid for CouchDB 2.1.1?

Keywords: CouchDB - Google Cloud Platform - How to - Other
Description:
The current monit config for couchdb uses the pid,

check process couchdb
with pidfile “/opt/bitnami/couchdb/var/run/couchdb/couchdb.pid”

When I look in that folder, it doesn’t have that pid file there, so monit is not monitoring.

The ctrl script finds the pid by looking for the this file/opt/bitnami/couchdb/bin/…/erts-9.1/bin/beam.smp? I’m confused how to get monit properly working with couchdb.

Hi @teebu,

Thank you for reporting this issue. I just forwarded this information to our Engineering team and it will work on fixing it.

Someone in the team will update this thread as soon as we have more information.

Sorry for the inconvenience

Hi @teebu,

Can you try the following workaround to see if it solves your issue? You will need to add a line to the /opt/bitnami/couchdb/scripts/ctl.sh file to create the pid file:

...
     if [ $ERROR -eq 0 ]; then
         echo "$0 $ARG: couchdb started at port 5984"
+        echo $PID > /opt/bitnami/couchdb/var/run/couchdb/couchdb.pid
         sleep 2
     else
...

Then, restart the services:

sudo /opt/bitnami/ctlscript.sh restart

Please let us know if this quick fix works for you.

Best regards,
Andrés Bono.

The fix does create the pid file. And monit is identifying it as running.

Now the question is, the pid file persists if couchdb is stopped? Does monit know it’s not running?

Update: I looked it up, and yes monit will lookup the running process from the pid in the file. It doesn’t care about the zombie pid files.

Hi @teebu,

The pid file persists when couchdb is stopped but the content is updated on every start. As you mentioned, monit checks the content of the pid file not the existence of it.

If you mean that the service is running but hanging, (e.g. the process is running but not responding) you can add extra checks like the proposed here: http://nikosmarkopoulos.com/monitoring-couchdb-with-monit/

  if failed host localhost port 5984 proto http then restart
  if failed url http://localhost:5984/ and content == '"couchdb"' then restart
  if 3 restarts within 5 cycles then timeout

Best regards,
Andrés Bono.

Hi @teebu,

We just released a new revision of CouchDB (from 2.1.2-0 to 2.1.2-1) solving this issue, you can take a look to the application page in Bitnami site:

https://bitnami.com/stack/couchdb

Best regards,
Carlos R. Hernández

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.