[Orca-users] Error in script data_gatherers/aix/orca-aix-stat.pl

VIRY Fr=?utf-8?B?w6k=?=d=?utf-8?B?w6k=?=ric USEI Est frederic.viry at francetelecom.com
Mon Jun 28 06:05:48 PDT 2004


Hello,

If command "uptime" displays :

04:16PM   up 179 days, 41 mins,  2 users,  load average: 1.07, 1.13, 1.15


the script orca-aix-stat.pl gives incorrect values for $uptime and $nusr.

Here are the corrected lines :


# line 180

  ## Get runq data
    $uptime = 0;
    open IN, "uptime |";
    while (<IN>) {
        if (/load average:\s+(\S+),\s+(\S+),\s+(\S+)/) {
            $load_info = join "\t", $1, $2, $3;
        }
        @upt = split(/ +/,);
        $uptd = $upt[3];
       if (/mins,/) { $nusr = $upt[7]; }
       else { $nusr = $upt[6]; }

        $up_day = $uptd * 24 * 60 * 60;

       if (/days,\s+(\S+)\s+mins,/) {
         $up_hrs = 0;
         $up_min = $1 * 60;
        }
       elsif (/days,\s+(\S+):(\S+), /) {
         $up_hrs = $1 * 60 * 60;
         $up_min = $2 * 60;
        }

        $uptime = $up_day + $up_hrs + $up_min;
    }
    close IN;

----------

I also add a change in the script. If we gain the last iteration, the script
doesn't make a sleep.

# line 540

if ( $iterations != 0 ) {
        sleep $INTERVAL - ( time() - $timestamp );
    }


Best regards

Frédéric Viry




More information about the Orca-users mailing list