centreon / centreon-engine

Extremely fast monitoring scheduler, forked from Nagios
GNU General Public License v2.0
42 stars 17 forks source link

CRITICALITY_LEVEL/ID (and any other custom macro) are not inherited from service template #508

Closed maxenced closed 1 year ago

maxenced commented 3 years ago

Prerequisites

Versions

# centengine --version
[1621866249] [34647] Centreon Engine 20.10.2

Description

CRITICALITY set on a service template is not inherited by service.

Steps to Reproduce

Describe the received result

The generated configuration on poller looks like:

define service {
    service_description            test
    name                           test
    check_command                  testcommand
    register                       0
    use                            generic-service
    _CRITICALITY_LEVEL             1
    _CRITICALITY_ID                12
}

define service {
    host_name                      sxxxxxx
    service_description            test
    contacts                       test_nbh
    register                       1
    use                            test
    _SERVICE_ID                    yyyy
}

Which seems good. However, CRITICALITY_LEVEL (and ID) are not available as environment variable.

Describe the expected result

We expect to be able to inherit CRITICALITY_LEVEL (and ID) from service template. Quickly looking at the code, it seems that inheritance is made through MGR_INHERIT only for an explicit subset of values.

Could you please fix it, or at least inherit explicitly criticality level / id ?

Current behaviour makes the whole criticality feature (that we need) hardly usable (unless i missed some features / configuration ? ) :(

omercier commented 2 years ago

Hi @maxenced Sorry for the long delay. Can you detail your use case and tell us how you are trying to use these custom macros? According to me, they must be inherited correctly, or else we would have loads of other issues regarding thresholds and other custom macros. By the way, the criticalities are managed as severities since release 22.04:

define severity {
    id                             5
    name                           P1
    level                          1
    icon_id                        2
    type                           service
}
define service {
    service_description            generic-active-service
    name                           generic-active-service-custom
    register                       0
    use                            generic-active-service
    _CRITICALITY_LEVEL             1
    _CRITICALITY_ID                5
    severity                       5
}