[ Avaa Bypassed ]




Upload:

Command:

www-data@18.216.95.250: ~ $
#!/usr/bin/perl
# edit_mon.cgi
# Display a form for editing or creating a monitor

require './status-lib.pl';
$access{'edit'} || &error($text{'mon_ecannot'});
&foreign_require("servers", "servers-lib.pl");
&ReadParse();
@handlers = &list_handlers();
if ($in{'type'}) {
	# Create a new monitor
	$in{'type'} =~ /^[a-zA-Z0-9\_\-\.\:]+$/ || &error($text{'mon_etype'});
	$type = $in{'type'};
	$title = $text{'mon_create'};
	if ($in{'clone'}) {
		# Clone of existing
		$serv = &get_service($in{'clone'});
		}
	else {
		# Totally new
		$serv = { 'notify' => 'email pager snmp sms',
			  'fails' => 1,
			  'nosched' => 0,
			  'remote' => '*' };
		}
	}
else {
	# Editing an existing monitor
	$serv = &get_service($in{'id'});
	$type = $serv->{'type'};
	$title = $text{'mon_edit'};
	}
($han) = grep { $_->[0] eq $type } @handlers;
if ($in{'type'} && !$in{'clone'}) {
	$serv->{'desc'} = $han->[1];
	}
&ui_print_header($han->[1], $title, "");

if ($serv->{'virtualmin'} && &foreign_check("virtual-server")) {
	# Owned by a Virtualmin domain - don't recommend editing
	&foreign_require("virtual-server");
	$d = &virtual_server::get_domain($serv->{'virtualmin'});
	if ($d) {
		print "<b>",&text('mon_virtualmin',
			&virtual_server::show_domain_name($d)),"</b> <p>\n";
		}
	}

print &ui_form_start("save_mon.cgi", "post");
print &ui_hidden("type", $in{'type'}),"\n";
print &ui_hidden("id", $in{'id'}),"\n";
@tds = ( "width=30%" );
print &ui_table_start($text{'mon_header'}, "width=100%", 2, \@tds);

# Check for clone modules of the monitor type
if (-d "../$type") {
	local @st = stat("../$type");
	opendir(DIR, "..");
	foreach $m (readdir(DIR)) {
		local @lst = stat("../$m");
		if (-l "../$m" && $st[1] == $lst[1]) {
			# found a clone
			push(@clones, $m);
			}
		}
	}

# Show input for description
print &ui_table_row($text{'mon_desc'},
		    &ui_textbox("desc", $serv->{'desc'}, 50),
		    undef, \@tds);

# Show current status
if (!$in{'type'}) {
	@stats = &service_status($serv, 1);
	$stable = "<table cellpadding=1 cellspacing=1>\n";
	foreach $stat (@stats) {
		$stable .= "<tr>\n";
		if (@stats > 1 || $stat->{'remote'} ne "*") {
			$stable .=
			    "<td>".
			    ($stat->{'remote'} eq "*" ? $text{'mon_local'}
						      : $stat->{'remote'}).
			    "</td>\n";
			$stable .= "<td>:</td>\n";
			}
		$stable .= "<td>".
		      ($stat->{'desc'} && $stat->{'up'} == 0 ?
			 "<font color=#ff0000>$stat->{'desc'}</font>" :
		       $stat->{'desc'} ? $stat->{'desc'}
				       : &status_to_string($stat->{'up'})).
			"</td>\n";
		$stable .= "</tr>\n";
		}
	$stable .= "</table>\n";
	print &ui_table_row($text{'mon_status'}, $stable,
			    undef, \@tds);
	}

