-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Hi all
I'm facing some performance issues with the icinga2_object.py
action module and the task roles/icinga2/tasks/objects.yml
at line 26 (unfortunately it doesn't have a name).
Problem Statement
1st Issue
I think one issue arises because we call this action plugin with a loop. So if we have n Icinga objects defined, we call this plugin n times.
2nd Issue
The second issue is that for each Icinga object we created, we simply copy it to the target host using the copy_action
. The copy module is quite slow and since we copy each file individually, execution time increases significantly.
Possible Solutions
Here are some possible solutions
1st Issue
Instead of calling the icinga2_object.py
action module from within a loop, we could call it just once and pass the whole tmp_objects
. This means that we only call this plugin once and calculate all Icinga objects within that call. I was able to test that locally and the Ansible execution time was 50% faster.
2nd Issue
Here I'm not quite sure how this could be solved. I'm not even 100% sure if I fully understand the existing code. But basically we create all config fragments locally on our Ansible control node. Once everything is ready, we copy each file individually to the Icinga2 Host using the add custom config to assemble
task in roles/icinga2/tasks/objects.yml
. Each Icinga object is a file, so this could quickly scale up to several thousand files that need to be copied. Wouldn't it be faster and easier if we generate the fragments directly on the Icinga2 Host? This way we don't even have to copy them...
I hope my problem statement is clear. I'm looking forward to your comments and ideas how we can improve this :)