вторник, 23 февраля 2016 г.

Поиск сбежавшей памяти

RAM: ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort

SWAP:
root@sneaky-work:/home/kim# cat ./swap.sh SUM=0 OVERALL=0 for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` do PID=`echo $DIR | cut -d / -f 3` PROGNAME=`ps -p $PID -o comm --no-headers` for SWAP in `grep VmSwap $DIR/status 2>/dev/null | awk '{ print $2 }'` do let SUM=$SUM+$SWAP done if (( $SUM > 0 )); then echo "PID=$PID swapped $SUM KB ($PROGNAME)" fi let OVERALL=$OVERALL+$SUM SUM=0 done echo "Overall swap used: $OVERALL KB"

среда, 3 февраля 2016 г.

Instructions on how to monitor onions w/ Nagios

Requirements

Working Nagios setup and the following packages.
  • tor / torsocks
    • For Debian, follow Tor Project Debian Instructions summarized here:
      • echo deb http://deb.torproject.org/torproject.org jessie main > /etc/apt/sources.list.d/tor.list
      • echo deb-src http://deb.torproject.org/torproject.org jessie main >> /etc/apt/sources.list.d/tor.list
      • gpg --keyserver keys.gnupg.net --recv 886DDD89
      • gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
      • apt-get update
      • apt-get install tor torsocks deb.torproject.org-keyring

Nagios setup

  • Add the following new command to your Nagios configuration to monitor various types of onions:
define command {
    command_name        check_http_tor
    command_line        /usr/bin/torsocks /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -I  '$HOSTADDRESS$' '$ARG1$'
    }
define command {
    command_name        check_ssh_tor
    command_line        /usr/bin/torsocks /usr/lib/nagios/plugins/check_ssh -H '$HOSTADDRESS$' '$ARG1$'
    }

define command {
    command_name        check_tcp_tor
    command_line        /usr/bin/torsocks /usr/lib/nagios/plugins/check_tcp -H '$HOSTADDRESS$' '$ARG1$'
    }
  • Apply the service check to a host:
define host {
    use                 generic-host            ; Name of host template to use
    host_name           samplea8s7df23jh7.onion
    alias               Sample Fake Onion
    address             samplea8s7df23jh7.onion
    check_command       check_http_tor!-p 8080
}


define service {
    use                 generic-service     ; name of template to use
    host_name           samplea8s7df23jh7.onion
    service_description SSH
    check_command       check_ssh_tor!-p 8492
}

define service {
    use                 generic-service     ; name of template to use
    host_name           samplea8s7df23jh7.onion
    service_description XMPP
    check_command       check_tcp_tor!-p 5222
}

Источник https://github.com/coldhakca/monion