# Show servers to run on
@servs = grep { $_->{'user'} } &servers::list_servers_sorted();
@servs = sort { $a->{'host'} cmp $b->{'host'} } @servs;
if (@servs) {
	# Show list of remote servers, and maybe groups
	$s = &ui_select("remotes", [ split(/\s+/, $serv->{'remote'}) ],
			 [ [ "*", "&lt;$text{'mon_local'}&gt;" ],
			   map { [ $_->{'host'}, $_->{'host'} ] } @servs ],
			 5, 1, 1),
	@groups = &servers::list_all_groups(\@servs);
	@groups = sort { $a->{'name'} cmp $b->{'name'} } @groups;
	if (@groups) {
		$s .= &ui_select("groups", [ split(/\s+/, $serv->{'groups'}) ],
			 [ map { [ $_->{'name'}, &group_desc($_) ] } @groups ],
			 5, 1, 1),
		}
	print &ui_table_row($text{'mon_remotes2'}, $s, undef, \@tds);
	}
else {
	# Only local is available
	print &ui_hidden("remotes", "*"),"\n";
	}

# Show emailing schedule
print &ui_table_row($text{'mon_nosched'},
		    &ui_select("nosched", int($serv->{'nosched'}),
			       [ [ 1, $text{'no'} ],
				 [ 0, $text{'mon_warndef'} ],
				 [ 3,  $text{'mon_warn1'} ],
				 [ 2,  $text{'mon_warn0'} ],
				 [ 4,  $text{'mon_warn2'} ],
				 [ 5,  $text{'mon_warn3'} ] ]),
		    undef, \@tds);

# Show number of failures
print &ui_table_row($text{'mon_fails'},
		    &ui_textbox("fails", $serv->{'fails'}, 5),
		    undef, \@tds);

# Show notification mode
$notify = "";
%notify = map { $_, 1 } split(/\s+/, $serv->{'notify'});
foreach $n (&list_notification_modes()) {
	$notify .= &ui_checkbox("notify", $n, $text{'mon_notify'.$n},
				$notify{$n})."\n";
	delete($notify{$n});
	}
foreach $n (keys %notify) {
	# Don't clear set but un-usable modes
	print &ui_hidden("notify", $n);
	}
print &ui_table_row($text{'mon_notify'}, $notify,
		    undef, \@tds);

# Show extra address to email
print &ui_table_row($text{'mon_email'},
		    &ui_textbox("email", $serv->{'email'}, 60),
		    undef, \@tds);

# Show template to use
@tmpls = &list_templates();
if (@tmpls) {
	if ($in{'type'}) {
		($deftmpl) = grep { $_->{'desc'} eq $config{'def_tmpl'}} @tmpls;
		if ($deftmpl) {
			$tid = $deftmpl->{'id'};
			}
		}
	else {
		$tid = $serv->{'tmpl'};
		}
	print &ui_table_row($text{'mon_tmpl'},
		&ui_select("tmpl", $tid,
			   [ [ "", "&lt;$text{'mon_notmpl'}&gt;" ],
			     map { [ $_->{'id'}, $_->{'desc'} ] } @tmpls ]));
	}

# Which clone module to use
if (@clones) {
	local %minfo = &get_module_info($type);
	print &ui_table_row($text{'mon_clone'},
		   &ui_select("clone", $serv->{'clone'},
			      [ [ "", $minfo{'desc'} ],
				map { local %cminfo = &get_module_info($_);
				      [ $_, $cminfo{'desc'} ] } @clones ]),
		   undef, \@tds);
	}

# Skip if some other monitor is down
@servs = &list_services();
if (@servs) {
	print &ui_table_row($text{'mon_depend'},
	  &ui_select("depend", $serv->{'depend'},
		 [ [ "", "&nbsp;" ],
		   map { [ $_->{'id'}, $_->{'desc'}.
				       " (".&nice_remotes($_).")" ] }
		     sort { $a->{'desc'} cmp $b->{'desc'} } @servs ]),
	  undef, \@tds);
	}

print &ui_table_end();
print "<p>\n";
print &ui_table_start($text{'mon_header2'}, "width=100%", 2, \@tds);

# Show commands to run on up/down
print &ui_table_row($text{'mon_ondown'},
		    &ui_textbox("ondown", $serv->{'ondown'}, 60),
		    undef, \@tds);

print &ui_table_row($text{'mon_onup'},
		    &ui_textbox("onup", $serv->{'onup'}, 60),
		    undef, \@tds);

