In some cases you may want to change which notification you use based on a tag in the Alert keys. You can do this using the Lookup feature. Note: Lookup only works if you are using OpenTSDB and sending data to the Bosun to be indexed. For other backends or non-indexed data you have to use lookupSeries instead.
notification default {
email = [email protected]
}
notification JSmith{
email = [email protected]
}
#This will use the JSmith lookup for any alerts where the host tag starts with ny-jsmith
lookup host_base_contact {
entry host=ny-jsmith* {
main_contact = JSmith
}
entry host=* {
main_contact = default
}
}
alert blah {
...
warn = q(...)
warnNotification = lookup("host_base_contact", "main_contact")
critNotification = lookup("host_base_contact", "main_contact")
}
This can also be applied to multiple alerts using Macros:
macro host.based.contacts {
warnNotification = lookup("host_base_contact", "main_contact")
critNotification = lookup("host_base_contact", "main_contact")
}