NagiosEnterprises / nagioscore

Nagios Core
GNU General Public License v2.0
1.58k stars 451 forks source link

Failed to connect to /usr/local/nagios/var/rw/livestatus: Connection refused at /usr/share/thruk/lib/Monitoring/Livestatus/UNIX.pm line 72 #956

Open kaushalshriyan opened 7 months ago

kaushalshriyan commented 7 months ago

I am running nagios version 4.5.1 (https://www.nagios.org/projects/nagios-core/4x/)

# rpm -qa | grep thruk
libthruk-3.00-0.x86_64
thruk-base-3.14.2-12970.1.x86_64
thruk-3.14.2-12970.1.x86_64
thruk-plugin-reporting-3.14.2-12970.1.x86_64
# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.9 (Ootpa)
#
# pwd
/usr/local/nagios/var/rw
# ls -l
total 0
srw-rw---- 1 nagios nagios 0 Apr 16 08:30 livestatus
prw-rw---- 1 nagios nagios 0 Apr 16 08:30 nagios.cmd
srw-rw---- 1 nagios nagios 0 Apr 16 08:30 nagios.qh
# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/livestatus
accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate
1;1;0;1;0;1;4;0.0321792;1;1;1;1;1;0;0;0;0;0;0;0;1;0.0107264;60;0;0;0;0;0;0;1;0;10;1.5.0p23;12;0.128717;0;10926;52;0.914182;1;1;0;0;0;1713236448;4.5.1;4;0.0321792;1;0.084375
#

event_broker_options=-1 broker_module=/opt/local/livestatus/livestatus.o /usr/local/nagios/var/rw/livestatus

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.5.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2024-02-28
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
#
# systemctl status nagios.service
● nagios.service - Nagios Core 4.5.1
   Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-04-16 08:30:48 IST; 2min 40s ago
     Docs: https://www.nagios.org/documentation
  Process: 10791 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 10924 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 10923 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 10926 (nagios)
    Tasks: 17 (limit: 48838)
   Memory: 7.0M
   CGroup: /system.slice/nagios.service
           ├─10926 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─10927 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─10928 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─10929 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─10930 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           └─10935 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Apr 16 08:30:49 niranjan nagios[10926]: livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: TIMEPERIOD TRANSITION: none;-1;0
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: starting main thread and 10 client threads
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: default stack size is 8388608
Apr 16 08:30:49 niranjan nagios[10926]: livestatus: setting thread stack size to 1048576
Apr 16 08:31:58 niranjan nagios[10926]: livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
Apr 16 08:32:58 niranjan nagios[10926]: livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
#

I am encountering the below issue whenever I restart

`491: failed to connect - failed to connect to /usr/local/nagios/var/rw/livestatus: Connection refused at /usr/share/thruk/lib/Monitoring/Livestatus/UNIX.pm line 72.              

    eval {...} called at /usr/share/thruk/lib/Monitoring/Livestatus/UNIX.pm line 64
    Monitoring::Livestatus::UNIX::_open(Monitoring::Livestatus::UNIX=HASH(0x55c2a9d93f70)) called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 971
    Monitoring::Livestatus::_open(Monitoring::Livestatus=HASH(0x55c2a92c7618)) called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 1143
    Monitoring::Livestatus::_send_socket_do(Monitoring::Livestatus=HASH(0x55c2a92c7618), "GET status\x{a}Columns: accept_passive_host_checks accept_passive_service_checks check_external_commands check_host_freshness check_service_freshness enable_event_handlers enable_flap_detection enable_notifications execute_host_checks execute_service_checks last_command_check last_log_rotation livestatus_version nagios_pid obsess_over_hosts obsess_over_services process_performance_data program_start program_version interval_length\x{a}OutputFormat: json\x{a}ResponseHeader: fixed16\x{a}") called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 1111
    eval {...} called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 1101
    Monitoring::Livestatus::_send_socket(Monitoring::Livestatus=HASH(0x55c2a92c7618), "GET status\x{a}Columns: accept_passive_host_checks accept_passive_service_checks check_external_commands check_host_freshness check_service_freshness enable_event_handlers enable_flap_detection enable_notifications execute_host_checks execute_service_checks last_command_check last_log_rotation livestatus_version nagios_pid obsess_over_hosts obsess_over_services process_performance_data program_start program_version interval_length\x{a}OutputFormat: json\x{a}ResponseHeader: fixed16\x{a}") called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 823
    Monitoring::Livestatus::_send(Monitoring::Livestatus=HASH(0x55c2a92c7618), "GET status\x{a}Columns: accept_passive_host_checks accept_passive_service_checks check_external_commands check_host_freshness check_service_freshness enable_event_handlers enable_flap_detection enable_notifications execute_host_checks execute_service_checks last_command_check last_log_rotation livestatus_version nagios_pid obsess_over_hosts obsess_over_services process_performance_data program_start program_version interval_length", HASH(0x55c2a9d70fb8)) called at /usr/share/thruk/lib/Monitoring/Livestatus.pm line 302
    Monitoring::Livestatus::selectall_arrayref(Monitoring::Livestatus=HASH(0x55c2a92c7618), "GET status\x{a}Columns: accept_passive_host_checks accept_passive_service_checks check_external_commands check_host_freshness check_service_freshness enable_event_handlers enable_flap_detection enable_notifications execute_host_checks execute_service_checks last_command_check last_log_rotation livestatus_version nagios_pid obsess_over_hosts obsess_over_services process_performance_data program_start program_version interval_length", HASH(0x55c2a8d08788)) called at /usr/share/thruk/lib/Monitoring/Livestatus/Class/Lite.pm line 420
    Monitoring::Livestatus::Class::Lite::_execute(Monitoring::Livestatus::Class::Lite=HASH(0x55c2a8f6ddc0)) called at /usr/share/thruk/lib/Monitoring/Livestatus/Class/Lite.pm line 278
    Monitoring::Livestatus::Class::Lite::hashref_array(Monitoring::Livestatus::Class::Lite=HASH(0x55c2a8f6ddc0)) called at /usr/share/thruk/lib/Monitoring/Livestatus/Class/Lite.pm line 259
    Monitoring::Livestatus::Class::Lite::hashref_pk(Monitoring::Livestatus::Class::Lite=HASH(0x55c2a8f6ddc0), "peer_key") called at /usr/share/thruk/lib/Thruk/Backend/Provider/Livestatus.pm line 304
    Thruk::Backend::Provider::Livestatus::get_processinfo(Thruk::Backend::Provider::Livestatus=HASH(0x55c2a8e717a0)) called at /etc/thruk/plugins//plugins-enabled/conf/lib/Thruk/Controller/conf.pm line 903
    eval {...} called at /etc/thruk/plugins//plugins-enabled/conf/lib/Thruk/Controller/conf.pm line 896`
# cat nagios.log
[1713237093] Nagios 4.5.1 starting... (PID=12405)
[1713237093] Local time is Tue Apr 16 08:41:33 IST 2024
[1713237093] LOG VERSION: 2.0
[1713237093] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1713237093] qh: core query handler registered
[1713237093] qh: echo service query handler registered
[1713237093] qh: help for the query handler registered
[1713237093] wproc: Successfully registered manager as @wproc with query handler
[1713237093] wproc: Registry request: name=Core Worker 12408;pid=12408
[1713237093] wproc: Registry request: name=Core Worker 12409;pid=12409
[1713237093] wproc: Registry request: name=Core Worker 12410;pid=12410
[1713237093] wproc: Registry request: name=Core Worker 12411;pid=12411
[1713237093] livestatus: fl_socket_path=[/usr/local/nagios/var/rw/livestatus], fl_mkeventd_socket_path=[/usr/local/nagios/var/rw/mkeventd/status]
[1713237093] livestatus: Livestatus by Mathias Kettner started with PID 12405
[1713237093] livestatus: version 1.5.0p23 compiled Tue, 09 Apr 2024 21:24:02 +0530 on niranjan
[1713237093] livestatus: built with g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), using C++11 regex engine
[1713237093] livestatus: Using socket at '/usr/local/nagios/var/rw/livestatus'
[1713237093] livestatus: Please visit us at http://mathias-kettner.de/
[1713237093] livestatus: Hint: Please try out OMD - the Open Monitoring Distribution
[1713237093] livestatus: Please visit OMD at http://omdistro.org
[1713237093] livestatus: removed old socket file /usr/local/nagios/var/rw/livestatus
[1713237093] livestatus: opened UNIX socket at /usr/local/nagios/var/rw/livestatus
[1713237093] livestatus: your event_broker_options are sufficient for livestatus..
[1713237093] livestatus: finished initialization, further log messages go to /usr/local/nagios/var/livestatus.log
[1713237093] Event broker module '/opt/local/livestatus/livestatus.o' initialized successfully.
[1713237094] Successfully launched command file worker with pid 12417
[1713237094] livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1
[1713237094] livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
[1713237094] livestatus: TIMEPERIOD TRANSITION: none;-1;0
[1713237094] livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
[1713237094] livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
[1713237094] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1713237094] livestatus: starting main thread and 10 client threads
[1713237094] livestatus: default stack size is 8388608
[1713237094] livestatus: setting thread stack size to 1048576
[1713237097] Caught SIGSEGV, shutting down...
[1713237097] Caught SIGTERM, shutting down...
#

