Nagios - SummitAI(ITSM) tool Integration using APIs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

Nagios - SummitAI(ITSM) tool Integration using APIs

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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!
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

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

Post by QPUSER »

Hi SSAX,

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

rg/
PSP
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post by ssax »

No problem, we'll keep an eye out for any updates.
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

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

Post 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.
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

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

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

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

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
QPUSER
Posts: 19
Joined: Mon Dec 13, 2021 4:49 am

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

Post 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
Locked