I could not able to run this perl script after I moved to another host, perl versions are same.

Here the code --------- use Time::Local; #use warnings qw(FATAL); #use diagnostics; #$SIG{__WARN__} = sub { $DB::single = 1; CORE::warn(@_) }; # variable settings $target="raksan"; $wwwpath="/$target"; $wwwrealpath="/home/nagios/stat/$target/htdocs"; $node = param("node"); $tmpgraph="rrd-$$.gif"; $now=time; $recenttimes = $now - 3600 * 36; $aix = 1 if ($node =~ /amsr/); # # Generate HTML page # system("/home/nagios/stat/scripts/ng_rrd2img.sh $target $node dig $rec +enttimes now 300 130 > $wwwrealpath/tmp/$tmpgraph"); print "Content-type: text/html\n\n"; print <<EOF <html><header><meta http-equiv="refresh" content="300"><title>NMON Per +formance Graphs</title></header><body bgcolor=#FFFFFF link=#006699 al +ink=#0000ff vlink=#006699> <body><BR><FONT FACE="arial"> <CENTER><h1>NMON Performance Graphs</h1></CENTER> EOF ; # # get the current day ,month, year for the form # ($sec,$min,$hour,$mday,$month,$year,$wday,$yday) = localtime($now); #($sec,$min,$mday,$month,$year,$wday,$yday) = localtime($now); $today = $mday; $tomonth = $month + 1; $toyear = $year + 1900; # # Create a row for each node, with the FORM, the sysinfo, and a graph +in it. # The nodes are all systems entered at the command line. # print <<EOF <table border="0" cellspacing="1"> <tr bgcolor="#A0A0FF"> <td colspan=5 rowspan=1 ><FONT SIZE=-5>&nbsp;<a name=$node></a></td> <form name="graph_$node" method=post action=/$target/cgi-bin/ng.pl tar +get=_blank> <input type=hidden name=node value=$node> <tr bgcolor="#C0C0C0"> <TD> <B>Select Graph(s)</B><BR> <select name=graph size=12 multiple> <option selected>CPU <option>Memory Use <option>Memory Totals <option>Memory Stats <option>Memory Ratios <option>Paging Act <option>Network Read <option>Network Write <option>Processes <option>Context Switches <option>Run Queue <option>Filesystem IO EOF ; if ($aix) { print <<EOF <option>File IO <option>IO Adapters Read <option>IO Adapters Write <option>System Calls EOF ; } print <<EOF </select> </TD> <TD> <table border="0" cellspacing="1"> <tr bgcolor="#C0C0C0"> <TD> <B>Select&nbsp;Range</B><BR> <select name=time size=9 > <option>Custom<br> <option selected>Today<br> <option>Yesterday<br> <option>This Week<br> <option>Last Week<br> <option>This Month<br> <option>Last Month<br> <option>This Year<br> <option>Last Year<br> </select> </TD> </tr> <tr bgcolor="#C0C0C0"> <td colspan=3 rowspan=1 align=center><BR><input type=submit value +="Create Graph!"></td> </tr> </table> </TD> <TD> <table border="0" cellspacing="1"> <tr bgcolor="#C0C0C0"> <td colspan=3 rowspan=1 align=center><B>Custom Range</B></td> </tr> <tr bgcolor="#A0A0FF"> <td colspan=3 rowspan=1 align=center>Start Date</td> </tr> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Day</td> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Month</td> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Year</td> </tr> <tr bgcolor="#C0C0C0"> <TD> EOF ; print "<select name=startday>\n"; $i = 1; while ( $i <= 31 ) { $selected = ($i == $today) ? "selected" : ""; printf "<option $selected>%02d", $i; $i++; } print "</select></TD><TD>\n"; print "<select name=startmonth>\n"; $i = 1; while ( $i <= 12) { $selected = ($i == $tomonth) ? "selected" : ""; printf "<option $selected>%02d", $i; $i++; } print "</select></TD><TD>\n"; $i = 2015; print "<select name=startyear>\n"; while ( $i <= 2025 ) { $selected = ($i == $toyear) ? "selected" : ""; printf "<option $selected>%04d", $i; $i++; } print "</select></TD>\n"; print <<EOF </tr> <tr bgcolor="#A0A0FF"> <td colspan=3 rowspan=1 align=center>End Date</td> </tr> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Day</td> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Month</td> <td colspan=1 rowspan=1 ><FONT SIZE=-1>Year</td> </tr> <tr bgcolor="#C0C0C0"> <TD> EOF ; print "<select name=endday>\n"; $i = 1; while ( $i <= 31 ) { $selected = ($i == $today) ? "selected" : ""; printf "<option $selected>%02d", $i; $i++; } print "</select></TD><TD>\n"; print "<select name=endmonth>\n"; $i = 1; while ( $i <= 12 ) { $selected = ($i == $tomonth) ? "selected" : ""; printf "<option $selected>%02d", $i; $i++; } print "</select></TD><TD>\n"; $i = 2015; print "<select name=endyear>\n"; while ( $i <= 2025 ) { $selected = ($i == $toyear) ? "selected" : ""; printf "<option $selected>%04d", $i; $i++; } print "</select></TD>\n"; print <<EOF </tr> <tr bgcolor="#C0C0C0"> <td colspan=3 rowspan=1 >&nbsp;</td> </tr> <tr bgcolor="#A0A0FF"> <td colspan=3 rowspan=1 align=center>Specify Graph Size</td> </tr> <tr bgcolor="#C0C0C0"> <td colspan=3 rowspan=1 align=center><FONT SIZE=-1>Width:<input t +ype=text name=width value=400 size=3>Height:<input type=text name=hei +ght value=300 size=3></td> </tr> </table> </form> <TD ALIGN=CENTER> <H2>$node</H2> EOF ; $sysinfo = `sudo -u rsnagios ssh $node bin/sysinfo|sed s/-/_/`; ($model, $num_procs, $memory, $pssize, $kernelbits, $aixlevel, $uptime +) = split(/,/, $sysinfo); print <<EOF <table border="0" cellspacing="1"> <tr bgcolor="#A0A0FF"> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Model</td> <td colspan=1 rowspan=1 >:&nbsp;$model</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Procs</td> <td colspan=1 rowspan=1 >:&nbsp;$num_procs</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Memory</td> <td colspan=1 rowspan=1 >:&nbsp;${memory}MB</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Paging</td> <td colspan=1 rowspan=1 >:&nbsp;${pssize}MB</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Kernel</td> <td colspan=1 rowspan=1 >:&nbsp;$kernelbits&nbsp;bit</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >OS</td> <td colspan=1 rowspan=1 >:&nbsp;$aixlevel</td> <tr bgcolor="#C0C0C0"> <td colspan=1 rowspan=1 >Uptime</td> <td colspan=1 rowspan=1 >:&nbsp;$uptime</td> </table> </TD> <td colspan=1 rowspan=1> <IMG src="${wwwpath}/tmp/$tmpgraph"> </tr> </table> <p><FONT SIZE=-1>The Performance data is recorded on the systems using + nmon and stored in Round Robin Databases by rrdtool. This interface +is created by nmon_grapher. </p> </body></html> EOF ; ------code ends here

Original content restored above and code tags added by GrandFather

What is the basic difference between run perl script from shell and via browser. how the result can be different on each method?
--------- <c> use Time::Local; #use warnings qw(FATAL); #use diagnostics; #$SIG{__WARN__} = sub { $DB::single = 1; CORE::warn(@_) }; # variable settings $target="raksan"; $wwwpath="/$target"; $wwwrealpath="/home/nagios/stat/$target/htdocs"; $node = param("node"); $tmpgraph="rrd-$$.gif"; $now=time; $recenttimes = $now - 3600 * 36; $aix = 1 if ($node =~ /amsr/);

In reply to perl script not working after moved to new host by prabhakard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.