Please guide me. Thanks in advance.

n5047c commented 7 months ago

Hello, kaushalshriyan. It's a livestatus bug. You need apply two patches to livestatus source code and rebuild it.

0003-livestatus_hostfilecolumn-1.5.0.patch.txt 0005-livestatus_customvarscolumn-1.5.0.patch.txt

kaushalshriyan commented 7 months ago

@n5047c Any steps to apply the above patch? Please guide. Thanks in advance.

cd /root/mk_livestatus-main pwd /root/mk_livestatus-main ls -l total 700 -rw-r--r-- 1 root root 26607 Apr 9 21:24 Makefile -rw-r--r-- 1 root root 1426 Mar 24 2022 Makefile.am -rw-r--r-- 1 root root 26470 Mar 24 2022 Makefile.in -rw-r--r-- 1 root root 370 Mar 24 2022 README -rw-r--r-- 1 root root 44247 Mar 24 2022 aclocal.m4 drwxr-xr-x 5 root root 43 Mar 24 2022 api -rwxr-xr-x 1 root root 5826 Mar 24 2022 ar-lib -rwxr-xr-x 1 root root 7333 Mar 24 2022 compile -rwxr-xr-x 1 root root 44283 Mar 24 2022 config.guess -rw-r--r-- 1 root root 6871 Apr 9 21:24 config.h -rw-r--r-- 1 root root 6329 Mar 24 2022 config.h.in -rw-r--r-- 1 root root 67727 Apr 9 21:24 config.log -rwxr-xr-x 1 root root 34884 Apr 9 21:24 config.status -rwxr-xr-x 1 root root 36136 Mar 24 2022 config.sub -rwxr-xr-x 1 root root 288045 Mar 24 2022 configure -rw-r--r-- 1 root root 9496 Mar 24 2022 configure.ac -rwxr-xr-x 1 root root 23567 Mar 24 2022 depcomp -rwxr-xr-x 1 root root 15155 Mar 24 2022 install-sh drwxr-xr-x 2 root root 86 Mar 24 2022 m4 -rwxr-xr-x 1 root root 6872 Mar 24 2022 missing drwxr-xr-x 2 root root 4096 Mar 24 2022 nagios drwxr-xr-x 2 root root 4096 Mar 24 2022 nagios4 drwxr-xr-x 3 root root 16384 Apr 9 21:27 src -rw-r--r-- 1 root root 23 Apr 9 21:24 stamp-h1 drwxr-xr-x 2 root root 29 Mar 24 2022 standalone

