This features is available in version 0.6 or higher.
The TaskScheduler adds the availability to yourCMDB, to execute actions driven by events. At the moment, the following events exists in yourCMDB:
You can also define your own custom events for specific object types using objecttype configuration.
The following actions are available at the moment:
class name | description |
---|---|
TaskSchedulerActionExec | executes an external script |
TaskSchedulerActionExport | executes an export task of the yourCMDB exportAPI |
To setup TaskScheduler, use the possibility of your operating system, to execute the script <yourCMDB-Dir>/scripts/taskscheduler.php every minute.
For example you can use the following line for cron in /etc/crontab:
The taskscheduler.php script will check, if there are jobs to execute and will execute them.
To configure TaskScheduler, use the taskscheduler-configuration.xml file in the <yourCMDB>/etc directory. Please see the following example:
<taskscheduler-configuration> <task trigger="event" event="objectAdded" objecttype="router" action="TaskSchedulerActionExec" actionParameter="/root/nodeAdded.sh ${objectId}" /> <task trigger="event" event="objectAdded" objecttype="router" action="TaskSchedulerActionExec" actionParameter="/root/nodeAdded2.sh ${objectType}" /> <task trigger="event" event="objectAdded" objecttype="router" action="TaskSchedulerActionExec" actionParameter="/root/nodeAdded3.sh" /> <task trigger="event" event="objectAdded" objecttype="switch" action="TaskSchedulerActionExport" actionParameter="example" /> </taskscheduler-configuration>
A task is defined by using the <task> tag. Each task needs a trigger, action and actionParameter.
At the moment, only the trigger “event” is implemented. So a task can be triggered by a yourCMDB event. For the trigger event, the parameter event and objecttype must be set, where you define the event type and the object type given by the event.
The action will be executed by the TaskScheduler. You can give actionParameters to the action. The following actions are implemented at the moment:
action class | description | parameter | parameter example |
---|---|---|---|
TaskSchedulerActionExec | executes a script given in the parameter | script/binary to execute | /root/nodeAdded.sh ${objectId} |
TaskSchedulerActionExport | executes a task of the yourCMDB exportAPI | taskname | example |
You can use the following variables in the actionParameter string
variable | description |
---|---|
${objectId} | will be replaced by the objectId defined in the trigger-event |
${objectType} | will be replaced by the object type defined in the trigger-event |