Execution of probes can be scheduled using quatz scheduling engine. A quartz job contains the code to be executed.
With quartz we can create and manage lifecycle of jobs.
cmd probescheduler add <file_name.xml> “<cron string="">” : loads the probe xml in database and schedules a run of the probe to be triggered using the cron experession “<cron string="">”. </cron></cron></file_name.xml>
cmd probescheduler delete <file_name.xml> | <job_id> : deletes the job with id job_id created to exceutes the probe xml file file_name.xml</job_id></file_name.xml>
cmd probescheduler run_now <file_name.xml> | <job id=""> : forces the probe to run now.</job></file_name.xml>
cmd probescheduler run_once <file_name.xml>|<job id=""> “cron string” : schedules a job on the probe to be run once.</job></file_name.xml>
cmd probescheduler running : lists running jobs.
cmd probescheduler list : lists scheduled jobs.
cmd probescheduler view <job_id> : outputs the probe xml file.</job_id>
cmd probescheduler update <job_id> <new_file_name.xml> : updates the job with id job_id with the xml file new_file_name.xml.</new_file_name.xml></job_id>
cmd probescheduler reschedule <job_id> “<cron_string>” : updates the cron expression of a job.</cron_string></job_id>
cmd probescheduler disable <job_id> : disables job job_id. not removed but won't run again.</job_id>
ESIS back-end uses Quartz scheduling engine (https://quartz-scheduler.org/) to schedule and execute probes , report generation and other tasks.
Quartz server engine runs as an instance and exposes its services to be used via RMI. Clients are then created by instanciating a scheduler and can send requests (create, execute ,stop, tasks..) to the server using a proxy.
Quartz server engine can be started and stopped using the scripts/shceduler [start|stop].
Quartz server configuration file :
#============================================================================
# Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = instance_one
#============================================================================
# ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
#============================================================================
# JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#The org.quartz.jobStore.useProperties config parameter can be set to true (it defaults to false)
#in order to instruct JDBCJobStore that all values in JobDataMaps will be Strings, and therefore
#can be stored as name-value pairs, rather than storing more complex objects in their serialized
#form in the BLOB column. This is much safer in the long term, as you avoid the class versioning issues that come with serializing non-String classes into a BLOB.
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=scheduler.QRTZ_
org.quartz.jobStore.isClustered=false
#============================================================================
# Datasource
#============================================================================
org.quartz.dataSource.myDS.driver = org.postgresql.Driver
#org.quartz.dataSource.myDS.URL = jdbc:postgresql://localhost:5434/esis_sdw
#org.quartz.dataSource.myDS.user =esis_user
#org.quartz.dataSource.myDS.password =Pa55w0rd
#If your Scheduler is busy, meaning that is nearly always executing the same number of jobs
#as the size of the thread pool, then you should probably set the number of connections in
#the DataSource to be the about the size of the thread pool + 2.
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=
#============================================================================
#plugins
#============================================================================
#Plugins that ship with Quartz to provide various utililty capabilities can be
#found documented in the Quartz.Plugins namespace. They provide functionality such as
#auto-scheduling of jobs upon scheduler startup, logging a history of job and trigger
#events, and ensuring that the scheduler shuts down cleanly when the virtual machine exits.
org.quartz.scheduler.rmi.export = true
org.quartz.scheduler.rmi.createRegistry = true
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099
org.quartz.scheduler.rmi.serverPort = 1100
Quartz client (using RMI) configuration file :
#============================================================================
# Main Properties
#============================================================================
org.quartz.scheduler.instanceName = TestScheduler
org.quartz.scheduler.instanceId = instance_one
org.quartz.scheduler.skipUpdateCheck = true
org.quartz.scheduler.jobFactory.class = org.quartz.simpl.SimpleJobFactory
org.quartz.scheduler.rmi.proxy = true
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099