#!/usr/bin/perl # edit_service.cgi # Display a new or existing service inside a watch require './mon-lib.pl'; &ReadParse(); $conf = &get_mon_config(); $watch = $conf->[$in{'idx'}]; if ($in{'new'}) { &ui_print_header(undef, $text{'service_title'}, ""); } else { &ui_print_header(undef, $text{'service_title2'}, ""); $service = $watch->{'members'}->[$in{'sidx'}]; } print "<form action=save_service.cgi method=post>\n"; print "<input type=hidden name=idx value='$in{'idx'}'>\n"; print "<input type=hidden name=sidx value='$in{'sidx'}'>\n"; print "<input type=hidden name=new value='$in{'new'}'>\n"; print "<table border width=100%>\n"; print "<tr $tb> <td><b>$text{'service_header'}</b></td> </tr>\n"; print "<tr $cb> <td><table width=100%>\n"; print "<tr> <td><b>$text{'service_name'}</b></td>\n"; printf "<td><input name=name size=20 value='%s'></td>\n", $service->{'values'}->[0]; $int = &find_value("interval", $service->{'members'}); print "<td><b>$text{'service_interval'}</b></td>\n"; print "<td>",&interval_input("interval", $int),"</td> </tr>\n"; $desc = &find("description", $service->{'members'}); print "<tr> <td><b>$text{'service_desc'}</b></td>\n"; printf "<td colspan=3><input name=desc size=50 value='%s'></td> </tr>\n", $desc ? $desc->{'value'} : ""; @mons = &list_monitors(); $monitor = &find("monitor", $service->{'members'}) if (!$in{'new'}); if ($monitor->{'value'} =~ /^(\S+)\s*(.*)$/) { $mon = $1; $args = $2; } $idx = &indexof($mon, @mons); print "<tr> <td><b>$text{'service_monitor'}</b></td> <td colspan=3>\n"; printf "<input type=radio name=monitor_def value=1 %s> %s\n", $in{'new'} || $idx >= 0 ? "checked" : "", $text{'service_mon1'}; print "<select name=monitor>\n"; foreach $m (@mons) { printf "<option %s>%s</option>\n", $m eq $mon ? "selected" : "", $m; } print "</select>\n"; printf "<input type=radio name=monitor_def value=0 %s> %s\n", $in{'new'} || $idx >= 0 ? "" : "checked", $text{'service_mon0'}; printf "<input name=other size=20 value='%s'>\n", $idx >= 0 ? "" : $mon; print "</td> </tr>\n"; print "<tr> <td><b>$text{'service_args'}</b></td> <td colspan=3>\n"; print "<input name=args size=50 value='$args'></td> </tr>\n"; $i = 0; @avail = &list_alerts(); @periods = &find("period", $service->{'members'}); push(@periods, { }) if ($in{'newperiod'} || $in{'new'}); @defperiods = &find("period", $conf); foreach $p (@periods) { print "<tr> <td colspan=4><hr></td> </tr>\n"; print "<tr> <td colspan=2><b><i>",&text($p->{'name'} ? 'service_period' : 'service_new', $i+1),"</i></b></td>\n"; print "<td colspan=2 align=right><input type=checkbox name=delete_$i> ", "$text{'service_delperiod'}</td> </tr>\n"; print "<input type=hidden name=idx_$i value='$p->{'index'}'>\n"; local ($dfrom, $dto, $hfrom, $hto, $known, $name); if ($p->{'value'} =~ /^\s*wd\s+{(\S+)-(\S+)}\s+hr\s+{(\S+)-(\S+)}\s*$/){ $dfrom = $1; $dto = $2; $hfrom = $3; $hto = $4; $known = 1; } elsif ($p->{'value'} =~ /^\s*wd\s+{(\S+)-(\S+)}\s*$/) { $dfrom = $1; $dto = $2; $known = 1; } elsif ($p->{'value'} =~ /^\s*hr\s+{(\S+)-(\S+)}\s*$/) { $hfrom = $1; $hto = $2; $known = 1; } elsif ($p->{'value'} =~ /^\s*(\S+):\s*$/) { $name = $1; $known = 2; } elsif (!$p->{'value'}) { $hfrom = $hto = ""; $known = 1; } # Specified days and hours printf "<tr> <td><input type=radio name=known_$i value=1 %s> %s</td>\n", $known == 1 ? "checked" : "", "<b>$text{'service_known1'}</b>"; print "<td colspan=3><b>$text{'service_days'}</b>\n"; printf "<input type=radio name=days_def_$i value=1 %s> %s\n", $dfrom ? "" : "checked", $text{'service_all'}; printf "<input type=radio name=days_def_$i value=0 %s>\n", $dfrom ? "checked" : ""; print &day_input("dfrom_$i", $dfrom)," - ", &day_input("dto_$i", $dto); print " \n"; print "<b>$text{'service_hours'}</b>\n"; printf "<input type=radio name=hours_def_$i value=1 %s> %s\n", $hfrom ? "" : "checked", $text{'service_all'}; printf "<input type=radio name=hours_def_$i value=0 %s>\n", $hfrom ? "checked" : ""; print "<input name=hfrom_$i size=4 value='$hfrom'> - ", "<input name=hto_$i size=4 value='$hto'></td> </tr>\n"; # Selected defined period if (@defperiods || $known == 2) { printf "<tr> <td><input type=radio name=known_$i value=2 %s> %s</td>\n", $known == 2 ? "checked" : "", "<b>$text{'service_known2'}</b>"; print "<td><select name=name_$i>\n"; foreach $p (@defperiods) { $p->{'value'} =~ /^(\S+):/; printf "<option %s>%s</option>\n", $name eq $1 ? "selected" : "", $1; } print "</select></td> </tr>\n"; } # Any Time::Period string printf "<tr> <td><input type=radio name=known_$i value=0 %s> %s</td>\n", $known == 0 ? "checked" : "", "<b>$text{'service_known0'}</b>"; printf "<td colspan=3><input name=pstr_$i size=50 value='%s'></td> </tr>\n", $known == 0 ? $p->{'value'} : ""; print "<tr> <td valign=top><b>$text{'service_alerts'}</b></td>\n"; print "<td colspan=3><table border>\n"; print "<tr $tb> <td><b>$text{'service_alert'}</b></td> ", "<td><b>$text{'service_atype'}</b></td> ", "<td><b>$text{'service_aargs'}</b></td> </tr>\n"; local @alerts = ( &find("alert", $p->{'members'}), &find("upalert", $p->{'members'}), &find("startupalert", $p->{'members'}) ); local $j = 0; foreach $a (@alerts, { }) { print "<tr $cb> <td><select name=alert_${i}_${j}>\n"; local ($found, $al, $ar); if ($a->{'value'} =~ /^(\S+)\s*(.*)/) { $al = $1; $ar = $2; } printf "<option value='' %s> </option>\n", $al ? "" : "selected"; foreach $av (@avail) { printf "<option %s>%s</option>\n", $al eq $av ? "selected" : "", $av; $found++ if ($al eq $av); } print "<option selected>$al</option>\n" if (!$found && $al); print "</select></td>\n"; print "<td><select name=atype_${i}_${j}>\n"; foreach $t ('alert', 'upalert', 'startupalert') { printf "<option value=%s %s>%s</option>\n", $t, $a->{'name'} eq $t ? "selected" : "", $text{"service_atype_$t"}; } print "</select></td>\n"; $ar =~ s/"/"/g; print "<td><input name=aargs_${i}_${j} size=30 ", "value='$ar'></td> </tr>\n"; $j++; } print "</table></td> </tr>\n"; local $ev = &find_value("alertevery", $p->{'members'}); print "<tr> <td><b>$text{'service_every'}</b></td> <td colspan=3>\n"; printf "<input type=radio name=every_def_$i value=1 %s> %s\n", $ev ? "" : "checked", $text{'service_every_def'}; printf "<input type=radio name=every_def_$i value=0 %s> %s\n", $ev ? "checked" : "", $text{'service_every_time'}; print &interval_input("every_$i", $ev),"</td>\n"; local @aa = &find_value("alertafter", $p->{'members'}); print "<tr> <td><b>$text{'service_after'}</b></td> <td colspan=3>\n"; printf "<input type=radio name=after_def_$i value=1 %s> %s\n", @aa ? "" : "checked", $text{'service_immediate'}; printf "<input type=radio name=after_def_$i value=0 %s>\n", @aa ? "checked" : ""; print &text('service_after_num', "<input name=after_$i size=6 value='$aa[0]'>"),"\n"; print " " x 3; print $text{'service_aftertime'},"\n"; print &interval_input("after_interval_$i", $aa[1]),"</td> </tr>\n"; local $na = &find_value("numalerts", $p->{'members'}); print "<tr> <td><b>$text{'service_num'}</b></td>\n"; printf "<td><input type=radio name=num_def_$i value=1 %s> %s\n", $na ? "" : "checked", $text{'service_unlimited'}; printf "<input type=radio name=num_def_$i value=0 %s>\n", $na ? "checked" : ""; print "<input name=num_$i size=6 value='$na'></td> </tr>\n"; $i++; } if (!$in{'new'}) { print "<tr> <td colspan=4><hr></td> </tr>\n"; print "<tr> <td colspan=4 align=right><a href='edit_service.cgi?", "idx=$in{'idx'}&sidx=$in{'sidx'}&newperiod=1'>", "$text{'service_newperiod'}</a></td> </tr>\n"; } print "</table></td></tr></table>\n"; print "<table width=100%><tr>\n"; if ($in{'new'}) { print "<td><input type=submit value='$text{'create'}'></td>\n"; } else { print "<td><input type=submit value='$text{'save'}'></td>\n"; print "<td align=right><input type=submit name=delete ", "value='$text{'delete'}'></td>\n"; } print "</tr></table></form>\n"; &ui_print_footer("list_watches.cgi", $text{'watches_return'});
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
help | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 113 B | 0644 |
|
README | File | 287 B | 0644 |
|
backup_config.pl | File | 732 B | 0755 |
|
config | File | 201 B | 0644 |
|
config-Fedora-Linux | File | 189 B | 0644 |
|
config.info | File | 362 B | 0644 |
|
config.info.ca | File | 397 B | 0644 |
|
config.info.cs | File | 375 B | 0644 |
|
config.info.de | File | 429 B | 0644 |
|
config.info.es | File | 399 B | 0644 |
|
config.info.nl | File | 420 B | 0644 |
|
config.info.no | File | 381 B | 0644 |
|
config.info.ru | File | 506 B | 0644 |
|
config.info.uk | File | 511 B | 0644 |
|
create_watch.cgi | File | 281 B | 0755 |
|
edit_auth.cgi | File | 1.43 KB | 0755 |
|
edit_global.cgi | File | 2.01 KB | 0755 |
|
edit_service.cgi | File | 8.05 KB | 0755 |
|
edit_user.cgi | File | 1.38 KB | 0755 |
|
edit_watch.cgi | File | 2.21 KB | 0755 |
|
feedback_files.pl | File | 113 B | 0755 |
|
index.cgi | File | 1.52 KB | 0755 |
|
install_check.pl | File | 329 B | 0755 |
|
list_groups.cgi | File | 832 B | 0755 |
|
list_periods.cgi | File | 2.09 KB | 0755 |
|
list_users.cgi | File | 1.03 KB | 0755 |
|
list_watches.cgi | File | 1.26 KB | 0755 |
|
module.info | File | 181 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 108 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 136 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 166 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 171 B | 0644 |
|
module.info.ca | File | 117 B | 0644 |
|
module.info.ca.auto | File | 13 B | 0644 |
|
module.info.cs | File | 37 B | 0644 |
|
module.info.cs.auto | File | 86 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 108 B | 0644 |
|
module.info.de | File | 111 B | 0644 |
|
module.info.de.auto | File | 12 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 192 B | 0644 |
|
module.info.es | File | 32 B | 0644 |
|
module.info.es.auto | File | 91 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 121 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 168 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 105 B | 0644 |
|
module.info.fr | File | 0 B | 0644 |
|
module.info.fr.auto | File | 126 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 136 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 119 B | 0644 |
|
module.info.hu | File | 0 B | 0644 |
|
module.info.hu.auto | File | 122 B | 0644 |
|
module.info.it | File | 0 B | 0644 |
|
module.info.it.auto | File | 121 B | 0644 |
|
module.info.ja | File | 0 B | 0644 |
|
module.info.ja.auto | File | 160 B | 0644 |
|
module.info.ko | File | 0 B | 0644 |
|
module.info.ko.auto | File | 138 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 141 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 128 B | 0644 |
|
module.info.ms | File | 105 B | 0644 |
|
module.info.ms.auto | File | 12 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 132 B | 0644 |
|
module.info.nl | File | 28 B | 0644 |
|
module.info.nl.auto | File | 89 B | 0644 |
|
module.info.no | File | 31 B | 0644 |
|
module.info.no.auto | File | 82 B | 0644 |
|
module.info.pl | File | 0 B | 0644 |
|
module.info.pl.auto | File | 112 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 122 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 131 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 128 B | 0644 |
|
module.info.ru | File | 38 B | 0644 |
|
module.info.ru.auto | File | 154 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 122 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 113 B | 0644 |
|
module.info.sv | File | 0 B | 0644 |
|
module.info.sv.auto | File | 117 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 255 B | 0644 |
|
module.info.tr | File | 0 B | 0644 |
|
module.info.tr.auto | File | 123 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 214 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 158 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 155 B | 0644 |
|
module.info.zh | File | 0 B | 0644 |
|
module.info.zh.auto | File | 121 B | 0644 |
|
module.info.zh_TW | File | 0 B | 0644 |
|
module.info.zh_TW.auto | File | 130 B | 0644 |
|
mon-lib.pl | File | 8.96 KB | 0755 |
|
mon.cgi | File | 998 B | 0755 |
|
mon_action.cgi | File | 415 B | 0755 |
|
moncmd.diff | File | 2.52 KB | 0644 |
|
moncmd.pl | File | 5.66 KB | 0755 |
|
monshow.cgi | File | 564 B | 0755 |
|
monshowrc | File | 166 B | 0644 |
|
restart.cgi | File | 180 B | 0755 |
|
save_auth.cgi | File | 625 B | 0755 |
|
save_global.cgi | File | 1.7 KB | 0755 |
|
save_groups.cgi | File | 656 B | 0755 |
|
save_periods.cgi | File | 1.11 KB | 0755 |
|
save_service.cgi | File | 4.71 KB | 0755 |
|
save_user.cgi | File | 823 B | 0755 |
|
save_watch.cgi | File | 370 B | 0755 |
|
start.cgi | File | 226 B | 0755 |
|
stop.cgi | File | 423 B | 0755 |
|