Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.01k stars 577 forks source link

New services are unkown since Icinga 2 restart. #7807

Open mphilipps opened 4 years ago

mphilipps commented 4 years ago

hi, This might be an icinga2 web bug, in that case please move this issue.

Describe the bug

Yesterday I have added a new host+services through editing the config and reloading. Afterwards I noticed that one of the new services is consider to be in the state unknown since the end of last year. This also happens to be the last time the Icinga2 service was restarted.

To Reproduce

  1. restart Icinga
  2. wait a few minutes
  3. create a new service that is expected to enter the unknown state
  4. check the "unknown since" field in icinga2 web

Expected behavior

The unknown since field should display since when the service changed from pending to unknown or if that isn't possible since the service object was created.

Screenshots

screen

Your Environment

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

dnsmichi commented 4 years ago

I'd say this is more of a visual problem, therefore I'll move this to the Icinga Web project.

nilmerg commented 4 years ago

Hi,

I don't quite get the issue you have. Isn't it shown since when it's unknown? (2019-12) Do you expect the full date and time? (Just hover over it, then it should be displayed) In the detail area it's also shown in full.

mphilipps commented 4 years ago

hi, It does, however the server and service in question hasn't existed in 2019. Yesterday I installed the server, there can't be service for it that is unknown since 2019.

nilmerg commented 4 years ago

I see. Though, it's Icinga which is using the time and date of the last launch as last update time of a new host/service. We can't differentiate this from a real update time so unless this changes in Icinga we can't fix it here.

But there's already https://github.com/Icinga/icinga2/issues/7784 due to a different requirement. This might have also an effect on the IDO so there's hope. :crossed_fingers:

mphilipps commented 4 years ago

Yes, I wasn't sure whether this is an Icinga2 or Icingaweb issue. That is why I created the ticket in the icinga2 tracker.

nilmerg commented 4 years ago

Soooo, took a look at it now. It's clearly an Icinga 2 issue. A host/service that enters the UNKNOWN state upon the very first check gets the time and date of Icinga 2's launch as last state change. By restarting Icinga 2 after changing the configuration this isn't as obvious as when reloading Icinga 2.

dnsmichi commented 4 years ago

Might be related to #7597 with Application::GetStartTime(), reload and 2.11 in mind. @htriem

        [state] CheckResult::Ptr last_check_result;
        [state] Timestamp last_state_change {
                default {{{ return Application::GetStartTime(); }}}
        };
        [state] Timestamp last_hard_state_change {
                default {{{ return Application::GetStartTime(); }}}
        };
        [state] Timestamp last_state_unreachable;

        [state] Timestamp previous_state_change {
                default {{{ return Application::GetStartTime(); }}}
        };
usmanC9 commented 4 years ago

Hello, we are also facing the same problem in v2.11.0-1. All new host/service that goes into unknown or critical state in their 1st check set last_state_time = application start time.

image (The above host is added today at 14-02-2020 17:53)

Further, in state history table there is no record of 1st check attempt. image

Icinga2 Process Info image

Al2Klimov commented 8 months ago

https://github.com/Icinga/icinga2/blob/9e31b8b5590c6d67b7dd538b2c884bd377a4e486/lib/icinga/checkable.ti#L107-L109