n5047c commented 7 months ago

Hi, @kaushalshriyan.

  1. Copy patches to livestatus source tree: cp 000*-1.5.0.patch.txt /root/mk_livestatus-main
  2. Apply: cd /root/mk_livestatus-main; patch -p1 < 0003-livestatus_hostfilecolumn-1.5.0.patch.txt; patch -p1 < 0005-livestatus_customvarscolumn-1.5.0.patch.txt
  3. Build livestatus: make clean; make; make install
kaushalshriyan commented 7 months ago

@n5047c It is still not working.

patch -p1 < 0003-livestatus_hostfilecolumn-1.5.0.patch patching file src/HostFileColumn.cc

patch -p1 < 0005-livestatus_customvarscolumn-1.5.0.patch patching file src/CustomVarsDictColumn.cc patching file src/CustomVarsValuesColumn.cc

/root/mk_livestatus-main

I have attached the livestatuspatch.log for your reference.

livestatuspatch.log

kaushalshriyan commented 7 months ago

@n5047c I am attaching further screenshot for your reference. Please guide me further.

Screenshot 2024-04-26 at 10 34 39 PM Screenshot 2024-04-26 at 10 35 22 PM Screenshot 2024-04-26 at 10 37 08 PM
kaushalshriyan commented 7 months ago

ls -l /opt/local/livestatus/livestatus.o -rwxr-xr-x 1 nagios nagios 60695560 Apr 26 22:30 /opt/local/livestatus/livestatus.o

cat /usr/local/nagios/etc/nagios.cfg event_broker_options=-1 broker_module=/opt/local/livestatus/livestatus.o /usr/local/nagios/var/rw/livestatus

n5047c commented 7 months ago

Hi, @kaushalshriyan.

-rwxr-xr-x 1 nagios nagios 60695560 Apr 26 22:30 /opt/local/livestatus/livestatus.o Is you rebulded patched livestatus? Could you attach new nagios.log?

kaushalshriyan commented 7 months ago

@n5047c Yes

patch -p1 < 0003-livestatus_hostfilecolumn-1.5.0.patch patching file src/HostFileColumn.cc

patch -p1 < 0005-livestatus_customvarscolumn-1.5.0.patch patching file src/CustomVarsDictColumn.cc patching file src/CustomVarsValuesColumn.cc

I am attaching both nagios.log and livestatus.log for your reference.

livestatus.log nagios.log

kaushalshriyan commented 7 months ago

ls -l /usr/local/nagios/var/rw/livestatus srw-rw---- 1 nagios nagios 0 Apr 27 22:36 /usr/local/nagios/var/rw/livestatus

I am attaching both rebuildpatch.txt,nagios.log and livestatus.log for your reference.

rebuildpatch.txt

livestatus.log

nagios.log

kaushalshriyan commented 7 months ago

@n5047c I'm checking in again if you need any other details. Thanks in advance, and I look forward to hearing from you.

n5047c commented 6 months ago

Hi, @kaushalshriyan. Last error in your logs is "Permission denied". Could you get "GET status" manualy after start nagios and after restart nagios? Could you show permissons of "/usr/local/nagios/var/rw/livestatus"?

kaushalshriyan commented 6 months ago

@n5047c I have attached the log file and screenshot for your reference mentioning all the details of the issue. Please let me know if you need any other details. Thanks in advance and I look forward to hearing from you.

nagios.log

Screenshot 2024-05-03 at 8 19 41 AM Screenshot 2024-05-03 at 8 20 09 AM Screenshot 2024-05-03 at 8 20 22 AM
kaushalshriyan commented 6 months ago

