Page 1 of 1

log_service_retries and log_host_retries not working

Posted: Wed Nov 28, 2018 6:13 pm
by danzur
Hi all,

What version of Nagios XI are you using? - Nagios XI 5.5.1
Linux Distribution and version? - RHEL 7.3
32 or 64bit? - 64bit
VMware Image or Manual Install of XI? Manual Install of XI
We are using a proxy

My Nagios is integrated with ServiceNow using the standard connector of ServiceNow, I was receiving all the events in ServiceNow and due the operative of the support team, SOFT events are not useful for them so, they requested me to stop receive those events on ServiceNow. I modified the /usr/local/nagios/etc/nagios.cfg file and set the variables log_service_retries and log_host_restries equal to 0.

I tested and I am still sending the SOFT events to ServiceNow, ServiceNow is getting the information thru the API, this is the XGET executed by ServiceNow:

Code: Select all

http://servername/nagiosxi/api/v1/objects/statehistory?orderby=state_time:d&records=3000&apikey=*******&pretty=1
some of the reply can see below:

Code: Select all

{
    "recordcount": "69",
    "stateentry": [
        {
            "instance_id": "1",
            "state_time": "2018-11-28 23:50:11",
            "object_id": "884",
            "objecttype_id": "2",
            "host_name": "servername",
            "service_description": "check_uptime",
            "state_change": "1",
            "state": "0",
            "state_type": "1",
            "current_check_attempt": "1",
            "max_check_attempts": "4",
            "last_state": "2",
            "last_hard_state": "0",
            "output": "Uptime OK: 2 day(s) 4 hour(s) 25 minute(s)"
        },
        {
            "instance_id": "1",
            "state_time": "2018-11-28 23:24:28",
            "object_id": "884",
            "objecttype_id": "2",
            "host_name": "servername",
            "service_description": "check_uptime_10.141.191.7",
            "state_change": "1",
            "state": "2",
            "state_type": "1",
            "current_check_attempt": "4",
            "max_check_attempts": "4",
            "last_state": "2",
            "last_hard_state": "2",
            "output": "Uptime CRITICAL: 2 day(s) 3 hour(s) 59 minute(s)"
        },
        {
            "instance_id": "1",
            "state_time": "2018-11-28 23:23:30",
            "object_id": "884",
            "objecttype_id": "2",
            "host_name": "servername",
            "service_description": "check_uptime_10.141.191.7",
            "state_change": "1",
            "state": "2",
            "state_type": "0",
            "current_check_attempt": "3",
            "max_check_attempts": "4",
            "last_state": "2",
            "last_hard_state": "0",
            "output": "Uptime CRITICAL: 2 day(s) 3 hour(s) 58 minute(s)"
        },
        {
            "instance_id": "1",
            "state_time": "2018-11-28 23:22:37",
            "object_id": "884",
            "objecttype_id": "2",
            "host_name": "servername",
            "service_description": "check_uptime_10.141.191.7",
            "state_change": "1",
            "state": "2",
            "state_type": "0",
            "current_check_attempt": "2",
            "max_check_attempts": "4",
            "last_state": "2",
            "last_hard_state": "0",
            "output": "Uptime CRITICAL: 2 day(s) 3 hour(s) 57 minute(s)"
        },
        {
            "instance_id": "1",
            "state_time": "2018-11-28 23:21:37",
            "object_id": "884",
            "objecttype_id": "2",
            "host_name": "servername",
            "service_description": "check_uptime_10.141.191.7",
            "state_change": "1",
            "state": "2",
            "state_type": "0",
            "current_check_attempt": "1",
            "max_check_attempts": "4",
            "last_state": "0",
            "last_hard_state": "0",
            "output": "Uptime CRITICAL: 2 day(s) 3 hour(s) 56 minute(s)"
        },
As far as I understand from the file "last_hard_state": "0" means SOFT, and we can see there are 3 SOFT and then one HARD, that is how it is configured on the service check but I understand the SOFT alarms should not be logged becuase i configured log_service/host_retries=0

any help would be really appreciated, I am totally lost at this point.....

BR
Daniel

Re: log_service_retries and log_host_retries not working

Posted: Thu Nov 29, 2018 5:34 pm
by scottwilkerson
danzur wrote:As far as I understand from the file "last_hard_state": "0" means SOFT
that is incorrect, last_hard_state is what state was the service in the last time it was HARD, 0 = OK, 1 = WARNING, etc..

What you want to do is add the following to your API query, and it will ONLY get hard states

Code: Select all

&state_type=1