Pro Yearly is on sale from $80 to $50! »

mkr + peco + tmux + ssh

mkr + peco + tmux + ssh

Mackerel Meetup #10 Tokyo

A658ec7f1badf73819dfa501165016c1?s=128

Yuuki Tsubouchi (yuuk1)

April 27, 2017
Tweet

Transcript

  1. mkr + peco + tmux + ssh ͸ͯͳ id:y_uuki Mackerel

    Meetup #10 Tokyo
  2. αʔϏεɾϩʔϧ໊Λ ͠΅Γ͜Έબ୒ͭͭ͠ɺ બΜͩϩʔϧͷϗετ܈ʹ ಉ࣌ϩάΠϯ

  3. αʔϏεɾϩʔϧ໊Λ ͠΅Γ͜Έબ୒ͭͭ͠ɺ બΜͩϩʔϧͷϗετ܈ʹ ಉ࣌ϩάΠϯ 5ඵ

  4. http://blog.yuuk.io/entry/tmux-ssh-mackerel

  5. mkr + tmux + ssh

  6. $ mkr hosts —service bookmark --role proxy

  7. $ mkr hosts —service bookmark --role proxy | jq -rM

    “.[].name"
  8. tssh = tmux + ssh https://github.com/yuuki/opstools/blob/master/tssh

  9. $ tssh $(mkr hosts —service bookmark --role proxy | jq

    -rM “.[].name")
  10. $ tssh $(roles bookmark proxy) (zsh functionԽ)

  11. ͸ͯͳʹ͸ϩʔϧ͕ͨ͘͞Μʂ 1000+ roles

  12. ϩʔϧ໊֮͑ͯͳ͍໰୊

  13. mkr + peco + tmux + ssh

  14. function peco-mkr-roles() { local selected_role=$(mkr services | jq -rM '[.[]

    | .name as $name | .roles // [] | map("\($name) \ (.)")] | flatten | .[]' | peco) if [ -n "${selected_role}" ]; then local BUFFER="tssh \`roles "$ {selected_role}"\`" fi zle clear-screen } zle -N peco-mkr-roles
  15. $ mkr services | jq -rM '[.[] | .name as

    $name | .roles // [] | map("\($name) \(.)")] | flatten | .[]' | peco
  16. pecoͰ ϩʔϧͷ͠΅Γ͜ΈΛ͔͚ͨޙ $ tssh $(roles bookmark proxy) Λ࣮ߦ

  17. 1. Ctrl + w (೚ҙ) 2. ϩʔϧҰཡදࣔ 3. ͠΅Γ͜Έબ୒ 4.

    tssh࣮ߦ
  18. 1. Ctrl + w (೚ҙ) 2. ϩʔϧҰཡදࣔ 3. ͠΅Γ͜Έબ୒ 4.

    tssh࣮ߦ 5ඵ
  19. None
  20. Mackerel API ☓ ͍ͭ΋࢖͍ͬͯΔ πʔϧ

  21. Mackerel API ☓ ͍ͭ΋࢖͍ͬͯΔ πʔϧ ΤϯδχΞΛ ϫΫϫΫͤ͞Δ