Werk #4699: WATO Web-API: now able to configure rulesets and folders
Komponente | Setup | ||
Titel | WATO Web-API: now able to configure rulesets and folders | ||
Datum | 23.05.2017 | ||
Level | Bedeutende Änderung | ||
Klasse | Neues Feature | ||
Kompatibilität | Kompatibel - benötigt kein manuelles Eingreifen | ||
Checkmk versions & editions |
|
You can now configure all rules which are available in the Host & Service Parameters Page through the use of two Web-API calls.
Important: Right now the rules api interface is only able to speak the python language.
The existing output_format parameter, as well as the new request parameter request_format
must both be set to python. An additional interface language is planned, maybe XML.
Furthermore, these API calls are intended for admin use only, since they modify the entire
ruleset in all folders.
get_rulesets_info
This API call does not require any additional info. It simply returns a list of all available rulesets.
Each entry of this list is a dictionary which includes information about the title, the help text, the item
help text and the how often the rule is used.
get_ruleset
Requires the request key ruleset_name, which specifies the ruleset to query.
This API call returns exactly one complete ruleset of all folders, so you can't query differnt types.
The response itself has an extra key configuration_hash, which can be used in the following call.
set_ruleset
The previous call provided a dict with the ruleset configuration. This call expect the same format
in the request object. You can modify the modify the previously queried dict and send it back through this
f you also sent the configuration_hash parameter, the Web-API will check if the configuration has changed
in the meantime. If so, the set_ruleset call will fail. When no configuration_hash parameter is sent,
no checking will be done.
Furthermore you can now also configure WATO folders with these new calls
get_folder
Requires the (physical) folder name in the parameter folder and returns the configured attributes.
If you want to see the inherited attributes in this folder, you can set the option effective_attributes=1
Note: The attributes returned with effective_attributes cant be used in a followup add_folder/edit_folder call.
This call also returns a configuration hash for the folder object, which can be used later on.
Its purpose is the same, than in the aforementioned set_ruleset call.
add_folder
Requires the (physical) folder name in the parameter folder and a attributes dictionary containing the folder attributes.
edit_folder
Requires the (physical) folder name in the parameter folder and a attributes dictionary containing the folder attributes.
Fails if the folder does not exist.
delete_folder
Requires the (physical) folder name in the parameter folder.
Fails if the folder does not exist.
get_all_folders
Returns a dictionary of all folders. Also supports the effective_attributes parameter.