|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Test_Xymon_Alerting
|
|
Packit Service |
a2ae7a |
Provides unit tests and examples for the <Xymon_Alerting> lens.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Test_Xymon_Alerting =
|
|
Packit Service |
a2ae7a |
let macro_definition = "$NOTIF_LOCAL=SCRIPT /foo/xymonqpage.sh $PAGER SCRIPT /foo/xymonsms.sh $SMS FORMAT=SMS COLOR=!yellow\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get macro_definition =
|
|
Packit Service |
a2ae7a |
{ "$NOTIF_LOCAL" = "SCRIPT /foo/xymonqpage.sh $PAGER SCRIPT /foo/xymonsms.sh $SMS FORMAT=SMS COLOR=!yellow" }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let basic_syntax = "HOST=hostname IGNORE\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get basic_syntax =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let two_filters = "HOST=hostname SERVICE=service IGNORE\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get two_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let two_recipients = "HOST=hostname IGNORE STOP\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get two_recipients =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
{ "STOP" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let two_lines = "HOST=hostname SERVICE=service\n IGNORE\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get two_lines =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let two_lines_for_recipients = "HOST=hostname SERVICE=service\n IGNORE\nSTOP\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get two_lines_for_recipients =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
{ "STOP" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let with_blanks_at_eol = "HOST=hostname SERVICE=service \n IGNORE \n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get with_blanks_at_eol =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let several_rules = "HOST=hostname SERVICE=service\nIGNORE\nHOST=hostname2 SERVICE=svc\nIGNORE\nSTOP\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get several_rules =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "2"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname2" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "svc" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
{ "STOP" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let duration = "HOST=hostname DURATION>20 SERVICE=service\nIGNORE\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get duration =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "DURATION"
|
|
Packit Service |
a2ae7a |
{ "operator" = ">" }
|
|
Packit Service |
a2ae7a |
{ "value" = "20" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let notice = "HOST=hostname NOTICE SERVICE=service\nIGNORE\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get notice =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
{ "NOTICE" }
|
|
Packit Service |
a2ae7a |
{ "SERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "IGNORE" { "filters" } }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let mail = "HOST=hostname MAIL astreinteMail\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get mail =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "MAIL" = "astreinteMail"
|
|
Packit Service |
a2ae7a |
{ "filters" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let script = "HOST=hostname SCRIPT /foo/email.sh astreinteMail\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get script =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "SCRIPT"
|
|
Packit Service |
a2ae7a |
{ "script" = "/foo/email.sh" }
|
|
Packit Service |
a2ae7a |
{ "recipient" = "astreinteMail" }
|
|
Packit Service |
a2ae7a |
{ "filters" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let repeat = "HOST=hostname REPEAT=15\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get repeat =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "REPEAT" = "15"
|
|
Packit Service |
a2ae7a |
{ "filters" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let mail_with_filters = "HOST=hostname MAIL astreinteMail EXSERVICE=service\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get mail_with_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "MAIL" = "astreinteMail"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "EXSERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let mail_with_several_filters = "HOST=hostname MAIL astreinteMail EXSERVICE=service DURATION>20\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get mail_with_several_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "MAIL" = "astreinteMail"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "EXSERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
{ "DURATION"
|
|
Packit Service |
a2ae7a |
{ "operator" = ">" }
|
|
Packit Service |
a2ae7a |
{ "value" = "20" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let script_with_several_filters = "HOST=hostname SCRIPT /foo/email.sh astreinteMail EXSERVICE=service DURATION>20\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get script_with_several_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "SCRIPT"
|
|
Packit Service |
a2ae7a |
{ "script" = "/foo/email.sh" }
|
|
Packit Service |
a2ae7a |
{ "recipient" = "astreinteMail" }
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "EXSERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
{ "DURATION"
|
|
Packit Service |
a2ae7a |
{ "operator" = ">" }
|
|
Packit Service |
a2ae7a |
{ "value" = "20" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let repeat_with_several_filters = "HOST=hostname REPEAT=15 EXSERVICE=service DURATION>20\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get repeat_with_several_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "REPEAT" = "15"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "EXSERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
{ "DURATION"
|
|
Packit Service |
a2ae7a |
{ "operator" = ">" }
|
|
Packit Service |
a2ae7a |
{ "value" = "20" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let recipients_with_several_filters = "HOST=hostname\nREPEAT=15 EXSERVICE=service DURATION>20\nMAIL astreinteMail TIME=weirdtimeformat\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get recipients_with_several_filters =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "REPEAT" = "15"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "EXSERVICE" = "service" }
|
|
Packit Service |
a2ae7a |
{ "DURATION"
|
|
Packit Service |
a2ae7a |
{ "operator" = ">" }
|
|
Packit Service |
a2ae7a |
{ "value" = "20" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "MAIL" = "astreinteMail"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "TIME" = "weirdtimeformat" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let recipient_macro = "HOST=hostname\n $NOTIF_LOCAL\n STOP\n"
|
|
Packit Service |
a2ae7a |
test Xymon_Alerting.lns get recipient_macro =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "filters"
|
|
Packit Service |
a2ae7a |
{ "HOST" = "hostname" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "recipients"
|
|
Packit Service |
a2ae7a |
{ "$NOTIF_LOCAL"
|
|
Packit Service |
a2ae7a |
{ "filters" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
{ "STOP"
|
|
Packit Service |
a2ae7a |
{ "filters" }
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
|