Server IP : 127.0.0.2 / Your IP : 18.191.137.190 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/augeas/lenses/dist/tests/ |
Upload File : |
(* Module: Test_Xymon_Alerting Provides unit tests and examples for the <Xymon_Alerting> lens. *) module Test_Xymon_Alerting = let macro_definition = "$NOTIF_LOCAL=SCRIPT /foo/xymonqpage.sh $PAGER SCRIPT /foo/xymonsms.sh $SMS FORMAT=SMS COLOR=!yellow\n" test Xymon_Alerting.lns get macro_definition = { "$NOTIF_LOCAL" = "SCRIPT /foo/xymonqpage.sh $PAGER SCRIPT /foo/xymonsms.sh $SMS FORMAT=SMS COLOR=!yellow" } let basic_syntax = "HOST=hostname IGNORE\n" test Xymon_Alerting.lns get basic_syntax = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "IGNORE" { "filters" } } } } let two_filters = "HOST=hostname SERVICE=service IGNORE\n" test Xymon_Alerting.lns get two_filters = { "1" { "filters" { "HOST" = "hostname" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } let two_recipients = "HOST=hostname IGNORE STOP\n" test Xymon_Alerting.lns get two_recipients = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "IGNORE" { "filters" } } { "STOP" { "filters" } } } } let two_lines = "HOST=hostname SERVICE=service\n IGNORE\n" test Xymon_Alerting.lns get two_lines = { "1" { "filters" { "HOST" = "hostname" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } let two_lines_for_recipients = "HOST=hostname SERVICE=service\n IGNORE\nSTOP\n" test Xymon_Alerting.lns get two_lines_for_recipients = { "1" { "filters" { "HOST" = "hostname" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } { "STOP" { "filters" } } } } let with_blanks_at_eol = "HOST=hostname SERVICE=service \n IGNORE \n" test Xymon_Alerting.lns get with_blanks_at_eol = { "1" { "filters" { "HOST" = "hostname" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } let several_rules = "HOST=hostname SERVICE=service\nIGNORE\nHOST=hostname2 SERVICE=svc\nIGNORE\nSTOP\n" test Xymon_Alerting.lns get several_rules = { "1" { "filters" { "HOST" = "hostname" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } { "2" { "filters" { "HOST" = "hostname2" } { "SERVICE" = "svc" } } { "recipients" { "IGNORE" { "filters" } } { "STOP" { "filters" } } } } let duration = "HOST=hostname DURATION>20 SERVICE=service\nIGNORE\n" test Xymon_Alerting.lns get duration = { "1" { "filters" { "HOST" = "hostname" } { "DURATION" { "operator" = ">" } { "value" = "20" } } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } let notice = "HOST=hostname NOTICE SERVICE=service\nIGNORE\n" test Xymon_Alerting.lns get notice = { "1" { "filters" { "HOST" = "hostname" } { "NOTICE" } { "SERVICE" = "service" } } { "recipients" { "IGNORE" { "filters" } } } } let mail = "HOST=hostname MAIL astreinteMail\n" test Xymon_Alerting.lns get mail = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "MAIL" = "astreinteMail" { "filters" } } } } let script = "HOST=hostname SCRIPT /foo/email.sh astreinteMail\n" test Xymon_Alerting.lns get script = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "SCRIPT" { "script" = "/foo/email.sh" } { "recipient" = "astreinteMail" } { "filters" } } } } let repeat = "HOST=hostname REPEAT=15\n" test Xymon_Alerting.lns get repeat = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "REPEAT" = "15" { "filters" } } } } let mail_with_filters = "HOST=hostname MAIL astreinteMail EXSERVICE=service\n" test Xymon_Alerting.lns get mail_with_filters = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "MAIL" = "astreinteMail" { "filters" { "EXSERVICE" = "service" } } } } } let mail_with_several_filters = "HOST=hostname MAIL astreinteMail EXSERVICE=service DURATION>20\n" test Xymon_Alerting.lns get mail_with_several_filters = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "MAIL" = "astreinteMail" { "filters" { "EXSERVICE" = "service" } { "DURATION" { "operator" = ">" } { "value" = "20" } } } } } } let script_with_several_filters = "HOST=hostname SCRIPT /foo/email.sh astreinteMail EXSERVICE=service DURATION>20\n" test Xymon_Alerting.lns get script_with_several_filters = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "SCRIPT" { "script" = "/foo/email.sh" } { "recipient" = "astreinteMail" } { "filters" { "EXSERVICE" = "service" } { "DURATION" { "operator" = ">" } { "value" = "20" } } } } } } let repeat_with_several_filters = "HOST=hostname REPEAT=15 EXSERVICE=service DURATION>20\n" test Xymon_Alerting.lns get repeat_with_several_filters = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "REPEAT" = "15" { "filters" { "EXSERVICE" = "service" } { "DURATION" { "operator" = ">" } { "value" = "20" } } } } } } let recipients_with_several_filters = "HOST=hostname\nREPEAT=15 EXSERVICE=service DURATION>20\nMAIL astreinteMail TIME=weirdtimeformat\n" test Xymon_Alerting.lns get recipients_with_several_filters = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "REPEAT" = "15" { "filters" { "EXSERVICE" = "service" } { "DURATION" { "operator" = ">" } { "value" = "20" } } } } { "MAIL" = "astreinteMail" { "filters" { "TIME" = "weirdtimeformat" } } } } } let recipient_macro = "HOST=hostname\n $NOTIF_LOCAL\n STOP\n" test Xymon_Alerting.lns get recipient_macro = { "1" { "filters" { "HOST" = "hostname" } } { "recipients" { "$NOTIF_LOCAL" { "filters" } } { "STOP" { "filters" } } } }