Thursday 27 June 2013

Redhat: vnc to remote server

NOTE: if the vncserver insists on starting on a port other than 5966, like 6099, wipe the ~/.vnc directory and start over again. If that doesn't help, change the second instance of 5966 below to 6066 in the port forwarding ssh command, e.g. '-L 5966:localhost:6066'.
  1.  as remote root on myhost
    1. yum install tigervnc
    2. yum install tigervnc-server
    3. yum install libXfont pixman
    4. yum install fluxbox
    5. yum install firefox
  2. as a remote user, myuser, on myhost
    1. vncserver :66 -localhost
      1. set a password, call it mypassword
  3. as local user
    1. ssh -L 5966:localhost:5966 myuser@myhost
      1. leave running and do next step in another local term
    2. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5966
      1. authenticate with mypassword
  4. as a remote user, myuser, on myhost
    1. export DISPLAY=:66
    2. xterm &
    3. fluxbox &
    4. firefox &

Wednesday 26 June 2013

xvfb


  1. sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
  2. sudo apt-get install xvfb
  3. sudo apt-get install xtightvncviewer
  4. apt-get install x11vnc
  5. sudo apt-get install fluxbox
  6. export DISPLAY=:1
  7. Xvfb :1 -screen 0 1024x768x16 &
  8. fluxbox &
  9. x11vnc -display :1 -bg -nopw -listen localhost -xkb
  10. export DISPLAY=:0
  11. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5900
  12. you should see fluxbox running within another window which you can navigate
  13. try, for fun
    1. export DISPLAY=:1
    2. xterm
    3. pkill fluxbox
    4. fluxbox &
Gets weirder
  1. close the above vncviewer window
  2. x11vnc -display :1 -bg -nopw -listen localhost -xkb
  3. x11vnc -display :1 -bg -nopw -listen localhost -xkb
  4. x11vnc -display :1 -bg -nopw -listen localhost -xkb
  5. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5900
  6. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5901
  7. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5902
Launch apps in the new display
  1. sudo apt-get install firefox
  2. DISPLAY=:1 firefox &
Note: if vncviewer is not available on the CLI, use xtightvncviewer instead, same thing

See: http://en.wikipedia.org/wiki/Xvfb

Tuesday 25 June 2013

Zenoss: multi-graph report


Note: used version 3.x, other version nav my vary slightly
  1. Make a group
    1. create a new group under Infrastructure
    2. name it group001
    3. drag-and-drop a bunch of related servers into it
  2. Reports -> Multi-Graph Reports, left-nav
    1. Add Multi-Graph Report, bottom left-nav '+' sign
      1. name it report001
      2. Collections
        1. Add Collection
          1. def: a collection is just a previously defined set of devices
            1. like your group001
          2. name it collection001
            1. Group, in drop-down
            2. click on group001
            3. Add to Collection
        2. nav in 3.x sucks, click back on report name
          1. upper middle-nav "breadcrumb"
      3. Graph Definitions
        1. Add Graph
          1. name it graph001
          2. Graph Points
            1. Add DataPoint
              1. laLoadInt15_laLoadInt15
                1. hard to go wrong with this data point
                2. later, you can explore others
                3. naming can be very, very ugly
                  1. e.g. os/interfaces/eth0/ifOutOctets_ifOutOctets
          3. nav sucks, click back on report name in breadcrumb
      4. Graph Groups
        1. Add Graph Group
          1. name it graphgroup001
          2. select
            1. collection: collection001
            2. graph definition: graph001
            3. method: All devices on single graph
            4. save
        2. nav sucks, click back on report name in breadcrumb
    2. View Report, upper, upper left-nav
      1. should see some points plotted on a graph for all servers in your "group
      2. one can always go back to reports main screen to view report

Wednesday 19 June 2013

tsunami-udp: faster than rsync


  1. build
    1. sudo apt-get install git gcc
    2. sudo apt-get install automake autoconf
    3. git clone git://github.com/rriley/tsunami-udp.git
    4. cd tsunami-udp
    5. ./recompile.sh
    6. sudo make install
  2. run
    1. you'll need a port open to allow direct connection from client to server
      1. unfortunately, this doesn't work through NAT firewalls alone
      2. firewall / port forwarding
        1. to server, TCP, 46224 by default
        2. to client, UDP, 46224 by default
    2. start up server
      1. tsunamid myfile.gz
    3. connect with client
      1. tsunami set rate 5M connect myserver.domain.com get myfile.gz
      2. it will flood your connection if you dont set rate properly
  3. documentation
    1. http://tsunami-udp.cvs.sourceforge.net/viewvc/tsunami-udp/docs/USAGE.txt
    2. splits files automatically
    3. allows wildcards when running server and client commands, "*", namely
      1. client will auto-find all files served, one after the next
      2. use forward-slash, i.e. get \*, for client command 
        1. so bash doesn't intrepret the asterisk
  4. undocumented
    1. doesn't do subdirectories, better tar that up and have plenty of disk space