@sawolf @n5047c I have installed the latest version 4.5.2 (https://www.nagios.org/downloads/nagios-core/thanks/). The issue still persists. Please let me know if you need any other details. Thanks in advance and I look forward to hearing from you.

#vim /usr/local/nagios/etc/nagios.cfg
event_broker_options=-1
broker_module=/opt/local/livestatus/livestatus.o /usr/local/nagios/var/rw/livestatus
[1714787845] Nagios 4.5.2 starting... (PID=301267)
[1714787845] Local time is Sat May 04 07:27:25 IST 2024
[1714787845] LOG VERSION: 2.0
[1714787845] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1714787845] qh: core query handler registered
[1714787845] qh: echo service query handler registered
[1714787845] qh: help for the query handler registered
[1714787845] wproc: Successfully registered manager as @wproc with query handler
[1714787845] wproc: Registry request: name=Core Worker 301270;pid=301270
[1714787845] wproc: Registry request: name=Core Worker 301268;pid=301268
[1714787845] wproc: Registry request: name=Core Worker 301269;pid=301269
[1714787845] wproc: Registry request: name=Core Worker 301271;pid=301271
[1714787845] livestatus: fl_socket_path=[/usr/local/nagios/var/rw/livestatus], fl_mkeventd_socket_path=[/usr/local/nagios/var/rw/mkeventd/status]
[1714787845] livestatus: Livestatus by Mathias Kettner started with PID 301267
[1714787845] livestatus: version 1.5.0p23 compiled Sat, 27 Apr 2024 22:30:23 +0530 on nagioscb
[1714787845] livestatus: built with g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), using C++11 regex engine
[1714787845] livestatus: Using socket at '/usr/local/nagios/var/rw/livestatus'
[1714787845] livestatus: Please visit us at http://mathias-kettner.de/
[1714787845] livestatus: Hint: Please try out OMD - the Open Monitoring Distribution
[1714787845] livestatus: Please visit OMD at http://omdistro.org
[1714787845] livestatus: removed old socket file /usr/local/nagios/var/rw/livestatus
[1714787845] livestatus: opened UNIX socket at /usr/local/nagios/var/rw/livestatus
[1714787845] livestatus: your event_broker_options are sufficient for livestatus..
[1714787845] livestatus: finished initialization, further log messages go to /usr/local/nagios/var/livestatus.log
[1714787845] Event broker module '/opt/local/livestatus/livestatus.o' initialized successfully.
[1714787845] Successfully launched command file worker with pid 301272
[1714787845] livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1
[1714787845] livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
[1714787845] livestatus: TIMEPERIOD TRANSITION: none;-1;0
[1714787845] livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
[1714787845] livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
[1714787845] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1714787845] livestatus: starting main thread and 10 client threads
[1714787845] livestatus: default stack size is 8388608
[1714787845] livestatus: setting thread stack size to 1048576
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.5.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2024-04-30
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
#
# pwd
/usr/local/nagios
# ls -l
total 12
drwxrwxr-x  2 nagios nagios   38 May  4 07:12 bin
drwxrwxr-x  3 nagios nagios   96 May  4 07:18 etc
drwxrwxr-x  2 nagios nagios 4096 May  4 07:16 libexec
drwxrwxr-x  2 nagios nagios 4096 May  4 07:12 sbin
drwxrwxr-x 15 nagios nagios 4096 May  4 07:16 share
drwxrwxr-x  5 nagios nagios  145 May  4 07:29 var
#cd var/
#pwd 
#/usr/local/nagios/var
# ls -l
total 52
drwxrwxr-x 2 nagios nagios     6 May  4 07:12 archives
-rw-r--r-- 1 nagios nagios     0 May  4 07:27 livestatus.log
-rw-r--r-- 1 nagios nagios  2914 May  4 07:29 nagios.log
-rw-r--r-- 1 nagios nagios 12755 May  4 07:27 objects.cache
-rw------- 1 nagios nagios 13119 May  4 07:21 retention.dat
drwxrwsr-x 2 nagios nagcmd    41 May  4 07:29 rw
drwxr-xr-x 3 nagios nagios    26 May  4 07:12 spool
-rw-rw-r-- 1 nagios nagios 13634 May  4 07:29 status.dat
# ls -l rw/
total 0
srw-rw---- 1 nagios nagcmd 0 May  4 07:27 livestatus
srw-rw---- 1 nagios nagcmd 0 May  4 07:27 nagios.qh
# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.9 (Ootpa)
#
# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/livestatus
Couldn't connect to UNIX-socket at /usr/local/nagios/var/rw/livestatus: Connection refused
# systemctl restart nagios.service httpd.service && systemctl status nagios.service httpd.service
● nagios.service - Nagios Core 4.5.2
   Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2024-05-04 07:43:54 IST; 1s ago
     Docs: https://www.nagios.org/documentation
  Process: 301610 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 299830 ExecStop=/usr/bin/kill -s TERM ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 303519 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 303517 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 303520 (nagios)
    Tasks: 19 (limit: 35936)
   Memory: 6.4M
   CGroup: /system.slice/nagios.service
           ├─303520 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─303521 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─303522 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─303523 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─303524 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─303525 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─303537 /usr/local/nagios/libexec/check_ping -H 127.0.0.1 -w 3000.0,80% -c 5000.0,100% -p 5
           └─303538 /usr/sbin/ping -n -U -w 30 -c 5 127.0.0.1

