Giter Site home page Giter Site logo

Comments (13)

arnaudbey avatar arnaudbey commented on May 1, 2024

what does this command tell, in a shell ?

/bin/netstat -ntu | awk 'NR>2{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr

from linux-dash.

lgaetz avatar lgaetz commented on May 1, 2024

Load the dashboard, get the error message and this:
nstat1

root@pbx2:/ $ /bin/netstat -ntu | awk 'NR>2{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
     18
      2 127.0.0.1
      2 10.41.2.126
      1 208.113.219.101
      1 146.255.36.1
      1 10.41.2.6

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

i suspect that address to begin with a ":" or something wrong with the cut

could you try without the cut ?
/bin/netstat -ntu | awk 'NR>2{print $5}' | sort | uniq -c | sort -rk 1

by the way, this command should be the one used (if it fixes your pb obviously), cause it may the result more precise, keeping port distinction beetween connections.

from linux-dash.

lgaetz avatar lgaetz commented on May 1, 2024

Confirmed.

root@pbx2:/ $ /bin/netstat -ntu | awk 'NR>2{print $5}' | sort | uniq -c | sort -rk 1
      1 ::ffff:10.41.2.6:38329
      1 ::ffff:10.41.2.126:62136
      1 ::ffff:10.41.2.126:62135
      1 ::ffff:10.41.2.126:62134
      1 ::ffff:10.41.2.126:62133
      1 ::ffff:10.41.2.126:62132
      1 ::ffff:10.41.2.126:62131
      1 ::ffff:10.41.2.126:62130
      1 ::ffff:10.41.2.126:62129
      1 ::ffff:10.41.2.126:62128
      1 ::ffff:10.41.2.126:62127
      1 ::ffff:10.41.2.126:62126
      1 ::ffff:10.41.2.126:62125
      1 ::ffff:10.41.2.126:62124
      1 ::ffff:10.41.2.126:62123
      1 ::ffff:10.41.2.126:62122
      1 ::ffff:10.41.2.126:62121
      1 ::ffff:10.41.2.126:62120
      1 ::ffff:10.41.2.126:62119
      1 208.113.219.101:80
      1 127.0.0.1:56565
      1 127.0.0.1:5038
      1 10.41.2.126:61511
      1 10.41.2.126:60640
      1 10.10.0.17:53

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

And how about this one ?
/bin/netstat -ntu | awk 'NR>2 {sub(/:[^:]+?$/, ""); print $5}' | sort | uniq -c | sort -rk 1

from linux-dash.

lgaetz avatar lgaetz commented on May 1, 2024
root@pbx2:/ $ /bin/netstat -ntu | awk 'NR>2 {sub(/:[^:]+?$/, ""); print $5}' | sort | uniq -c | sort -rk 1
      2 127.0.0.1
      2 10.41.2.126
     20 ::ffff:10.41.2.126
      1 208.113.219.101
      1 146.255.36.1
      1 10.41.2.6

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

hmm, it solves (partially) the problem. This one should be ok :
/bin/netstat -ntu | awk 'NR>2 {sub(/:[^:]+?$/, ""); print $5}' | sort | uniq -c | sort -nrk 1

from linux-dash.

lgaetz avatar lgaetz commented on May 1, 2024
root@pbx2:/ $ /bin/netstat -ntu | awk 'NR>2 {sub(/:[^:]+?$/, ""); print $5}' | sort | uniq -c | sort -nrk 1
     31 ::ffff:10.41.2.126
      2 127.0.0.1
      2 10.41.2.126
      1 208.113.219.101
      1 146.255.36.1

from linux-dash.

commonquail avatar commonquail commented on May 1, 2024

The port will only be a number; sub(/:[^:]+?$/, ""); can be changed to sub(/:[0-9]+$/, "");.
Is the first call to sort necessary?
The k argument to the second sort call can be omitted.

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

yep, first sort is necessary. Removing it cause the uniq to not work completly. Dunbno exactkly why, i'm not a unix expert, not yet :)

And about regexp, it's not a bug, it's a feature 💃
I just wanted to be more generic, that's why I also make the quantifior less greedy (to handle weird client address)

And I agree about the k argument.

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

second sort is even fully useless since it's javascript sorted

from linux-dash.

commonquail avatar commonquail commented on May 1, 2024

I figured that was the cause for the pattern. I personally prefer explicitness when possible and I'd rather tackle specific issues as they arise, but I'm not going to insist either way.

I do think we should probably drop the second call to sort, though.

from linux-dash.

arnaudbey avatar arnaudbey commented on May 1, 2024

I'm ok with that too, i'll change it in that way !

from linux-dash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.