SNMP trap sender delay (like notifications)
Posted: Mon Nov 30, 2015 6:56 pm
Hi,
I see that trap sender sends traps out right away rather than waiting a bit and not sending if an alert is cancelled. I have a delay set up in a host/service templates so if an alert is cancelled in the delay period, Nagios cleverly doesn't send notifications. I'd like to have something similar for the trap sender, so the traps sent more closely match the notifications.
Has anyone created something like this?
My thought is to replace the trap sender (snmptrap) or modify the .php file to use a script, and insert the traps into a table. Then have a service running say every 5 minutes to select from the table and if there's been an ok in the delay window, delete the alert and the ok. If the delay's been exceeded, send the send a trap and delete the row.
I'm thinking the table would have timestamp, trap destination, host, service, and alert text columns. The table will be cleaned up every few minutes so it would never get a lot of rows in it.
There was a feature request to make the trap sender configurable, which would simplify things.
A trap fed to snmptrap looks like this:
10.x.x.x:1162 hostname Log_Unix_System "WARNING: /var/log/messages contains 1 new instances of: error crit alert emerg. Last message:"
I see that trap sender sends traps out right away rather than waiting a bit and not sending if an alert is cancelled. I have a delay set up in a host/service templates so if an alert is cancelled in the delay period, Nagios cleverly doesn't send notifications. I'd like to have something similar for the trap sender, so the traps sent more closely match the notifications.
Has anyone created something like this?
My thought is to replace the trap sender (snmptrap) or modify the .php file to use a script, and insert the traps into a table. Then have a service running say every 5 minutes to select from the table and if there's been an ok in the delay window, delete the alert and the ok. If the delay's been exceeded, send the send a trap and delete the row.
I'm thinking the table would have timestamp, trap destination, host, service, and alert text columns. The table will be cleaned up every few minutes so it would never get a lot of rows in it.
There was a feature request to make the trap sender configurable, which would simplify things.
A trap fed to snmptrap looks like this:
10.x.x.x:1162 hostname Log_Unix_System "WARNING: /var/log/messages contains 1 new instances of: error crit alert emerg. Last message:"