Page 1 of 1

objects.cache showing wrong information? (Or not up to date)

Posted: Thu Jun 04, 2015 3:56 am
by WillemDH
Hello,

Just noticed something. When I cat the objects.cahe file for (for example) my Reactor server;

Code: Select all

cat /usr/local/nagios/var/objects.cache | sed -rn "/define host \{/{:a;N;/}/{/.host_name.reactor01/p;d};ba}"
define host {
        host_name      reactor01
        alias   reactor01
        address xx.xx.xx.xx
        check_period    xi_timeperiod_24x7
        check_command   check_xi_host_ping!3000.0!80%!5000.0!100%!!!!
        contacts        nagiosadmin,contactfts,nagiosadmin
        contact_groups  xi_dig_dummy_contact_group
        notification_period     xi_timeperiod_24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      3
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   1440.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        icon_image      icon_linux_centos.png
        statusmap_image icon_linux_centos.png
        retain_status_information       1
        retain_nonstatus_information    1
        _XIWIZARD       windowsserver
        }
I see several things that are not correct and not synchrone with the actual config:
_XIWIZARD windowsserver => Ther is no free variable defined for this host...
contacts nagiosadmin,contactfts,nagiosadmin => I deleted the contact fts a few weeks ago...

When I read http://sites.box293.com/nagios/guides/t ... ng-objects the objects.cache should contain the final object after all templates have been taken into account.

So why is it showing wrong config for this host object?

Code: Select all

define host {
        host_name                       reactor01
        use                             dig_linux_server_prio2
        alias                           reactor01
        address                         xx.xx.xx.xx
        hostgroups                      +hg_inf_vir_vmw,hg_loc_dg,hg_os_linux_centos,hg_rol_monitoring
        check_period                    xi_timeperiod_24x7
        contacts                        +nagiosadmin
        contact_groups                  +xi_dig_dummy_contact_group
        notification_period             xi_timeperiod_24x7
        icon_image                      icon_linux_centos.png
        statusmap_image                 icon_linux_centos.png
        register                        1
        }
This is the template:

Code: Select all

define host {
       name                                     dig_linux_server_prio2
       alias                                    dig_linux_server_prio2
       check_command                            check_xi_host_ping!3000.0!80%!5000.0!100%!!!!
       max_check_attempts                       3
       check_interval                           5
       retry_interval                           1
       check_period                             xi_timeperiod_24x7
       event_handler_enabled                    1
       flap_detection_enabled                   1
       process_perf_data                        1
       retain_status_information                1
       retain_nonstatus_information             1
       contacts                                 +nagiosadmin
       notification_interval                    1440
       notification_period                      xi_timeperiod_24x7
       first_notification_delay                 0
       notifications_enabled                    1
       icon_image                               icon_linux_centos.png
       register                                 0

}

Re: objects.cache showing wrong information? (Or not up to d

Posted: Thu Jun 04, 2015 9:29 am
by jdalrymple
WillemDH wrote:So why is it showing wrong config for this host object?

Because your Nagios is broken maybe?

Code: Select all

ls -l /usr/local/nagios/var/objects.cache
should coincide with your last reload

Code: Select all

[jdalrymple@localhost ~]$ ls -l /usr/local/nagios/var/objects.cache
-rw-r--r--. 1 nagios nagios 45643 Jun  2 14:41 /usr/local/nagios/var/objects.cache
[jdalrymple@localhost ~]$ sudo /etc/init.d/nagios reload
[sudo] password for jdalrymple:
Reloading nagios configuration (via systemctl):            [  OK  ]
[jdalrymple@localhost ~]$ ls -l /usr/local/nagios/var/objects.cache
-rw-r--r--. 1 nagios nagios 45643 Jun  4 09:27 /usr/local/nagios/var/objects.cache
[jdalrymple@localhost ~]$ date
Thu Jun  4 09:27:15 CDT 2015
What does the configuration in the core interface say:
Configuration --> Services
Find your service - look in the Default Contacts/Groups column

Re: objects.cache showing wrong information? (Or not up to d

Posted: Thu Jun 04, 2015 9:42 am
by WillemDH
Hmmm,

Very weird:

Code: Select all

ls -l /usr/local/nagios/var/objects.cache
-rw-r--r--. 1 nagios nagios 9953257 Apr 13 13:08 /usr/local/nagios/var/objects.cache
13/04?? Does this mean it had no updates since 13/04?

Code: Select all

sudo /etc/init.d/nagios reload
Running configuration check...
Reloading nagios configuration...
done

Code: Select all

 date
Thu Jun  4 16:38:28 CEST 2015
The example I gave was from a host.. In CMM everything is 'like we configured it'.

Please advise how to fix my broken Nagios. I've been seeing some weird stuff lately. Might be related. I rebooted my server today, but the objects.cache is still not updating. :(

Grtz

Willem

Re: objects.cache showing wrong information? (Or not up to d

Posted: Thu Jun 04, 2015 9:46 am
by jdalrymple
If you do a full /etc/init.d/nagios restart then peek at nagios.log at the "relevant time" do you see anything alarming?

Code: Select all

[1433429092] ndomod: Shutdown complete.
[1433429092] Event broker module '/usr/local/nagios/bin/ndomod.o' deinitialized successfully.
[1433429093] Nagios 4.0.8 starting... (PID=104749)
[1433429093] Local time is Thu Jun 04 09:44:53 CDT 2015
[1433429093] LOG VERSION: 2.0
[1433429093] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized...

Re: objects.cache showing wrong information? (Or not up to d

Posted: Thu Jun 04, 2015 9:51 am
by WillemDH
Ok, forgive me... Just remembered I configured a ramdisk 13/04... I was catting the wrong objects.cache. :oops:

Code: Select all

cat /var/nagiosramdisk/objects.cache | sed -rn "/define host \{/{:a;N;/}/{/.host_name.srvreactor01/p;d};ba}"
define host {
        host_name       reactor01
        alias   reactor01
        address xx.xx.xx.xx
        check_period    xi_timeperiod_24x7
        check_command   check_xi_host_ping!3000.0!80%!5000.0!100%!!!!
        contacts        nagiosadmin,nagiosadmin
        contact_groups  xi_dig_dummy_contact_group
        notification_period     xi_timeperiod_24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      3
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   1440.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        icon_image      icon_linux_centos.png
        statusmap_image icon_linux_centos.png
        retain_status_information       1
        retain_nonstatus_information    1
        }
This one does contain the correct info... Please permanently delete this thread. :D

Re: objects.cache showing wrong information? (Or not up to d

Posted: Thu Jun 04, 2015 10:04 am
by ssax
I'm glad you got that sorted, marking as resolved and locking.