...

View Full Version : CGI script help needed



rohithji
08-24-2009, 07:35 AM
Hi Perl cgi experts,

I am not an expert in the perl/cgi scripting. I am expecting help from you experts to solve the issue which i am tryn to solve...
Right now i hav a perl/cgi script which is giving the output as given below in a file (below given is an eg)
Node - London,Moscow,Washington
Manager - Simnet Probe1,Simnet Probe2,Simnet Probe3
Alert Group - Systems1,Systems2,Systems3

The above values are saved in a file and this will be sending to email using sendmail functionality enclosed in the perl scrript ( The above contains 3 event informations)
Actually i wil be getting the details like above. But the requirment is to get the output in the manner like i need to get all the fields is given as

Node-London
Manger- Simnet Probe1
AlertGroup-Systems1

Node-Moscow
Manger- Simnet Probe2
AlertGroup-Systems2

Node-Washington
Manger- Simnet Probe3
AlertGroup-Systems3

I am givin the script which i have used along with this mail. That will contains the full information

please help me out for solving this

Thanking you all in advance

Rohit

FishMonger
08-24-2009, 06:15 PM
That script needs a major overhaul.

According to this section of the script you posted, it should print the data in your desired format.
foreach my $k (keys %result)
{
print TMPFILE "Node - $result{$k}{\"Node\"}\n";
print TMPFILE "Customer - $result{$k}{\"Customer\"}\n";
print TMPFILE "Message Text - $result{$k}{\"Summary\"}\n";
print TMPFILE "First Occurrence - $result{$k}{\"FirstOccurrence\"}\n";
print TMPFILE "Last Occurrence - $result{$k}{\"LastOccurrence\"}\n";
print TMPFILE "Severity - $result{$k}{\"Severity\"}\n";
print TMPFILE "Count - $result{$k}{\"Tally\"}\n";
print TMPFILE "Manager - $result{$k}{\"Manager\"}\n";
print TMPFILE "Message Group - $result{$k}{\"AlertGroup\"}\n";
print TMPFILE "Serial - $k\n";
print TMPFILE "------------------------------------------------------\n";


I don't see anywhere in your code where it's printing the data in this format.

Node - London,Moscow,Washington
Manager - Simnet Probe1,Simnet Probe2,Simnet Probe3
Alert Group - Systems1,Systems2,Systems3
Unless each field returned in the sql query is a csv list. If that's the case, then you have a very poorly designed database scheme



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum