Github issue: https://github.com/centreon/centreon/issues/8042
Since 24.10.8 (could also have been introduced in earlier versions) all inherited command macros are directly written on the host with an empty value when a new host is added (only on add, does not happen on update host).
This also happens on new Host Templates.
Problematic situations that can happen due to this bug:
Imagine creating a new host based on template T1
, somewhere in the template tree is a command which declares macro $_HOSTOPTIONS$
. At the moment the template T1
has no value for the macro defined. The new host gets created and the macro is wrongly written on the host with an empty value. Now I set a macro value for $_HOSTOPTIONS$
on the template T1
. The recently created host will never inherit the value from the template due to the directly written empty value on the host itself.
So basically the main problem here is, that the macro value inheritance gets impaired.
Screenshots for better understanding:
Before ADD (notice the green background)
After ADD (notice the white background)
I can confirm that the values are directly written on the host by checking the database table on_demand_macro_host:
MariaDB ecentreon]> select * from on_demand_macro_host where host_host_id = 96;
+---------------+----------------------------+------------------+-------------+-------------+--------------+-------------+
| host_macro_id | host_macro_name | host_macro_value | is_password | description | host_host_id | macro_order |
+---------------+----------------------------+------------------+-------------+-------------+--------------+-------------+
| 219 | $_HOSTEXTRA-OPTS$ | | NULL | NULL | 96 | 0 |
| 220 | $_HOSTSNMPUSERNAME$ | | NULL | NULL | 96 | 1 |
| 221 | $_HOSTSNMPTIMEOUT$ | | NULL | NULL | 96 | 2 |
| 222 | $_HOSTSNMPAUTH-PASSPHRASE$ | | NULL | NULL | 96 | 3 |
| 223 | $_HOSTSNMPAUTH-PROTOCOL$ | | NULL | NULL | 96 | 4 |
| 224 | $_HOSTSNMPPRIV-PASSPHRASE$ | | NULL | NULL | 96 | 5 |
| 225 | $_HOSTSNMPPRIV-PROTOCOL$ | | NULL | NULL | 96 | 6 |
+---------------+----------------------------+------------------+-------------+-------------+--------------+-------------+
7 rows in set (0.000 sec)