#########################################################################################
# This little PERL script runs on a web server that can reach the SAP
# systems on the lan. When called, it checks the status of an SAP system
# and lets us know, whether it is up or down. Sapinfo.exe has to be
# copied to cgi-bin. This particular script runs on NT with IIS.
# Change the first two lines to the location of your Perl to run it on UNIX.
# It be called using the following html tags:
#
#<form method="GET" name="sapcheck" action="http://myserver.com/cgi-bin/status.pl">
# <p><select name="SYS" size="1">
# <option selected value="RTC">RTC</option>
# <option value="DEV">DEV</option>
# <option value="PRD">PRD</option>
# </select><input type="submit" value="submit"></p>
#</form>
#
# And it will look like this:
#########################################################################################
#
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
#
print "<HTML><BODY>";
#
require "cgi-lib.pl";
&ReadParse;
$i = 0;
$b = $in{'SYS'};
#
if ($b =~ /RTC/) {
open (FILE, "sapinfo -3 -h saphost1 -s 00 -u sap* -p passwd1 |");
}
else {
open (FILE, "sapinfo -3 -h saphost2 -s 99 -u sap* -p passwd2 |");
}
#
while ($a = <FILE>) {
if ($i == 0) {
print "<B>When you clicked on the button $b was up and running!</B><P>";
}
print "<small>$a<P></small>";
$i+=1;
}
print "</small>";
if ($i == 0) {
print "<B>When you clicked on the button $b was down!</B>";
}
print "</HTML></BODY>";
#
#########################################################################################