Home: Perl Programming Help: Advanced:
CGI/Perl script to find the weblogic server state.



dashok.83
New User

Aug 23, 2010, 2:08 PM


Views: 3492
CGI/Perl script to find the weblogic server state.

Hi,

Below is my CGI/Perl script.


Code
#!/usr/bin/perl -w 
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print "Content-type: text/html\n\n";
my $REPFILE="/wlsuite/om/cm/Tools/scripts/AWCC-EnvBulletin/Server_Status/all_report.html";
system("/wlsuite/om/cm/Tools/scripts/AWCC-EnvBulletin/Server_Status/CheckStatus.ksh $REPFILE > /wlsuite/om/cm/Tools/scripts/AWCC-EnvBulletin/Server_Status/debug.log");

open(ENVREPFILE, "< $REPFILE") || die "<center><H3>Sorry, cannot open ENVREPFILE .</H3></center>";
@text = <ENVREPFILE>;

print <<EndOfHTML
<html>@text</html>

EndOfHTML



I have .ksh script that would do some greping on files of mine and also it will get the state of weblogic servers.


Below is snippet of my .ksh




Code
 

function CheckStatus {

while read line
do

echo $line | cut -d'|' -f1 | read URL
echo $line | cut -d'|' -f2 | read PURPOSE
echo "<td>$URL</td>" >> $REPORT_ALL
echo "<td>$PURPOSE</td>" >> $REPORT_ALL




if [ $CODE -eq 1 ]
then
SERVER_STATE="RUNNING"
echo "<td style="color:GREEN" ><b>$SERVER_STATE</b></td>" >> $REPORT_ALL
else
SERVER_STATE="DOWN"
echo "<td style="color:RED" ><b>$SERVER_STATE</b></td>" >> $REPORT_ALL
TOGGLE=1
fi
echo "
<td>
<a href="http://$URL/athena/jsp/index.jsp" target="_blank">http://$URL/athena/jsp/index.jsp</a>
</td> " >> $REPORT_ALL
echo "
<td>
<a href="http://monsoon/omcsm/releases/DEVELOPER_ACCESS/Pebblz13:8008" target="_blank">Server.log</a>
</td>
</tr>" >> $REPORT_ALL
done < $ENV_DETAILS

}



=======

1. When I run the .cgi script from commandline,it run awesome.

2. When I run from the web server, it is not executing the below line at all.




Code
 
java weblogic.Admin -url $URL -username wlsadmin -password wlsadmin GETSTATE | grep RUNNING | wc -l | read CODE


What could be the problem ???