Monit only tries to start the service only one time

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Monit only tries to start the service only one time

Oscar Segarra
Hi, 

I have set the following configuration to check if two pools are started.

check program check_pool_nfs_vdic_images with path "/usr/bin/bash -c '/usr/bin/virsh pool-list | grep nfs-vdic-mgmt-vm'"
    with timeout 60 seconds
    depends on check_nfs_resources
    if status != 0 for 2 times within 2 cycles then exec "/usr/bin/virsh pool-start nfs-vdic-mgmt-vm"
    if status != 0 for 60 cycles then unmonitor


check program check_pool_nfs_vdic_images with path "/usr/bin/bash -c '/usr/bin/virsh pool-list | grep nfs-vdic-images'"
    with timeout 60 seconds
    depends on check_nfs_resources
    if status != 0 for 2 times within 2 cycles then exec "/usr/bin/virsh pool-start nfs-vdic-images"
    if status != 0 for 60 cycles then unmonitor

Parent resources are Ok!


As I expect, if It it is not started on a 2 consecutive polls, It may try to start it, but I have realized that It just tries to start the pool only one time as can be seen in logs:

[CET Feb 26 19:54:57] info     : Monit daemon with pid [12170] stopped
[CET Feb 26 19:54:57] info     : 'vdicnode01.vdicube.com' Monit 5.20.0 stopped
[CET Feb 26 19:54:57] info     : Starting Monit 5.20.0 daemon with http interface at [*]:2812
[CET Feb 26 19:54:57] info     : 'vdicnode01.vdicube.com' Monit 5.20.0 started
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:57] info     : 'check_pool_nfs_vdic_mgmt_vm' exec: '/usr/bin/virsh pool-start nfs-vdic-mgmt-vm'
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] info     : 'check_pool_nfs_vdic_images' exec: '/usr/bin/virsh pool-start nfs-vdic-images'
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output


Is there any way to instruct monit to try to start the pool more than one time? (only if check fails two consecutive times)

Thanks a lot.



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Monit only tries to start the service only one time

martinp@tildeslash.com
Hi,

yes, see the "repeat" option for the exec action: https://mmonit.com/monit/documentation/monit.html#ACTION

Best regards,
Martin


On 26 Feb 2017, at 20:06, Oscar Segarra <[hidden email]> wrote:

Hi, 

I have set the following configuration to check if two pools are started.

check program check_pool_nfs_vdic_images with path "/usr/bin/bash -c '/usr/bin/virsh pool-list | grep nfs-vdic-mgmt-vm'"
    with timeout 60 seconds
    depends on check_nfs_resources
    if status != 0 for 2 times within 2 cycles then exec "/usr/bin/virsh pool-start nfs-vdic-mgmt-vm"
    if status != 0 for 60 cycles then unmonitor


check program check_pool_nfs_vdic_images with path "/usr/bin/bash -c '/usr/bin/virsh pool-list | grep nfs-vdic-images'"
    with timeout 60 seconds
    depends on check_nfs_resources
    if status != 0 for 2 times within 2 cycles then exec "/usr/bin/virsh pool-start nfs-vdic-images"
    if status != 0 for 60 cycles then unmonitor

Parent resources are Ok!


As I expect, if It it is not started on a 2 consecutive polls, It may try to start it, but I have realized that It just tries to start the pool only one time as can be seen in logs:

[CET Feb 26 19:54:57] info     : Monit daemon with pid [12170] stopped
[CET Feb 26 19:54:57] info     : 'vdicnode01.vdicube.com' Monit 5.20.0 stopped
[CET Feb 26 19:54:57] info     : Starting Monit 5.20.0 daemon with http interface at [*]:2812
[CET Feb 26 19:54:57] info     : 'vdicnode01.vdicube.com' Monit 5.20.0 started
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:27] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:56:57] info     : 'check_pool_nfs_vdic_mgmt_vm' exec: '/usr/bin/virsh pool-start nfs-vdic-mgmt-vm'
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:56:57] info     : 'check_pool_nfs_vdic_images' exec: '/usr/bin/virsh pool-start nfs-vdic-images'
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:57:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:28] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_mgmt_vm' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output
[CET Feb 26 19:58:58] error    : 'check_pool_nfs_vdic_images' status failed (1) -- no output


Is there any way to instruct monit to try to start the pool more than one time? (only if check fails two consecutive times)

Thanks a lot.


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general