[Solved] Database Table for Active Alerts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
JGCG
Posts: 45
Joined: Fri Sep 29, 2017 6:31 am

[Solved] Database Table for Active Alerts

Post 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.
Last edited by JGCG on Fri Jan 26, 2018 6:29 am, edited 1 time in total.
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Database Table for Active Alerts

Post 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.
kyang

Re: Database Table for Active Alerts

Post by kyang »

Thanks for the help @tacolover101!

JGCG, tacolover's suggestions are good.

Any of those should a good starting point.
Locked