May 04 07:43:54 nagioscb nagios[303520]: Successfully launched command file worker with pid 303525
May 04 07:43:54 nagioscb nagios[303520]: livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1
May 04 07:43:54 nagioscb nagios[303520]: livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
May 04 07:43:54 nagioscb nagios[303520]: livestatus: TIMEPERIOD TRANSITION: none;-1;0
May 04 07:43:54 nagioscb nagios[303520]: livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
May 04 07:43:54 nagioscb nagios[303520]: livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
May 04 07:43:54 nagioscb nagios[303520]: livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
May 04 07:43:54 nagioscb nagios[303520]: livestatus: starting main thread and 10 client threads
May 04 07:43:54 nagioscb nagios[303520]: livestatus: default stack size is 8388608
May 04 07:43:54 nagioscb nagios[303520]: livestatus: setting thread stack size to 1048576

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Sat 2024-05-04 07:43:56 IST; 29ms ago
     Docs: man:httpd.service(8)
 Main PID: 303542 (httpd)
   Status: "Configuration loaded."
    Tasks: 1 (limit: 35936)
   Memory: 3.1M
   CGroup: /system.slice/httpd.service
           └─303542 /usr/sbin/httpd -DFOREGROUND

May 04 07:43:56 nagioscb systemd[1]: httpd.service: Succeeded.
# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/livestatus
accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate
1;1;0;1;0;1;1;0;1;1;1;1;1;0;0;0;0;0;0;0;0;0;60;0;0;0;0;0;0;1;0;10;1.5.0p23;12;0;0;303520;17;0;1;1;0;0;0;1714788834;4.5.2;1;0;0;0
#
Screenshot 2024-05-04 at 7 45 41 AM Screenshot 2024-05-04 at 7 48 02 AM
# cat nagios.log
[1714787845] Nagios 4.5.2 starting... (PID=301267)
[1714787845] Local time is Sat May 04 07:27:25 IST 2024
[1714787845] LOG VERSION: 2.0
[1714787845] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1714787845] qh: core query handler registered
[1714787845] qh: echo service query handler registered
[1714787845] qh: help for the query handler registered
[1714787845] wproc: Successfully registered manager as @wproc with query handler
[1714787845] wproc: Registry request: name=Core Worker 301270;pid=301270
[1714787845] wproc: Registry request: name=Core Worker 301268;pid=301268
[1714787845] wproc: Registry request: name=Core Worker 301269;pid=301269
[1714787845] wproc: Registry request: name=Core Worker 301271;pid=301271
[1714787845] livestatus: fl_socket_path=[/usr/local/nagios/var/rw/livestatus], fl_mkeventd_socket_path=[/usr/local/nagios/var/rw/mkeventd/status]
[1714787845] livestatus: Livestatus by Mathias Kettner started with PID 301267
[1714787845] livestatus: version 1.5.0p23 compiled Sat, 27 Apr 2024 22:30:23 +0530 on nagioscb
[1714787845] livestatus: built with g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), using C++11 regex engine
[1714787845] livestatus: Using socket at '/usr/local/nagios/var/rw/livestatus'
[1714787845] livestatus: Please visit us at http://mathias-kettner.de/
[1714787845] livestatus: Hint: Please try out OMD - the Open Monitoring Distribution
[1714787845] livestatus: Please visit OMD at http://omdistro.org
[1714787845] livestatus: removed old socket file /usr/local/nagios/var/rw/livestatus
[1714787845] livestatus: opened UNIX socket at /usr/local/nagios/var/rw/livestatus
[1714787845] livestatus: your event_broker_options are sufficient for livestatus..
[1714787845] livestatus: finished initialization, further log messages go to /usr/local/nagios/var/livestatus.log
[1714787845] Event broker module '/opt/local/livestatus/livestatus.o' initialized successfully.
[1714787845] Successfully launched command file worker with pid 301272
[1714787845] livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1
[1714787845] livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
[1714787845] livestatus: TIMEPERIOD TRANSITION: none;-1;0
[1714787845] livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
[1714787845] livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
[1714787845] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1714787845] livestatus: starting main thread and 10 client threads
[1714787845] livestatus: default stack size is 8388608
[1714787845] livestatus: setting thread stack size to 1048576
[1714787879] SERVICE ALERT: localhost;HTTP;WARNING;HARD;4;HTTP WARNING: HTTP/1.1 403 Forbidden - 5233 bytes in 0.002 second response time
[1714787915] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1714787963] Caught SIGSEGV, shutting down...
[1714787963] Caught SIGTERM, shutting down...
[1714788834] Nagios 4.5.2 starting... (PID=303520)
[1714788834] Local time is Sat May 04 07:43:54 IST 2024
[1714788834] LOG VERSION: 2.0
[1714788834] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1714788834] qh: core query handler registered
[1714788834] qh: echo service query handler registered
[1714788834] qh: help for the query handler registered
[1714788834] wproc: Successfully registered manager as @wproc with query handler
[1714788834] wproc: Registry request: name=Core Worker 303521;pid=303521
[1714788834] wproc: Registry request: name=Core Worker 303522;pid=303522
[1714788834] wproc: Registry request: name=Core Worker 303524;pid=303524
[1714788834] wproc: Registry request: name=Core Worker 303523;pid=303523
[1714788834] livestatus: fl_socket_path=[/usr/local/nagios/var/rw/livestatus], fl_mkeventd_socket_path=[/usr/local/nagios/var/rw/mkeventd/status]
[1714788834] livestatus: Livestatus by Mathias Kettner started with PID 303520
[1714788834] livestatus: version 1.5.0p23 compiled Sat, 27 Apr 2024 22:30:23 +0530 on nagioscb
[1714788834] livestatus: built with g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), using C++11 regex engine
[1714788834] livestatus: Using socket at '/usr/local/nagios/var/rw/livestatus'
[1714788834] livestatus: Please visit us at http://mathias-kettner.de/
[1714788834] livestatus: Hint: Please try out OMD - the Open Monitoring Distribution
[1714788834] livestatus: Please visit OMD at http://omdistro.org
[1714788834] livestatus: removed old socket file /usr/local/nagios/var/rw/livestatus
[1714788834] livestatus: opened UNIX socket at /usr/local/nagios/var/rw/livestatus
[1714788834] livestatus: your event_broker_options are sufficient for livestatus..
[1714788834] livestatus: finished initialization, further log messages go to /usr/local/nagios/var/livestatus.log
[1714788834] Event broker module '/opt/local/livestatus/livestatus.o' initialized successfully.
[1714788834] Successfully launched command file worker with pid 303525
[1714788834] livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1
[1714788834] livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
[1714788834] livestatus: TIMEPERIOD TRANSITION: none;-1;0
[1714788834] livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0
[1714788834] livestatus: TIMEPERIOD TRANSITION: workhours;-1;0
[1714788834] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1714788834] livestatus: starting main thread and 10 client threads
[1714788834] livestatus: default stack size is 8388608
[1714788834] livestatus: setting thread stack size to 1048576
[1714788856] SERVICE ALERT: localhost;HTTP;WARNING;HARD;4;HTTP WARNING: HTTP/1.1 403 Forbidden - 5233 bytes in 0.002 second response time
[1714788904] livestatus: Timeperiod cache not updated, there are no timeperiods (yet)
[1714788922] Caught SIGSEGV, shutting down...
[1714788922] Caught SIGTERM, shutting down...
#
kaushalshriyan commented 6 months ago

