Postgres restarted after 1 cycle, despite 3 cycle config

Issue #355 closed
Former user created an issue
check process postgres with pidfile /var/run/postgresql-9.4.pid
    start program = "/etc/init.d/postgresql-9.4 start"
    stop  program = "/etc/init.d/postgresql-9.4 stop"
    if failed 
        unixsocket /tmp/.s.PGSQL.5432 protocol pgsql 
        for 3 cycles
        then restart
    if failed
        host 127.0.0.1 port 5432 protocol pgsql 
        for 3 cycles
        then alert



[PDT Apr 26 18:54:06] debug    : 'postgres' succeeded testing protocol [PGSQL] at    [127.0.0.1]:5432 [TCP/IP] [response time 466.347 ms]
[PDT Apr 26 18:54:06] debug    : 'postgres' connection succeeded to [127.0.0.1]:5432 [TCP/IP]
[PDT Apr 26 18:54:12] error    : 'postgres' failed protocol test [PGSQL] at /tmp/.s.PGSQL.5432 -- PGSQL: error receiving data -- Resource temporarily unavailable
[PDT Apr 26 18:54:11] debug    : Socket test failed for [127.0.0.1]:5432 -- PGSQL: error receiving data -- Resource temporarily unavailable
[PDT Apr 26 18:54:12] error    : 'postgres' failed protocol test [PGSQL] at [127.0.0.1]:5432 [TCP/IP] -- PGSQL: error receiving data -- Resource temporarily unavailable
[PDT Apr 26 18:54:12] debug    : Sending Connection failed notification to xxxx
[PDT Apr 26 18:54:12] debug    : Sending Connection failed notification to xxxx
[PDT Apr 26 18:54:12] info     : 'postgres' trying to restart
[PDT Apr 26 18:54:12] info     : 'postgres' stop: /etc/init.d/postgresql-9.4
[PDT Apr 26 18:54:13] debug    : Stopping postgresql-9.4 service: [  OK  ]
[PDT Apr 26 18:54:13] debug    : 'postgres' stopped

Comments (3)

  1. Tildeslash repo owner

    Unable to reproduce. When you added the "for 3 cycles" option, did you reload monit? ("monit reload"). If not, monit is running with old configuration - you can check it via monit's HTTP GUI - open the given service and check the rules.

    Configuration:

    check process postgresql with pidfile /var/run/postgresql/9.3-main.pid
       start program = "/etc/init.d/postgresql start"
       stop program = "/etc/init.d/postgresql stop"
       if failed port 5432 protocol pgsql with timeout 20 seconds for 5 cycles then restart
       if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql with timeout 20 seconds for 5 cycles then alert
    

    Log:

    Apr 27 13:07:12 test monit[11465]: 'postgresql' failed protocol test [PGSQL] at [localhost]:5432 [TCP/IP] -- Connection refused
    Apr 27 13:07:12 tildeslash2 monit[11465]: 'postgresql' failed protocol test [PGSQL] at /var/run/postgresql/.s.PGSQL.5432 -- Cannot create unix socket for /var/run/postgresql/.s.PGSQL.5432
    Apr 27 13:07:44 test monit[11465]: 'postgresql' failed protocol test [PGSQL] at [localhost]:5432 [TCP/IP] -- Connection refused
    Apr 27 13:07:44 tildeslash2 monit[11465]: 'postgresql' failed protocol test [PGSQL] at /var/run/postgresql/.s.PGSQL.5432 -- Cannot create unix socket for /var/run/postgresql/.s.PGSQL.5432
    Apr 27 13:08:16 test monit[11465]: 'postgresql' failed protocol test [PGSQL] at [localhost]:5432 [TCP/IP] -- Connection refused
    Apr 27 13:08:16 tildeslash2 monit[11465]: 'postgresql' failed protocol test [PGSQL] at /var/run/postgresql/.s.PGSQL.5432 -- Cannot create unix socket for /var/run/postgresql/.s.PGSQL.5432
    Apr 27 13:08:48 test monit[11465]: 'postgresql' failed protocol test [PGSQL] at [localhost]:5432 [TCP/IP] -- Connection refused
    Apr 27 13:08:48 tildeslash2 monit[11465]: 'postgresql' failed protocol test [PGSQL] at /var/run/postgresql/.s.PGSQL.5432 -- Cannot create unix socket for /var/run/postgresql/.s.PGSQL.5432
    Apr 27 13:09:20 test monit[11465]: 'postgresql' failed protocol test [PGSQL] at [localhost]:5432 [TCP/IP] -- Connection refused
    Apr 27 13:09:20 test monit[11465]: 'postgresql' trying to restart
    Apr 27 13:09:20 test monit[11465]: 'postgresql' stop: /etc/init.d/postgresql
    Apr 27 13:09:21 test monit[11465]: 'postgresql' start: /etc/init.d/postgresql
    
  2. Log in to comment