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
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 : Starting Monit 5.20.0 daemon with http interface at [*]:2812
[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
Thanks a lot.