3 # Configure scheduled checking of services
5 require './status-lib.pl';
6 $access{'sched'} || &error($text{'sched_ecannot'});
7 &ui_print_header(undef, $text{'sched_title'}, "");
9 print &ui_form_start("save_sched.cgi", "post");
10 print &ui_table_start($text{'sched_header'}, "width=100%", 4);
13 print &ui_table_row($text{'sched_mode'},
14 &ui_yesno_radio("mode", int($config{'sched_mode'})));
16 # One email per problem?
17 print &ui_table_row($text{'sched_single'},
18 &ui_yesno_radio("single", int($config{'sched_single'})));
20 # Checking interval and offset
21 print &ui_table_row($text{'sched_int'},
22 &ui_textbox("int", $config{'sched_int'} || 5, 2)."\n".
23 &ui_select("period", $config{'sched_period'},
24 [ map { [ $_, $text{"sched_period_".$_} ] } (0..3) ])."\n".
25 $text{'sched_offset'}." ".
26 &ui_textbox("offset", $config{'sched_offset'}, 2),
30 @hours = split(/\s+/, $config{'sched_hours'});
31 @hours = ( 0 .. 23 ) if (!@hours);
32 for($j=0; $j<24; $j+=6) {
33 $hsel .= &ui_select("hours", \@hours,
34 [ map { [ $_, sprintf("%2.2d:00", $_) ] }
35 ($j .. $j+5) ], 6, 1);
37 print &ui_table_row($text{'sched_hours'}, $hsel);
39 @days = split(/\s+/, $config{'sched_days'});
40 @days = ( 0 .. 6 ) if (!@days);
41 print &ui_table_row($text{'sched_days'},
42 &ui_select("days", \@days,
43 [ map { [ $_, $text{'day_'.$_} ] } (0 .. 6) ], 7, 1));
45 # Send email when up / down / going down
46 print &ui_table_row($text{'sched_warn'},
47 &ui_radio("warn", int($config{'sched_warn'}),
48 [ [ 1, $text{'sched_warn1'} ],
49 [ 0, $text{'sched_warn0'} ],
50 [ 2, $text{'sched_warn2'} ] ]), 3);
53 print &ui_table_row($text{'sched_email'},
54 &ui_opt_textbox("email", $config{'sched_email'}, 30,
55 $text{'sched_none'}, $text{'sched_email'}), 3);
58 print &ui_table_row($text{'sched_from'},
59 &ui_opt_textbox("from", $config{'sched_from'}, 30,
60 "$text{'default'} (webmin)"), 3);
63 print &ui_table_row($text{'sched_smtp'},
64 &ui_opt_textbox("smtp", $config{'sched_smtp'}, 30,
65 $text{'sched_smtp_prog'},
66 $text{'sched_smtp_server'}), 3);
68 if ($config{'pager_cmd'}) {
70 print &ui_table_row($text{'sched_pager'},
71 &ui_opt_textbox("pager", $config{'sched_pager'}, 30,
72 $text{'sched_pnone'}), 3);
75 # SMS carrier and number
76 print &ui_table_row($text{'sched_sms'},
77 &ui_radio("sms_def", $config{'sched_carrier'} ? 0 : 1,
78 [ [ 1, $text{'sched_smsno'} ],
79 [ 0, $text{'sched_smscarrier'} ] ])."\n".
80 &ui_select("carrier", $config{'sched_carrier'},
81 [ map { [ $_->{'id'}, $_->{'desc'} ] }
82 sort { lc($a->{'desc'}) cmp lc($b->{'desc'}) }
83 &list_sms_carriers() ])."\n".
84 $text{'sched_smsnumber'}." ".
85 &ui_textbox("sms", $config{'sched_sms'}, 15), 3);
87 print &ui_table_end();
88 print &ui_form_end([ [ "save", $text{'save'} ] ]);
90 &ui_print_footer("", $text{'index_return'});