###############################################################################
## Monit control file
###############################################################################

###############################################################################
## Global section
###############################################################################
##
## Start Monit in the background (run as a daemon):
#
  set daemon 10            # check services at 10 second intervals
#
## Set syslog logging with the 'daemon' facility. If the FACILITY option is
## omitted, Monit will use 'user' facility by default. If you want to log to 
## a standalone log file instead, specify the full path to the log file
#
  set logfile /var/log/monit.log
#
#
## Set the location of the Monit id file which stores the unique id for the
## Monit instance. The id is generated and stored on first Monit start. By 
## default the file is placed in $HOME/.monit.id.
#
  set idfile /var/lib/monit/id
#
## Set the location of the Monit state file which saves monitoring states
## on each cycle. By default the file is placed in $HOME/.monit.state. If
## the state file is stored on a persistent filesystem, Monit will recover
## the monitoring state across reboots. If it is on temporary filesystem, the
## state will be lost on reboot which may be convenient in some situations.
#
  set statefile /var/lib/monit/state
#
## By default Monit will drop alert events if no mail servers are available. 
## If you want to keep the alerts for later delivery retry, you can use the 
## EVENTQUEUE statement. The base directory where undelivered alerts will be 
## stored is specified by the BASEDIR option. You can limit the maximal queue
## size using the SLOTS option (if omitted, the queue is limited by space 
## available in the back end filesystem).
#
  set eventqueue
      basedir /var/lib/monit/events # set the base directory where events will be stored
      slots 100                     # optionally limit the queue size
#
#
## Monit has an embedded web server which can be used to view status of 
## services monitored and manage services from a web interface. See the
## Monit Wiki if you want to enable SSL for the web server. 
#
 set httpd port 2812 and
    use address localhost  # only accept connection from localhost
    allow localhost        # allow localhost to connect to the server and
    allow admin:0rc#1d      # require user 'admin' with password 'monit'
    allow @monit           # allow users of group 'monit' to connect (rw)
    allow @users readonly  # allow users of group 'users' to connect readonly
#
###############################################################################
## Services
###############################################################################
#
# Check to make sure orchid_smart_search_postgres is running
    check process orchid_smart_search_postgres with pidfile /var/lib/orchid_server/postgres/smart_search_postgres.pid
        start program = "/etc/init.d/orchid_smart_search_postgres start" with timeout 60 seconds
        stop program = "/etc/init.d/orchid_smart_search_postgres stop"
#
# Check to make sure orchid_onvif_autodiscovery_service is running.
    check process orchid_onvif_autodiscovery_service with pidfile /var/run/orchid_onvif_autodiscovery.pid
        start program = "/etc/init.d/orchid_onvif_autodiscovery start" with timeout 60 seconds
        stop program = "/etc/init.d/orchid_onvif_autodiscovery stop"
#
# Check to make sure orchid_server is running.
    check process orchid_server with pidfile /var/run/orchid.pid
        start program = "/etc/init.d/orchid start" with timeout 60 seconds
        stop program = "/etc/init.d/orchid stop"
#    
#
# Check to make sure orchid_analytics_server is running.
    check process orchid_analytics_server with pidfile /var/run/orchid_analytics.pid
        start program = "/etc/init.d/orchid_analytics start" with timeout 60 seconds
        stop program = "/etc/init.d/orchid_analytics stop"
        depends on orchid_server
#
###############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#
   include /etc/monit/conf.d/*
#
