Networker

Re: [Networker] Convert output of command line into human readable format

2013-02-19 09:00:47
Subject: Re: [Networker] Convert output of command line into human readable format
From: FAIDHERBE Thierry <thierry.faidherbe AT FOREM DOT BE>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Tue, 19 Feb 2013 13:54:34 +0000
Well, I use this after having filled nsradmin output to input.txt
to convert to html.

ex :

nsradmin> print type:nsr device

Generated output :
-----------------

type: NSR device;
                        name: "\\\\.\\Tape2147483637";
                     comment: "";
                 description: ;
                message_I18N: "writing, done (full)";
                     message: "writing, done (full)";
                 volume name: L50033L5;
                media family: tape;
                  media type: LTO Ultrium-5;
                     enabled: Yes;
                   read only: No;
             target sessions: 8;
                max sessions: 512;
              parent jukebox: NEO;
           cleaning required: No;
           cleaning interval: ;
           date last cleaned: ;
       auto media management: No;
                        ndmp: No;
      dedicated storage node: No;
                 remote user: ;
                    password: ;
                 hardware id: ;
                         CDI: Not used;
 Warn on suspect volumes (%): 80;
          TapeAlert Critical: ;
           TapeAlert Warning: ;
       TapeAlert Information: ;
                WORM capable: No;
             DLTWORM capable: No;
      WORM cartridge present: No;
        device serial number: ;

                        type: NSR device;
                        name: "I:\\AFD_SATA_DISK01\\_AF_readonly";
                     comment: ;
                 description: \
"System-created mirror of `I:\\AFD_SATA_DISK01'";
                message_I18N: "reading, data ";
                     message: "reading, data ";
                 volume name: AFDSATADISK01.RO;
                media family: disk;
                  media type: adv_file;
                     enabled: Yes;
                   read only: Yes;
             target sessions: 4;
                max sessions: 512;
              parent jukebox: ;
           cleaning required: No;
           cleaning interval: ;
           date last cleaned: ;
       auto media management: No;
                        ndmp: No;
      dedicated storage node: No;
                 remote user: ;
                    password: ;
                 hardware id: ;
                         CDI: Not used;
 Warn on suspect volumes (%): 80;
          TapeAlert Critical: ;
           TapeAlert Warning: ;
       TapeAlert Information: ;
                WORM capable: No;
             DLTWORM capable: No;
      WORM cartridge present: No;
        device serial number: ;



Paste above output to input.tmp ....

Then save this perl script (ex convert.pl)and execute it

perl convert.pl

###########################################
        $\ = "\r\n";

        open (REPORT,"input.tmp" ) ;

        $index=0;
        $begin=0;
        while (<REPORT>) {
                chomp;
                s/^\s+//;
                s/\s+$//;
                if ($_ ne "")  {
                        if ((m/: /)and ($begin eq 0)) {
                                ($header,$b)=split(':',$_);
                                
$val=substr($_,length($header)+2,length($_)-length($header)-2);
                                $begin=1;
                        } else {
                                $val=$_;
                        }
                        if (substr($_,length($_)-1,1) eq ";") {
                                $begin=0;
                        }
                        
$INFOTMP{$index}->{$header}="${INFOTMP{$index}->{$header}}$val<br>";
                } else {
                        $index=$index+1;
                }
        } # End of While
        close REPORT;

        open (OUTPUT,">output.html");
        print OUTPUT "<html><table border >";
        $tittle=0;
        for $index ( sort keys %INFOTMP) {
                if ($tittle eq 0 ){
                        print OUTPUT "<tr align=\"left\">";
                        foreach $header ( sort keys %{$INFOTMP{$index}}) {
                                print OUTPUT "<td nowrap>$header</td>";
                        }
                        $tittle=1;
                        print OUTPUT "</tr>";
                }
                print OUTPUT "<tr>";
                foreach $header ( sort keys %{$INFOTMP{$index}}) {
                        print OUTPUT "<td 
nowrap>$INFOTMP{$index}{$header}</td>";
                }
                print OUTPUT "</tr>";
        }
        print OUTPUT "</table>";
        close OUTPUT

###########################################

It will generate an output.html file with the output in a tabular format.

HTH

Thierry



-----Message d'origine-----
De : EMC NetWorker discussion [mailto:NETWORKER AT LISTSERV.TEMPLE DOT EDU] De 
la part de sonam
Envoyé : mardi 19 février 2013 12:45
À : NETWORKER AT LISTSERV.TEMPLE DOT EDU
Objet : [Networker] Convert output of command line into human readable format

Hi,

Go as nsradmin root.
write "print type: nsr group; name"

This will print all groups details.
Data against worklist & completion attribute is not readable.

Does anyone have any idea to convert in more refine format or human readable 
format.

Thanks,
Sonam

+----------------------------------------------------------------------
|This was sent by sonam.sodani AT igate DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>