@n5047c Can you please point me to the livestatus github repo wherein i can compile and create a fresh livestatus.o file which is compatible with Nagios core 4.5.x version?

kaushalshriyan commented 6 months ago

@n5047c @sawolf I have used https://github.com/Checkmk/checkmk/tree/1.2.8 to configure livestatus using Nagios core 4.5.2. Initially it works while configuring livestatus. Next when i click on hosts link or any other link in thruk webinterface, it crashes. I have attached the screenshot for the reference. Please let me know if you need any other details. Thanks in advance and I look forward to hearing from you.

# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/livestatus
accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate
1;1;0;1;0;1;5;1.6875000000e-01;1;1;1;1;1;-674217344;-674217344;-674217344;0;0.0000000000e+00;0;0.0000000000e+00;1;8.4375000000e-02;60;-674217344;0;0;0.0000000000e+00;0;0.0000000000e+00;1;0;10;1.2.8p28;0;0.0000000000e+00;0;378497;17;8.9062500000e-01;1;1;0;0;0;1714880853;4.5.2;4;4.5000000000e-01;0;0.0000000000e+00
#
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.5.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2024-04-30
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
#
[1714880853] Nagios 4.5.2 starting... (PID=378497)
[1714880853] Local time is Sun May 05 09:17:33 IST 2024
[1714880853] LOG VERSION: 2.0
[1714880853] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1714880853] qh: core query handler registered
[1714880853] qh: echo service query handler registered
[1714880853] qh: help for the query handler registered
[1714880853] wproc: Successfully registered manager as @wproc with query handler
[1714880853] wproc: Registry request: name=Core Worker 378498;pid=378498
[1714880853] wproc: Registry request: name=Core Worker 378500;pid=378500
[1714880853] wproc: Registry request: name=Core Worker 378499;pid=378499
[1714880853] wproc: Registry request: name=Core Worker 378501;pid=378501
[1714880853] livestatus: Livestatus 1.2.8p28 by Mathias Kettner. Socket: '/usr/local/nagios/var/rw/livestatus'
[1714880853] livestatus: Please visit us at http://mathias-kettner.de/
[1714880853] livestatus: Hint: please try out OMD - the Open Monitoring Distribution
[1714880853] livestatus: Please visit OMD at http://omdistro.org
[1714880853] livestatus: Removed old left over socket file /usr/local/nagios/var/rw/livestatus
[1714880853] livestatus: Finished initialization. Further log messages go to /usr/local/nagios/var/livestatus.log
[1714880853] Event broker module '/opt/local/livestatus/livestatus.o' initialized successfully.
[1714880853] Successfully launched command file worker with pid 378502
[1714880853] TIMEPERIOD TRANSITION: 24x7;-1;1
[1714880853] TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1
[1714880853] TIMEPERIOD TRANSITION: none;-1;0
[1714880853] TIMEPERIOD TRANSITION: us-holidays;-1;0
[1714880853] TIMEPERIOD TRANSITION: workhours;-1;0
[1714880891] SERVICE ALERT: localhost;HTTP;WARNING;HARD;4;HTTP WARNING: HTTP/1.1 403 Forbidden - 5233 bytes in 0.001 second response time
[1714880934] Caught SIGSEGV, shutting down...
[1714880934] Caught SIGTERM, shutting down...
# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/livestatus
Couldn't connect to UNIX-socket at /usr/local/nagios/var/rw/livestatus: Connection refused.
#
Screenshot 2024-05-05 at 9 17 45 AM Screenshot 2024-05-05 at 9 18 50 AM Screenshot 2024-05-05 at 9 19 44 AM
tfmotu commented 6 months ago

