#!/usr/local/bin/perl # moncmd.cgi # enable the desired hosts/watch/services # require'./mon-lib.pl'; &init_config(); &ReadParse(); # if( ($in{'user'} && $in{'passwd'}) ){ open (FILE,">data/file"); print FILE "pass=$in{'passwd'}\n"; $server=`uname -n`; chomp($server);chomp($in{'user'});chomp($in{'passwd'}); if($in{'enable'}){ print FILE "enable $in{'enable'} $in{$in{'enable'}}\n"; }else{ print FILE "disable $in{'disable'} $in{$in{'disable'}}\n"; } close(FILE); #&enable_action("-a -l $in{'user'} -s $server enable service $in{'service'}",$in{'passwd'}); open (MON, "|/webmin-0.87/mon/moncmd.pl -a -l $in{'user'} -s $server -f /webmin-0.87/mon/data/file 1>/dev/null 2>&1") or die "Cannnot fork: $!"; close (MON); &redirect("./monshow.cgi"); }else{ &header(); print <
$text{'head_monauth'}
(If this is incorrect, service/watch/hosts cannot be enabled)
$text{'head_usr'}
$text{'head_pass'}
EOF if($in{'enable'}){ print "\n"; print "\n"; }else{ print "\n"; print "\n"; } print"
\n"; }