Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CGI script help needed

    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
    Attached Files Attached Files

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,836
    Thanks
    2
    Thanked 158 Times in 153 Posts
    That script needs a major overhaul.

    According to this section of the script you posted, it should print the data in your desired format.
    Code:
    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.
    Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •