In English

    Kill It! (UNIX way)

    I’ve got heavy load on one box. What is strange it operate normally, despite this load:

    load averages: 153.11, 152.41, 150.74
    866 processes: 150 runnable, 712 sleeping, 4 on CPU

    This ~720 processes ware snmpd in some strange loop of checking if snmpd is working.

    I can’t kill it globally witk pkill , but kill -9 PID works. I don’t want to manually type 720 pids and don’t want to restart machine, so here comes unix way to kill 720 processess:

    ps uax | grep snmpd | awk '{print $2}' | xargs kill -9

    Results?

    load averages: 0.04, 10.8, 59.5
    98 processes: 95 sleeping, 3 on CPU

    Back to normal state!

    Mondays… ;)

    © odwiedź stronę http://maciejewski.org po więcej fajnych postów!

    Fun

    One line to know where your users are on vacation :) (if they use company mail on vacation)

    Assuming You use dovecot 2.x and stores logs in /var/log/maillog:

    cat /var/log/maillog | grep Login: | awk '{print $10}' | sed 's/rip=//g' | sed 's/,//g' >> /tmp/1.txt && sh -c 'for line in `cat /tmp/1.txt`; do geoiplookup $line; done' | sort | uniq | awk '{print $4 $5}'

    gives You unique locations of every user login. You can also grep for specific login instead of all of them :)

    If You are not rotating Your logs it will take some time to return results.

    Related Posts with Thumbnails

    © odwiedź stronę http://maciejewski.org po więcej fajnych postów!

    Add your widget here