Topic
  • 4 replies
  • Latest Post - ‏2013-05-21T17:46:45Z by JackNo
SystemAdmin
SystemAdmin
1283 Posts

Pinned topic WebGui 7.3.1 WebGui help

‏2013-02-19T21:28:22Z |
Hello I am working on creating a tool that will fire off the bellow cgi script. I keep getting page not found can any of one give me a hand. Running webGui 7.3.1 FP5.. fairly new to Webgui so any help would be great..

#!/usr/bin/perl -w
sub trim($);
print "Content-type: text/html\n\n";
print "<!-- enable:smartpage -->";

$SERVER = "NCOMS_P";
$USER = "xxxx";
$PASSWD = "12345";

my $buffer; my @pairs; my $pair; my $name; my $value; my %FORM;
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%(a-fA-F0-9a-fA-F0-9)/pack("C", hex($1))/eg;

$name =~ tr/+/ /;
$name =~ s/%(a-fA-F0-9a-fA-F0-9)/pack("C", hex($1))/eg;

$FORM{$name} = $value;
}
my $username = $FORM{un};
print "User name -- $username";
$nco_string = "/opt/netcool/omnibus/bin/nco_sql -server " . $SERVER . " -user " . $USER . " -password " .$PASSWD;
#######
###Get UserID from OS
#######
$username = trim($username);
$sql_select = "select UID from master.names where Name='".$username ."'";
#print $sql_select;
@return_string = `$nco_string <<EOF
$sql_select
go
quit
EOF`;
my $usernum = trim($return_string[2]);
chomp($usernum);
#print "User Num ---- $usernum";
if($usernum eq "")
{
print <<__HTML__;
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<body onload='document.Form.submit();'>
<form name='Form' action='https://10.60.51.85:16311/omnibus_webgui/etc/cgi-bin/nrc.cgi'<input TYPE="hidden" NAME="un" VALUE="
<!-- insert:USERNAME -->
">
</body>
</html>
__HTML__

}
else
{
print <<__HTML__;
<HTML>
<HEAD>
<TITLE>
USA
</TITLE>

</HEAD>
<BODY class="base">
<center>
<table border=1 >
<tr>
<td>
<table border=0 cellspacing=10>
<tr>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
</tr>
<tr>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>

</tr>
<tr>
<td bgcolor=#006699>
<!-- insert:AEL -->
</td>

</tr>
</table>
</td>
</tr>
</table>

</center>

</BODY>
</HTML>
__HTML__
}
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}

Thanks
Tracy
Updated on 2013-03-15T11:17:15Z at 2013-03-15T11:17:15Z by jeffri
  • gulfsoft
    gulfsoft
    25 Posts

    Re: WebGui 7.3.1 WebGui help

    ‏2013-02-20T02:09:15Z  
    Have you been through the product documentation here?
    http://publib.boulder.ibm.com/infocenter/tivihelp/v8r1/index.jsp?topic=%2Fcom.ibm.netcool_OMNIbus.doc_7.3.1%2Fwebtop%2Fwip%2Ftask%2Fweb_cust_creatingtools.html
    We can make Tivoli software work for you!www.gulfsoft.com
  • SystemAdmin
    SystemAdmin
    1283 Posts

    Re: WebGui 7.3.1 WebGui help

    ‏2013-03-14T19:27:42Z  
    Place your script in the following dir
    $NCHOME/omnibus_webgui/etc/cgi-bin
    Make sure permissions are set so its excutable.

    Register your cgi script in
    Administration -> EventManagement Tools -> CGI Registry

    In you Administration -> EventManagement Tools -> Tool Creation
    Create Tool
    select type: cgi/url
    Then in the URL: place $(SERVER)/cgi-bin/YOURSCRIPTNAME.cgi

    Should run after that by selecting your tool. Good Luck
  • jeffri
    jeffri
    20 Posts

    Re: WebGui 7.3.1 WebGui help

    ‏2013-03-15T11:17:15Z  
    Hi,

    Note also that you can manually test the access to your CGI script from the browser by putting into the browser address bar 'https://host:port/ibm/console/webtop/cgi-bin/<script_name_with_optional_query_string>'. If it works via this method, it should work when executed via a tool from the AEL.
    hth,
    Jeffri
  • JackNo
    JackNo
    4 Posts

    Re: WebGui 7.3.1 WebGui help

    ‏2013-05-21T17:46:45Z  

    try moving   print "<!-- enable:smartpage -->";     to right after each print <<__HTML__;  in your script.