Tuesday 18 June 2013

bash substring matching


  1. #!/bin/bash
  2. [[ "$(hostname -s)" =~ $'dev' ]] && exit
  3. echo "we are not a dev host"

Monday 17 June 2013

telnet vs netcat


  1. netcat
    1. prints only what is sent by the remote host
  2. telnet
    1. not suitable for arbitrary binary data 
      1. reserves some bytes as control characters 
    2. quits when its input runs out
      1. you may not see what the other end sends
    3. doesn't do UDP

Friday 14 June 2013

Fix bad/wrong aclocal version during make


  1. autoreconf -fi
    1. updates generated configuration files
This was necessary when building tsunami-udp from cvs repository, the configure files were old/incompatible.

Taken: http://stackoverflow.com/questions/8865093/should-a-configure-script-be-distributed-if-configure-ac-is-available

Thursday 13 June 2013

Exclude domains in your google search results


  1.  Put '-' in front of 'site:' operator
    1. e.g.
      1. Try: how to learn tibco -site:tibco.com -site:tibcommunity.com
      2. searches for materials on "how to learn tibco" while ignoring all Tibco's noise
FYI: It seems there is a copyright, so searching for "SOA" instead might lead to more books with desired material covered.

Monday 10 June 2013

Out of inodes: file write error (No space left on device)


  1. df -hi
    1. proves you are out of inodes or not
    2. cause is most likely tons of small files in some "problem directory", poke around
  2. find <random_dir> -type f | wc -l
    1. give a count of file in that subdir
    2. common problem dirs
      1. /var/spool/<XYZ>
      2. /tmp
  3. find <problem_dir> -type f -delete
    1. deletes one file at a time
    2. rm will get stuck finding files first if you use wildcard like *

git push/pull just current branch


  1. git config --global push.default tracking
  2. git config --global pull.default tracking
FYI, these settings are saved in ~/.gitconfig

Thursday 6 June 2013

Zenoss: Linux SSH commands


  1. On CLI
    1. su - zenoss
    2. zenpack --list
    3. wget http://community.zenoss.org/servlet/JiveServlet/download/3435-6-2917/ZenPacks.zenoss.LinuxMonitor-1.1.5-py2.6.egg.zip
      1. unzip
      2. zenpack --install ZenPacks.zenoss.LinuxMonitor-1.1.5-py2.6.egg
    4. wget http://community.zenoss.org/servlet/JiveServlet/download/3493-6-3219/ZenPacks.community.LinuxMonitorAddOn-1.0-py2.6.egg.zip
      1. unzip 
      2. zenpack --install ZenPacks.community.LinuxMonitorAddOn-1.0-py2.6.egg
    5. Restart zenoss so all stuff is picked up
      1. shouldn't be necessary, but Monitoring Templates were missing/erroring for me without
  2. Via web interface
    1. Drag-and-drop server from Device list into Interface -> Device classes -> Server -> SSH -> Linux
    2. Set that servers Configuration Properties
      1. zCommandUsername
      2. zCommandPassword
      3. This requires that you have at least one user that can SSH in via a password

Tuesday 4 June 2013

dead simple irc gui client

apt-get install lostirc

Sunday 2 June 2013

Fetch Cassandra keyspaces and column families from nodetool command via Ruby

#!/usr/bin/ruby

require 'logger'

log = Logger.new('/var/log/cassandra/repair.log', 'daily')
log.level = Logger::INFO
log.datetime_format = "%Y-%m-%d %H:%M:%S"

keyspaces = {}

result = %x[nodetool cfstats | egrep 'Keyspace:|Column Family:']
result = result.gsub(/\s/, '')
#log.debug(result.inspect)

result.split("Keyspace:").each do | keyspace |
  #log.debug(keyspace.inspect)
  keyname = keyspace.split("ColumnFamily:")[0]
  next if (keyname == nil)
  next if (keyname == 'OpsCenter' or keyname == 'system')
  #log.debug(keyname.inspect)
  cfs = keyspace.split("ColumnFamily:").drop(1)
  keyspaces[keyname] = cfs
end
#log.debug(keyspaces.inspect)

keyspaces.keys.each {|x|
  keyspaces[x].each do |y|
    log.info("Repair start: #{x} #{y}")
#    result = %x[nodetool getcompactionthreshold #{x} #{y}]
#    log.info(result)
    log.info("Repair end: #{x} #{y}")
  end
}

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...