Listing 4: Alert code
#Send an alert for a catastrophic error log entry, put the message
#in the alert action field and include the host involved and the
#operation being sure to substitute '_' for space to make the
#operation value in a doctor agreeable format.
Internet_catastrophe {
description = "Netscape Server Catastrophic Error";
type = "compound";
enable = true;
demand = true;
period = 180;
timeout = 0;
priority = "critical";
product = "internet";
trigger = '
upvar #0 internet_oldrow_$table oldrow
set alert internet_catastrophic
set table internet_errors
dget $table
set currow [dnrow $table]
set newrow $currow
if [info exists oldrow] {
if { $currow > $oldrow } {
while { $oldrow < $durrow } {
set category [dget $table category $oldrow]
if { $category == "catastrophic" } {
set desc [dcf -h $H_ALERT $alert description]
set message [dget $table message $oldrow]
set host [dget $table host $oldrow]
set operation [join [dget $table operation $oldrow] _]
dpoll
dalert -n $alert
dnotice -n $alert -a $message -d $desc host $host \
operation $operation
sco_arc_sendalert $alert $table $args $oldrow
incr oldrow
}
}
}
}
set oldrow $newrow
return 0
';
pager = "admin_pager";
mail = "helpdesk";
snmp = "";
# End of File
|