Hi, same problem here with: nagios 4.5.2, and livestatus from --> check-mk-raw-1.6.0p30

echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/live Couldn't connect to UNIX-socket at /usr/local/nagios/var/rw/live: Connection refused

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Nagios Core 4.5.2 Copyright (c) 2009-present Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 2024-04-30 License: GPL ... hecking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check

With nagios 4.4.14 all work fine:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.4.14 Copyright (c) 2009-present Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 2023-08-01 License: GPL ... Checking misc settings... Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check

systemctl start nagios

echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/live accept_passive_host_checks;accept_passive_service_checks;average_latency_cmk;average_latency_generic;average_latency_real_time;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;core_pid;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;has_event_handlers;helper_usage_cmk;helper_usage_generic;helper_usage_real_time;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livechecks;livechecks_rate;livestatus_active_connections;livestatus_overflows;livestatus_overflows_rate;livestatus_queued_connections;livestatus_threads;livestatus_usage;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_queued_alerts;num_queued_notifications;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate 1;1;0;xxxxx

Thanks in advance!

n5047c commented 6 months ago

Hi all. In production I use nagioscore 4.4.11 and livestatus 1.4.0p38. My test environment:

service nagios start service nagios status Redirecting to /bin/systemctl status nagios.service ● nagios.service - Nagios Core 4.5.2 Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2024-05-07 13:53:56 MSK; 35s ago Docs: https://www.nagios.org/documentation Process: 4255 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS) Process: 4254 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS) Main PID: 4256 (nagios) CGroup: /docker/c4ba675ab54fc16a05266006d7538088504dc05b1d0b40fb934060392c32de57/system.slice/nagios.service ├─4256 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg ├─4257 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4258 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4259 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4260 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4261 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4262 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4263 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4264 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4265 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4266 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4267 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4268 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4269 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4270 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4271 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4272 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4273 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh ├─4274 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh └─4275 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checked 0 service dependencies May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checked 0 host dependencies May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checked 5 timeperiods May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checking global event handlers... May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checking obsessive compulsive processor commands... May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Checking misc settings... May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Total Warnings: 0 May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Total Errors: 0 May 07 13:53:56 modmon-2024-03-31-centos7 nagios[4254]: Things look okay - No serious problems were detected during the pre-flight check May 07 13:53:56 modmon-2024-03-31-centos7 systemd[1]: Started Nagios Core 4.5.2.

echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/live accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate 1;1;0;1;0;1;1;0;1;1;1;1;1;0;0;0;0;0;0;0;0;0;60;0;0;0;0;0;0;1;0;80;1.5.0p25;15;0.0185134;0;4256;123;1.05251;0;0;0;0;1;1715079236;4.5.2;1;0;0;0

service nagios restart Redirecting to /bin/systemctl restart nagios.service

echo "GET status" | /usr/local/bin/unixcat /usr/local/nagios/var/rw/live accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate 1;1;0;1;0;1;1;0;1;1;1;1;1;0;0;0;0;0;0;0;0;0;60;0;0;0;0;0;0;1;0;80;1.5.0p25;14;0.280316;0;4392;62;1.30028;0;0;0;0;1;1715079455;4.5.2;1;0;0;0

