The Event add-on allow for a high degree of automation when working with the IT documentation. If something is changed in the IT documentation, then third-party system will be informed about these changes. If, for example, a new VM is documented in i-doit, it can automatically be created and provisioned on a virtualization host.
The configuration is accessed via
Administration → CMDB settings → Events → Hooks.
404 Page not Found
When you try to access the event configuration and receive an error message, stating that the page could not be found, this is in all likelihood due to a faulty configuration of the web server. The Apache module
rewrite has to be activated and the processing of the
.htaccess file in the installation folder of i-doit needs to be permitted (
Events are combined with commands. An event is triggered by a hook, an internal routine in i-doit. The following events are available:
- Create (only via the web GUI)
- Object type
Thus there exist matching events for all states in the IT documentation. As many event-to-command combinations as desired are possible.
The command is carried out immediately once the configured event occurs. A shell script is executed for this purpose. This requires the rights to be executed by the user or group with whose rights the web server is running. On a Debian-based operating system this is the user
www-data with the group of the same name. Because of this, the script under GNU/Linux requires the right bit for executing (
x). The programming language is arbitrary but it should be supported by the operating system (Bash, PHP, Python, Perl etc.).
Information about the event is referred to the shell script. The information is encoded as JSON with BASE64. The following is an example of a JSON string when saving a category entry (the BASE64 decoding already took place):
You can see that the
General category was saved successfully for the "Headquarter Network" object.
Additional parameters that are given to the shell script can also be set. These are static, in other words without a placeholder.
The described shell scripts are not only suited to control third-party systems but also i-doit itself. There is no reason not to use such a shell script in order to access the command line tool of i-doit, the controller or the API. This way, automated tasks can be handled within the IT documentation.
The commands are executed synchronously. For example, they are executed immediately as soon as the
Save button is used and the system will wait until the shell script has ended. With many and/or extensive shell scripts this slow will down the web GUI of i-doit and thus negatively affect its usability. Because of this, it may be worthwhile to build a queue: i-doit runs a shell script which loads the parameters and stores them in a queue (for example in a temporary file). Another script is executed which processes this queue, using Cronjob or something similar. This way, an asynchronous workflow is created so that the usability of i-doit is not appreciably affected.
When an event is triggered and it is linked to a command, then this execution is logged. The last 500 entries are listed at
Administration → CMDB settings → Events → History (Log).
[Bug] Drop-down empty in hooks for object types
[Bug] Constant of user defined categories is missing
[Bug] i-doit 1.12 compatibility