We are running our XI 5.5.7 on a Cent0s 6.10
I will like to use the "last_hard_state" in status.dat to manage a event handle.
As far as i understant the last_hard_state is what state was the service in the last time it was HARD.
If yes, please how can you explain the mismatch between the value in status.dat and the one in nagios.log.
For example:
servicestatus {
host_name=1287000200_00_datacore-01
service_description=Disk Usage
modified_attributes=0
check_command=snmp_filesystem_usage! -C $USER14$ --v2c -m ^[CDEFGHIJ] -q FixedDisk -w 80 -c 90!!!!!!!
check_period=24x7
notification_period=24x7
importance=0
check_interval=10.000000
retry_interval=4.000000
event_handler=
has_been_checked=1
should_be_scheduled=1
check_execution_time=1.524
check_latency=0.000
check_type=0
current_state=0
last_event_id=3272014last_hard_state=3
current_event_id=3272064
current_problem_id=0
last_problem_id=1485617
current_attempt=1
max_attempts=6
state_type=1
last_state_change=1543913360
last_hard_state_change=1543095656
last_time_ok=1543914197
last_time_warning=0
last_time_unknown=1543913360
last_time_critical=0
plugin_output=2 disk checked (<80%) : OK
long_plugin_output=
performance_data=
last_check=1543914197
next_check=1543914797
check_options=0
current_notification_number=0
current_notification_id=0
last_notification=0
next_notification=0
no_more_notifications=0
notifications_enabled=1
active_checks_enabled=1
passive_checks_enabled=1
event_handler_enabled=1
problem_has_been_acknowledged=0
acknowledgement_type=0
flap_detection_enabled=1
process_performance_data=1
obsess=1
last_update=1543914282
is_flapping=0
percent_state_change=0.00
scheduled_downtime_depth=0
_PRIORITY=0;P2
}
while in nagios.log:
[root@nagios-01: /usr/local/nagios/libexec]# grep 1287000200_00_datacore-01 ../var/nagios.log | egrep "Disk Usage|HOST" | perl -pe 's/(\d+)/localtime($1)/e'
[Tue Dec 4 00:00:00 2018] CURRENT HOST STATE: 1287000200_00_datacore-01;UP;HARD;1;OK - 10.2.26.18: rta 11.272ms, lost 0%
[Tue Dec 4 00:00:00 2018] CURRENT SERVICE STATE: 1287000200_00_datacore-01;Disk Usage;OK;HARD;1;2 disk checked (<80%) : OK
Thanks for your response