Page 1 of 1

[Solved] Database Table for Active Alerts

Posted: Sat Dec 16, 2017 8:52 am
by JGCG
Solved:
The API is in fact able to obtain this information by passing parameters to the URL.
https://nagios.server/nagiosxi/api/v1/o ... me_depth=0"
current_state (0/1/2): to determine if the host is in an ok/warning/critical state
cheduled_downtime_depth: to determine if the host is in scheduled downtime.


Hi,

I've been exploring the dataase trying to look for the table that holds all the current active warnings/criticals on Nagios but not had much luck in finding it.
Does such table exist?

My reasoning for this is we are looking to hook Nagios up to our ticking system (Supportworks) to auto log incidents for alerts that have been in a critical state for longer than 30 minutes (warnings and alerts less than this are not a concern).
I've had a quick look through the API and don't believe I can retrieve such information this way and so I was hoping to this information from the database.

We'd then pass the current alerts to a PHP script sitting between Naigios and Supportworks, confirm if that alert has been up for >30minutes, re-format the data and so pass it to the Supportworks API to log.

I've looked at event handlers, but I don't believe this will fit our needs as we do not want a ticket logged on a state change, just when the alerts has been up for longer than the 30minute threshold and only critical alerts.

Thanks.

Re: Database Table for Active Alerts

Posted: Sun Dec 17, 2017 10:48 pm
by tacolover101
i don't have an active XI installation, so I can't speak for the table side of things. i also wouldn't advise parsing from the database directly. however, i can offer advice on how to do this with Nagios.

a few ways actually.

1. set notification interval to 30, have your notifications send directly to Supportworks

2. use notification escalations, to send to the normal contacts initially, and escalate to Supportworks after 30m

3. use notification interval 0, have notifications sent to your middleware in PHP. PHP -> SQL, build a job to cycle through the DB every minute and execute when time >30m

4. parse nagios.log actively for critical issues

any of those should work. hope that helps.

Re: Database Table for Active Alerts

Posted: Mon Dec 18, 2017 11:04 am
by kyang
Thanks for the help @tacolover101!

JGCG, tacolover's suggestions are good.

Any of those should a good starting point.