Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

A question regarding linux commands

tinyraytinyray Member
edited December 2012 in Help

Hello,
I have a problem which is hopefully addressed quickly by linux experts in this community;
Given a text content

Node      State CPU 0  CPU 1  CPU 2  CPU 3  CPU 4  CPU 5  CPU 6  CPU 7  CPU 8  CPU 9 CPU 10 CPU 11
 -1          up   0.0%   0.0%   0.0%   0.0%   0.0%   4.0%   0.0%   2.0%   0.0%   0.0%   0.0%   2.0%
  2          up 100.0%   0.0% 100.0% 100.0%   0.0%   0.0% 100.0% 100.0%   0.0%   0.0%   0.0%   0.0%
  3          up 100.0% 100.0% 100.0%   0.0%   0.0%   0.0% 100.0% 100.0%   0.0%   0.0%   0.0%
  4          up 100.0%   0.0%   0.0%   0.0% 100.0%   0.0% 100.0% 100.0% 100.0%   0.0%   0.0%   0.0%
  5          up 100.0%   0.0% 100.0%   0.0%   0.0% 100.0% 100.0% 100.0%   0.0%   0.0%   0.0%   0.0%
  6          up 100.0%   0.0%   0.0% 100.0%   0.0%   0.0% 100.0% 100.0% 100.0%   
  7          up 100.0%   0.0%   0.0% 100.0%   0.0% 100.0% 100.0% 100.0%   0.0%   0.0%   0.0%   0.0%
  8          up 100.0%   0.0%   0.0% 100.0% 100.0%   0.0% 100.0%  99.0%   0.0%   0.0%   0.0%
  9          up 100.0%   0.0%   0.0%   0.0% 100.0%   0.0% 100.0% 100.0% 100.0%   0.0%   0.0%   0.0%
 10          up 100.0% 100.0% 100.0%   0.0%   0.0%   0.0% 100.0%   0.0% 100.0%   0.0%   0.0%   0.0%

How to get the node# of the line where the number of '0.0%' is max,

Thank you in advance!

Comments

  • What tools are available?

  • tinyraytinyray Member
    edited December 2012

    popular linux commands, I think.
    In addition, the number of cpus may be different from node to node.

  • Why is it core -1 instead of core 0?

    And where's core 1 and core 0?

    Wait, what is this even?

  • Some nodes may be down, I am looking for the node that is most available for a given task.

  • What program outputs this?

  • cosmicgatecosmicgate Member
    edited December 2012

    cmd | grep x ?

  • Damian, beostatus

    This is my solution,
    (echo q|beostatus -c)|awk 'BEGIN{nn=-1;mn=0}{nav=0;for(i=1;i<NF;i++){if($i=="0.0%")nav=nav+1;}if(mn<nav){mn=nav;nn=$1}}END{print nn;}'

  • GIANT_CRAB,
    -1 is the id of the master node.

Sign In or Register to comment.