Skip to content

History list displays incorrect flapping threshold #583

Closed
@julianbrost

Description

@julianbrost

Describe the bug

For services, the history event list displays incorrect flapping thresholds for these events.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Create a service with `flapping_threshold_{low,high} different from its host.
  2. Make it flap.
  3. Take a look at the history: displays inconsistent flapping values/thresholds (see screenshot below).

Expected behavior

Should display correct thresholds.

Screenshots

20220705_15h56m08s_grim

Your Environment

Include as many relevant details about the environment you experienced the problem in.

  • Icinga DB Web version (System - About): 1.0.0
  • Icinga Web 2 version (System - About): 2.11.0
  • Web browser: Firefox 102 (Linux)
  • Icinga 2 version (icinga2 --version): r2.13.4-1
  • Icinga DB version (icingadb --version): v1.0.0
  • PHP version used (php --version): 7.4.28
  • Server operating system and version: Debian bullseye

Additional context

From looking at the code: accessing ...->host->... looks suspicious:

$caption
->add(sprintf(
t('State Change Rate: %.2f%%; Start Threshold: %.2f%%'),
$this->item->flapping->percent_state_change_start,
$this->item->host->flapping_threshold_high
))

flapping_end also doesn't look right either, but haven't explicitly tested this so far (also, why 2 thresholds?):

$caption
->add(sprintf(
t('State Change Rate: %.2f%%; End Threshold: %.2f%%; Flapping for %s'),
$this->item->host->flapping_threshold_low,
$this->item->host->flapping_threshold_high,
DateFormatter::formatDuration(
$this->item->flapping->end_time - $this->item->flapping->start_time
)
))

This is the offending history event in the database. It also contains the correct threshold of 5%:

MariaDB [icingadb]> SELECT * FROM history JOIN flapping_history ON flapping_history.id = history.flapping_history_id WHERE history.id = 0x5f3681d39b2ccf1c412fe17907233323495acd54 \G
*************************** 1. row ***************************
                        id: 0x5F3681D39B2CCF1C412FE17907233323495ACD54
            environment_id: 0xA2FA17963E03689DEAA3889A6CB52C960380D7E4
               endpoint_id: 0x4F26AEAFDB2367620A393C973EDDBE8F8B846EBD
               object_type: service
                   host_id: 0xDAA09391238EFAB941064FB1A3CC045DD73180AC
                service_id: 0x9BC1E27ACE76931EA0AA1FE2448F94A02704A1D3
   notification_history_id: NULL
          state_history_id: NULL
       downtime_history_id: NULL
        comment_history_id: NULL
       flapping_history_id: 0x90E6A43ADF87F57E2E02B4D737FE1B7F32F0DB93
acknowledgement_history_id: NULL
                event_type: flapping_start
                event_time: 1657010690893
                        id: 0x90E6A43ADF87F57E2E02B4D737FE1B7F32F0DB93
            environment_id: 0xA2FA17963E03689DEAA3889A6CB52C960380D7E4
               endpoint_id: 0x4F26AEAFDB2367620A393C973EDDBE8F8B846EBD
               object_type: service
                   host_id: 0xDAA09391238EFAB941064FB1A3CC045DD73180AC
                service_id: 0x9BC1E27ACE76931EA0AA1FE2448F94A02704A1D3
                start_time: 1657010690893
                  end_time: NULL
percent_state_change_start: 5.9
  percent_state_change_end: NULL
    flapping_threshold_low: 5
   flapping_threshold_high: 5
1 row in set (0.001 sec)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions