send warning/critical notifications
Posted: Wed Jul 22, 2020 12:19 pm
For a given service, I want to send warning notifications to an email contact and critical notifications to a file on our nagios server. I have things setup and the warning notifications are working but the critical notifications are not getting written to the file on our nagios server. I'm thinking it's a configuration issue but I haven't been able to figure it out yet.
Here's the service configuration.
define service {
host_name abc123.prod.com
service_description LnM db: AUDIT_2021 - warning 20 GB -- critical 10 GB
use oraclequery_service_warning
check_command check_xi_oraclequery!--connect '12.345.67.89:1521/lmnor' --username 'xxxxx' --password 'abc123' --mode tablespace-free --name AUDIT_2021 --units GB --warning 20: --critical 10:!!!!!!!
contact_groups +dbas_service_prod_critical
register 1
}
Here's the oraclequery_service_warning template.
define service {
name oraclequery_service_warning
check_command check_xi_oraclequery!!!!!!!!
max_check_attempts 2
check_interval 60
retry_interval 5
check_period xi_timeperiod_24x7
high_flap_threshold 45
notification_interval 60
notification_period 24x7-Prod
notification_options w,
notifications_enabled 1
contacts dbaops-email
register 0
}
Here's the dbas_service_prod_critical contact group.
define contactgroup {
contactgroup_name dbas_service_prod_critical
alias DBAs alarmpoint prod
members dbaops-alarmpoint-24x7
}
Here's the dbaops-alarmpoint-24x7 contact.
define contact {
contact_name dbaops-alarmpoint-24x7
alias alarmpoint interface - critical db services
host_notifications_enabled 0
service_notifications_enabled 1
host_notification_period 24x7-Prod
service_notification_period 24x7-Prod
host_notification_options d,u,r,
service_notification_options c,
host_notification_commands notify-host-by-email-html
service_notification_commands dbas-service-notify-alarmpoint
use xi_contact_generic
}
Here's the dbas-service-notify-alarmpoint command.
define command {
command_name dbas-service-notify-alarmpoint
command_line /usr/bin/printf "%b" "|2|HTS-Database-Operations|****SERVICE:$SERVICEDESC$ ****HOST:$HOSTALIAS$ ****ADDRESS:$HOSTADDRESS$ ****STATE:$SERVICESTATE$ ****DATE/TIME:$LONGDATETIME$ ****ADDITIONAL INFO:$SERVICEOUTPUT$$LONGSERVICEOUTPUT$\n" >> /opt/NagiosAlert/NagiosAlertsCreateAutomatedTickets
}
Here's the service configuration.
define service {
host_name abc123.prod.com
service_description LnM db: AUDIT_2021 - warning 20 GB -- critical 10 GB
use oraclequery_service_warning
check_command check_xi_oraclequery!--connect '12.345.67.89:1521/lmnor' --username 'xxxxx' --password 'abc123' --mode tablespace-free --name AUDIT_2021 --units GB --warning 20: --critical 10:!!!!!!!
contact_groups +dbas_service_prod_critical
register 1
}
Here's the oraclequery_service_warning template.
define service {
name oraclequery_service_warning
check_command check_xi_oraclequery!!!!!!!!
max_check_attempts 2
check_interval 60
retry_interval 5
check_period xi_timeperiod_24x7
high_flap_threshold 45
notification_interval 60
notification_period 24x7-Prod
notification_options w,
notifications_enabled 1
contacts dbaops-email
register 0
}
Here's the dbas_service_prod_critical contact group.
define contactgroup {
contactgroup_name dbas_service_prod_critical
alias DBAs alarmpoint prod
members dbaops-alarmpoint-24x7
}
Here's the dbaops-alarmpoint-24x7 contact.
define contact {
contact_name dbaops-alarmpoint-24x7
alias alarmpoint interface - critical db services
host_notifications_enabled 0
service_notifications_enabled 1
host_notification_period 24x7-Prod
service_notification_period 24x7-Prod
host_notification_options d,u,r,
service_notification_options c,
host_notification_commands notify-host-by-email-html
service_notification_commands dbas-service-notify-alarmpoint
use xi_contact_generic
}
Here's the dbas-service-notify-alarmpoint command.
define command {
command_name dbas-service-notify-alarmpoint
command_line /usr/bin/printf "%b" "|2|HTS-Database-Operations|****SERVICE:$SERVICEDESC$ ****HOST:$HOSTALIAS$ ****ADDRESS:$HOSTADDRESS$ ****STATE:$SERVICESTATE$ ****DATE/TIME:$LONGDATETIME$ ****ADDITIONAL INFO:$SERVICEOUTPUT$$LONGSERVICEOUTPUT$\n" >> /opt/NagiosAlert/NagiosAlertsCreateAutomatedTickets
}