print &ui_table_row($text{'mon_ontimeout'},
		    &ui_textbox("ontimeout", $serv->{'ontimeout'}, 60),
		    undef, \@tds);

print &ui_table_row(" ", "<font size=-1>$text{'mon_oninfo'}</font>",
		    undef, \@tds);

# Radio button for where to run commands
print &ui_table_row($text{'mon_runon'},
		    &ui_radio("runon", $serv->{'runon'} ? 1 : 0,
			      [ [ 0, $text{'mon_runon0'} ],
				[ 1, $text{'mon_runon1'} ] ]),
		    undef, \@tds);

print &ui_table_end();

# Display inputs for this monitor type
if ($type =~ /^(\S+)::(\S+)$/) {
	# From another module
	($mod, $mtype) = ($1, $2);
	&foreign_require($mod, "status_monitor.pl");
	&foreign_call($mod, "load_theme_library");
	if (&foreign_defined($mod, "status_monitor_dialog")) {
		print &ui_table_start($text{'mon_header3'}, "width=100%", 4,
				      \@tds);
		print &foreign_call($mod, "status_monitor_dialog", $mtype, $serv);
		print &ui_table_end();
		}
	}
else {
	# From this module
	do "./${type}-monitor.pl";
	$func = "show_${type}_dialog";
	if (defined(&$func)) {
		print &ui_table_start($text{'mon_header3'}, "width=100%", 4,
				      \@tds);
		&$func($serv);
		print &ui_table_end();
		}
	}

# Show history, in a hidden section
if (!$in{'type'}) {
	@history = &list_history($serv,
				 $in{'all'} ? undef : $config{'history_show'});
	}
