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.
Under Administration → Authorization system → Rights → Events, rights for persons and groups of persons can be adjusted.
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 (AllowOverride All).
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):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
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).
|1.3||2022-09-05||[Task] Change link to Knowledgebase |
[Task] PHP 8.0 Compatibility
[Task] Design Compatibility
[Bug] Events are not triggered when changing/assigning roles
|1.2||[Improvement] The event contains information about the user |
[Bug] Custom category constants are not passed, when ranking entries
|1.1.1||2019-07-31||[Bug] Drop-down empty in hooks for object types |
|1.1||2019-01-30||[Bug] Constant of user defined categories is missing |
|1.0.1||[Bug] i-doit 1.12 compatibility |