Page 1 of 2

Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Tue Jan 25, 2022 11:09 am
by QPUSER
Hi All,

I am new to Nagios and need your help to integrate Nagios tool with with SummitAI (ITSM) tool using API based approach.
Need below information.

1) Does Nagios has APIs that can be exposed and same can be utilized by 3rd party to pull the Alert information from Nagios Tool?
2) Is Nagios capable enough to consume 3rd party APIs and push the alert data into 3rd party tool i.e. incident form?

Any document around the same will be very helpful.

Thank you.

Warm regards,
Prabhat

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Wed Jan 26, 2022 3:22 pm
by ssax
Hello!

1) Yes, see the Help section at the top menu, then view the API Docs section on the top left for working examples.

See the XI API Objects Reference section, you would likely want to use the objects/logentries or objects/statehistory for alerts.

2) Yes, you would need to write an event handler to do it. See here:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

OR through Admin > Manage Components > Global Event Handlers:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Let us know if you have any further questions.

Thank you!

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Thu Jan 27, 2022 1:34 am
by QPUSER
Hi SSAX,

Thanks a lot for responding.
I will check and will keep posted the updated here.

rg/
PSP

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Thu Jan 27, 2022 5:25 pm
by ssax
No problem, we'll keep an eye out for any updates.

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Tue Feb 22, 2022 6:14 am
by QPUSER
Hi SSAX,

I have API which cab be consumed to create INIDENT in SummitAI tool. I have tested the same API using postman tool and it's working as expected.
Could you please assist to utilized the same code in Global event handler?

I did refer to https://assets.nagios.com/downloads/nag ... eproblemid for filed mapping.

Thank in advance for help.

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Wed Feb 23, 2022 2:37 am
by QPUSER
Hi SSAX,

We are able to create a ticket using event handler. however, ticket is getting created for host down and host up. Seems ticket is getting created as soon as alert state changes and resulting in duplicate tickets for host down and up. We need to have ticket created only if incase host is down / Service is down. We don't need ticket for host up / service up. which is ideally not required and not right. request your help here.

Also we need to pass alert information in a such way that in description it should appear Host name and current state of host. Please check below syntax and help me to pass required information.
"Description": "%Status information% HOST : $HOSTNAME$",

Thanks
QP

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Wed Feb 23, 2022 11:12 am
by ssax
See the When Are Event Handlers Executed? section AND the script at the bottom of this page here:

https://assets.nagios.com/downloads/nag ... dlers.html

Read the comments in that code but see below for a cleaner example of what you need to do in this case (detect hard/soft states/etc):

Code: Select all

#!/bin/sh

case "$1" in
OK)
    # Is this a "soft" or a "hard" state?
    case "$2" in

    # We're in a "soft" state, meaning that Nagios is in the middle of retrying the
    # check before it turns into a "hard" state and contacts get notified...
    SOFT)
        # Do nothing here because it's a SOFT state
        ;;

    HARD)
        # This is where you want to put your code for a HARD OK state action (aka HARD recovery)
        ;;
    esac
    ;;
WARNING)
    # Not used in this example
    ;;
UNKNOWN)
    # We don't know what might be causing an unknown error, so don't do anything...
    ;;
CRITICAL)
    # Is this a "soft" or a "hard" state?
    case "$2" in

    # We're in a "soft" state, meaning that Nagios is in the middle of retrying the
    # check before it turns into a "hard" state and contacts get notified...
    SOFT)
        # Do nothing here because it's a SOFT state
        ;;

    HARD)
        # This is where you want to put your code for a HARD CRITICAL state action (at this point we know it's a real issue)
        ;;
    esac
    ;;
esac
exit 0

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Thu Feb 24, 2022 1:05 am
by QPUSER
Hi SSAX,

Now, Integration is working as expected. I did necessary changes in code.
Facing problem to log current utilization value of CPU/Memory/Disk usage in INC. Do we have any system defined MACRO name which host this value? If yes, pls help me with Name.

Thanks
QP

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Thu Feb 24, 2022 7:09 pm
by ssax
Awesome, that's great to hear, I'm glad that helped!

Please be more specific on what exactly you mean by this and what you mean by INC:
Facing problem to log current utilization value of CPU/Memory/Disk usage in INC

Re: Nagios - SummitAI(ITSM) tool Integration using APIs

Posted: Fri Feb 25, 2022 12:14 am
by QPUSER
Hi SSAX,

I am using cURL to consume SummitAI API and passing the information for below MACROS.
$HOSTNAME$
$HOSTSTATE$
$HOSTOUTPUT$
$SERVICEDESC$
$SERVICESTATE$

etc..

Further, want to know what is the MACRO name defined in Nagios to get CPU usage value
I want to pust data in INCIDENT(INC) in below format.

Syntax : Service $SERVICEDESC$ is $SERVICESTATE$ on $HOSTNAME$ with value ?
Expected Output : Service CPU usage is CRITICAL on FQDN with value 95%

Another Issue --> Any Macro which is not used by Nagios so so that i can utilized the same to record the JSON response by API. This will help to trigger INCIDENT resolution in SummitAI when the HOSTSTATE/SERVICESTATE is UP/OK respectively.
If this is not possible, Is there any way to create Custom MACRO in Nagios? If yes, please help me with supporting document.

Let m know if further info is needed.

Thanks
QP