if (@history) {
	print &ui_hidden_table_start($text{'mon_header4'}, "width=100%", 2,
		"history", defined($in{'all'}) || defined($in{'changes'}));

	# Build links to switch to changes-only mode or show all history
	@links = ( );
	if ($in{'changes'}) {
		push(@links, "<a href='edit_mon.cgi?id=$in{'id'}&changes=0&".
			     "all=$in{'all'}'>$text{'mon_changes0'}</a>");
		}
	else {
		push(@links, "<a href='edit_mon.cgi?id=$in{'id'}&changes=1&".
			     "all=$in{'all'}'>$text{'mon_changes1'}</a>");
		}
	if (!$in{'all'}) {
		push(@links, "<a href='edit_mon.cgi?id=$in{'id'}&changes=".
			     "$in{'changes'}&all=1'>$text{'mon_all'}</a>");
		}
	if ($in{'changes'}) {
		@history = grep { $_->{'old'} ne $_->{'new'} } @history;
		}

	# Check if any history events have a value
	$anyvalue = 0;
	foreach $h (@history) {
		foreach my $hv (split(/\//, $h->{'value'})) {
			my ($vhost, $v) = split(/=/, $hv, 2);
			if ($v ne '') {
				$anyvalue++;
				last;
				}
			}
		}

	# Show history table
	$links = &ui_links_row(\@links);
	$table = &ui_columns_start([
		$text{'mon_hwhen'},
		$text{'mon_hold'},
		$text{'mon_hnew'},
		$anyvalue ? ( $text{'mon_hvalue'} ) : ( ) ]);
	foreach $h (reverse(@history)) {
		my @cols = ( &make_date($h->{'time'}) );
		foreach my $s ($h->{'old'}, $h->{'new'}) {
			my @ups;
			my @statuses = split(/\s+/, $s);
			foreach my $rs (@statuses) {
				my ($host, $up) = split(/=/, $rs, 2);
				$img = "<img src=".&get_status_icon($up).">";
				if ($host ne "*") {
					$img = $host.$img;
					}
				elsif (@statuses > 1) {
					$img = &get_display_hostname().$img;
					}
				push(@ups, $img);
				}
			push(@cols, join(" ", @ups));
			}
		if ($anyvalue) {
			my @vlist;
			my @values = split(/\//, $h->{'value'});
			my @nice_values = split(/\//, $h->{'nice_value'});
			for(my $i=0; $i<@values; $i++) {
				my ($vhost, $v) = split(/=/, $values[$i], 2);
				my (undef, $nv) = split(/=/, $nice_values[$i], 2);
				push(@vlist, $nv || $v);
				}
			push(@cols, join(" ", @vlist));
			}
		$table .= &ui_columns_row(\@cols);
		}
	$table .= &ui_columns_end();
	if (@history) {
		print &ui_table_row(undef, $links.$table, 2);
		}
	else {
		print &ui_table_row(undef, $links.
			&text('mon_nochanges', $config{'history_show'}), 2);
		}
	print &ui_hidden_table_end();
	}

# Show create/delete buttons
if ($in{'type'}) {
	print &ui_form_end([ [ "create", $text{'create'} ] ]);
	}
else {
	print &ui_form_end([ [ "save", $text{'save'} ],
			     [ "newclone", $text{'mon_clone2'} ],
			     [ "delete", $text{'delete'} ] ]);
	}

&ui_print_footer("", $text{'index_return'});


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
services Folder 0755
CHANGELOG File 6.42 KB 0644
WEBMIN-STATUS-MIB.txt File 1.53 KB 0644
acl_security.pl File 508 B 0755
alive-monitor.pl File 241 B 0755
apache-monitor.pl File 697 B 0755
backup_config.pl File 801 B 0755
bind8-monitor.pl File 710 B 0755
cfengine-monitor.pl File 415 B 0755
cgi_args.pl File 321 B 0755
change-monitor.pl File 791 B 0755
config File 182 B 0644
config-ALL-linux File 210 B 0644
config-debian-linux File 225 B 0644
config-debian-linux-3.0 File 216 B 0644
config-debian-linux-3.1-ALL File 216 B 0644
config-freebsd File 195 B 0644
config-hpux File 182 B 0644
config-netbsd File 182 B 0644
config-solaris File 182 B 0644
config-syno-linux File 197 B 0644
config.info File 1.09 KB 0644
config.info.ca File 1.31 KB 0644
config.info.cs File 802 B 0644
config.info.de File 1.28 KB 0644
config.info.es File 659 B 0644
config.info.fa File 994 B 0644
config.info.fr File 1.42 KB 0644
config.info.hu File 0 B 0644
config.info.it File 0 B 0644
config.info.ja File 1.04 KB 0644
config.info.ko File 764 B 0644
config.info.nl File 984 B 0644
config.info.no File 962 B 0644
config.info.pl File 1021 B 0644
config.info.ru File 486 B 0644
config.info.sv File 99 B 0644
config.info.tr File 567 B 0644
config.info.uk File 479 B 0644
config.info.zh File 86 B 0644
config.info.zh_TW File 229 B 0644
consume-monitor.pl File 1.89 KB 0755
defaultacl File 15 B 0644
delete_mons.cgi File 1.03 KB 0755
delete_tmpls.cgi File 712 B 0755
dhcpd-monitor.pl File 616 B 0755
dns-monitor.pl File 1.3 KB 0755
dnsadmin-monitor.pl File 667 B 0755
dovecot-monitor.pl File 302 B 0755
du-monitor.pl File 790 B 0644
edit_mon.cgi File 9.61 KB 0755
edit_sched.cgi File 3.24 KB 0755
edit_tmpl.cgi File 1.81 KB 0755
exec-monitor.pl File 1.52 KB 0755
fail2ban-monitor.pl File 516 B 0755
feedback_files.pl File 175 B 0755
file-monitor.pl File 3.35 KB 0755
ftp-monitor.pl File 3.05 KB 0755
hostsentry-monitor.pl File 521 B 0755
http-monitor.pl File 4.13 KB 0755
iface-monitor.pl File 908 B 0755
index.cgi File 4.77 KB 0755
inetd-monitor.pl File 399 B 0755
init-monitor.pl File 576 B 0644
jabber-monitor.pl File 667 B 0755
ldap-monitor.pl File 1.51 KB 0755
list_tmpls.cgi File 1.05 KB 0755
load-monitor.pl File 1.1 KB 0755
log_parser.pl File 673 B 0755
mailq-monitor.pl File 1.3 KB 0755
memory-monitor.pl File 1.55 KB 0755
module.info File 168 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 128 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 167 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 198 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 247 B 0644
module.info.ca File 118 B 0644
module.info.ca.auto File 14 B 0644
module.info.cs File 33 B 0644
module.info.cs.auto File 105 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 120 B 0644
module.info.de File 121 B 0644
module.info.de.auto File 15 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 274 B 0644
module.info.es File 40 B 0644
module.info.es.auto File 95 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 132 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 185 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 134 B 0644
module.info.fr File 42 B 0644
module.info.fr.auto File 107 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 155 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 134 B 0644
module.info.hu File 37 B 0644
module.info.hu.auto File 99 B 0644
module.info.it File 39 B 0644
module.info.it.auto File 96 B 0644
module.info.ja File 57 B 0644
module.info.ja.auto File 130 B 0644
module.info.ko File 36 B 0644
module.info.ko.auto File 92 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 131 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 136 B 0644
module.info.ms File 119 B 0644
module.info.ms.auto File 15 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 146 B 0644
module.info.nl File 33 B 0644
module.info.nl.auto File 97 B 0644
module.info.no File 32 B 0644
module.info.no.auto File 96 B 0644
module.info.pl File 97 B 0644
module.info.pl.auto File 15 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 133 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 142 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 153 B 0644
module.info.ru File 56 B 0644
module.info.ru.auto File 165 B 0644
module.info.sk File 33 B 0644
module.info.sk.auto File 106 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 135 B 0644
module.info.sv File 33 B 0644
module.info.sv.auto File 92 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 250 B 0644
module.info.tr File 32 B 0644
module.info.tr.auto File 105 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 208 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 174 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 182 B 0644
module.info.zh File 36 B 0644
module.info.zh.auto File 76 B 0644
module.info.zh_TW File 40 B 0644
module.info.zh_TW.auto File 82 B 0644
mon-monitor.pl File 431 B 0755
monitor.pl File 14.59 KB 0755
mysql-monitor.pl File 450 B 0755
nfs-monitor.pl File 394 B 0755
nut-monitor.pl File 2.13 KB 0755
oldfile-monitor.pl File 864 B 0755
ping-monitor.pl File 6.84 KB 0755
portsentry-monitor.pl File 535 B 0755
postfix-monitor.pl File 509 B 0755
postgresql-monitor.pl File 480 B 0755
prefs.info File 58 B 0644
proc-monitor.pl File 1.7 KB 0755
proftpd-monitor.pl File 842 B 0755
qmailadmin-monitor.pl File 424 B 0755
query-monitor.pl File 2.89 KB 0755
raid-monitor.pl File 1.66 KB 0755
refresh.cgi File 550 B 0755
rssh-monitor.pl File 2.63 KB 0755
safeacl File 15 B 0644
samba-monitor.pl File 453 B 0755
save_mon.cgi File 3.23 KB 0755
save_sched.cgi File 2.44 KB 0755
save_tmpl.cgi File 1.25 KB 0755
sendmail-monitor.pl File 682 B 0755
sensors-monitor.pl File 3.9 KB 0755
slapd-monitor.pl File 606 B 0755
space-monitor.pl File 3.09 KB 0755
squid-monitor.pl File 881 B 0755
sshd-monitor.pl File 817 B 0755
sslcert-monitor.pl File 4.11 KB 0755
status-lib.pl File 17.62 KB 0755
status_monitor_api.pl File 593 B 0755
system_info.pl File 1.48 KB 0644
tcp-monitor.pl File 1.23 KB 0755
traffic-monitor.pl File 2.4 KB 0755
uninstall.pl File 434 B 0755
usermin-monitor.pl File 496 B 0755
webmin-monitor.pl File 363 B 0755
xinetd-monitor.pl File 491 B 0755