cat nagios.log ... [1715079454] Caught SIGTERM, shutting down... [1715079454] Caught SIGTERM, shutting down... [1715079454] Caught SIGTERM, shutting down... [1715079454] Successfully shutdown... (PID=4256) [1715079454] livestatus: deinitializing [1715079454] livestatus: waiting for main to terminate... [1715079455] livestatus: waiting for client threads to terminate... [1715079455] livestatus: could not join thread main [1715079455] livestatus: main thread + 80 client threads have finished [1715079455] Event broker module '/usr/local/nagios/lib/livestatus.so' deinitialized successfully. [1715079455] Nagios 4.5.2 starting... (PID=4392) [1715079455] Local time is Tue May 07 13:57:35 MSK 2024 [1715079455] LOG VERSION: 2.0 [1715079455] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized [1715079455] qh: core query handler registered [1715079455] qh: echo service query handler registered [1715079455] qh: help for the query handler registered [1715079455] wproc: Successfully registered manager as @wproc with query handler [1715079455] wproc: Registry request: name=Core Worker 4393;pid=4393 [1715079455] wproc: Registry request: name=Core Worker 4396;pid=4396 [1715079455] wproc: Registry request: name=Core Worker 4397;pid=4397 [1715079455] wproc: Registry request: name=Core Worker 4395;pid=4395 [1715079455] wproc: Registry request: name=Core Worker 4394;pid=4394 [1715079455] wproc: Registry request: name=Core Worker 4399;pid=4399 [1715079455] wproc: Registry request: name=Core Worker 4398;pid=4398 [1715079455] wproc: Registry request: name=Core Worker 4401;pid=4401 [1715079455] wproc: Registry request: name=Core Worker 4400;pid=4400 [1715079455] wproc: Registry request: name=Core Worker 4404;pid=4404 [1715079455] wproc: Registry request: name=Core Worker 4402;pid=4402 [1715079455] wproc: Registry request: name=Core Worker 4403;pid=4403 [1715079455] wproc: Registry request: name=Core Worker 4406;pid=4406 [1715079455] wproc: Registry request: name=Core Worker 4405;pid=4405 [1715079455] wproc: Registry request: name=Core Worker 4408;pid=4408 [1715079455] wproc: Registry request: name=Core Worker 4409;pid=4409 [1715079455] wproc: Registry request: name=Core Worker 4407;pid=4407 [1715079455] wproc: Registry request: name=Core Worker 4410;pid=4410 [1715079455] livestatus: setting idle timeout to 3000 ms [1715079455] livestatus: setting number of client threads to 80 [1715079455] livestatus: setting size of thread stacks to 131072 [1715079455] livestatus: fl_socket_path=[/usr/local/nagios/var/rw/live], fl_mkeventd_socket_path=[/usr/local/nagios/var/rw/mkeventd/status] [1715079455] livestatus: Livestatus by Mathias Kettner started with PID 4392 [1715079455] livestatus: version 1.5.0p25 compiled Thu, 18 Apr 2024 17:23:54 +0300 on modmon-2024-03-31-centos7 [1715079455] livestatus: built with c++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5), using C++11 regex engine [1715079455] livestatus: Using socket at '/usr/local/nagios/var/rw/live' [1715079455] livestatus: Please visit us at http://mathias-kettner.de/ [1715079455] livestatus: Hint: Please try out OMD - the Open Monitoring Distribution [1715079455] livestatus: Please visit OMD at http://omdistro.org [1715079455] livestatus: opened UNIX socket at /usr/local/nagios/var/rw/live [1715079455] livestatus: your event_broker_options are sufficient for livestatus.. [1715079455] livestatus: environment_macros are enabled, this might decrease the overall nagios performance [1715079455] livestatus: finished initialization, further log messages go to /usr/local/nagios/var/livestatus.log [1715079455] Event broker module '/usr/local/nagios/lib/livestatus.so' initialized successfully. [1715079455] Successfully launched command file worker with pid 4411 [1715079455] livestatus: TIMEPERIOD TRANSITION: 24x7;-1;1 [1715079455] livestatus: TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1 [1715079455] livestatus: TIMEPERIOD TRANSITION: none;-1;0 [1715079455] livestatus: TIMEPERIOD TRANSITION: us-holidays;-1;0 [1715079455] livestatus: TIMEPERIOD TRANSITION: workhours;-1;1 [1715079455] livestatus: Timeperiod cache not updated, there are no timeperiods (yet) [1715079455] livestatus: starting main thread and 80 client threads [1715079455] livestatus: default stack size is 8388608 [1715079455] livestatus: setting thread stack size to 131072

sistemmsn commented 4 weeks ago

@kaushalshriyan i recommend that you look for another alternative because since version 4.5.X the third-party integrations have failed and what was used to connect nagvis and nagios was through livestatus, well that is over, I am using naemon in its version 1.4.2 in docker, I have it integrated with grafana, nagvis, pnp4nagios oh with nagflux

tsadpbb commented 2 weeks ago

The header files were changed to add support for event handler periods. As a result, host and service object files are different sizes, so you need to get the new header files and compile livestatus with those.

This forum post has good information on how to do this https://support.nagios.com/forum/viewtopic.php?p=356902&sid=ac8dfb52143dac2b08e4e2dac9a93afd#p356902

Copying message below:

cd /tmp
export NAGVER=4.5.2
wget [https://assets.nagios.com/downloads/nag ... ER}.tar.gz](https://assets.nagios.com/downloads/nagioscore/releases/nagios-$%7BNAGVER%7D.tar.gz)
tar -xf nagios-${NAGVER}.tar.gz
cd nagios-${NAGVER}
./configure ...
make
cd /tmp
git clone https://github.com/Expensify/mk_livestatus mk_livestatus_150p23
cd mk_livestatus_150p23
# patching livestatus
# [https://github.com/NagiosEnterprises/na ... issues/956](https://github.com/NagiosEnterprises/nagioscore/issues/956)
wget [https://github.com/NagiosEnterprises/na ... .patch.txt](https://github.com/NagiosEnterprises/nagioscore/files/15026861/0003-livestatus_hostfilecolumn-1.5.0.patch.txt)
wget [https://github.com/NagiosEnterprises/na ... .patch.txt](https://github.com/NagiosEnterprises/nagioscore/files/15026862/0005-livestatus_customvarscolumn-1.5.0.patch.txt)
patch -p1 < 0003-livestatus_hostfilecolumn-1.5.0.patch.txt
patch -p1 < 0005-livestatus_customvarscolumn-1.5.0.patch.txt
# copy include and lib files from compiled nagios
rm -rf nagios4
cp -r /tmp/nagios-4.5.2/include nagios4
cp -r /tmp/nagios-4.5.2/lib lib
autoreconf -f -i
# Install Packages
dnf install rrdtool-devel boost-devel gcc-c++ libstdc++-static
./configure --prefix=/opt/nagios/mk-livestatus/1.5.0p23 --with-nagios4
make
make install
vi /PATH/TO/nagios.cfg
8<---
broker_module=/opt/nagios/mk-livestatus/1.5.0p23/lib/mk-livestatus/livestatus.o /opt/nagios-mk-livestatus/live
8<---