Live data from Hacker News

Devops/Sysadmin Cheatsheet

rubytune.com

41–50 of 110 posts

Re: Devops/Sysadmin Cheatsheet

#42

Great list. A few more (related or building on those there) Quick mysql "why is my database under so much load suddenly" that doesn't rely on the slow query log: pt-query-digest --processlist h= --interval=0.01 --print > /tmp/queries.out pt-query-digest /tmp/queries.out Tracking down what files exactly are filling up the disk. Go to /, and follow the big numbers: du -smc * Combine strace (for the file handle no), lso…

I prefer using tcpdump instead of processlist when dealing with pt-query-digest. You get everything instead of just what happens to show up during the interval specified. This is, of course, assuming that you don't allow localhost socket connections.

Very true - extremely fast queries can slip between the processlist checks. The problem I've encountered with tcpdump is that you can cause packet loss by running it. It's not common, but it happens enough that I've become gun shy about using it on production systems.

The pt-query-digest function will cause additional load on the DB, but it won't interrupt communications.

Re: Devops/Sysadmin Cheatsheet

#43
post #9

I would warn anyone that read this to understand what each command does before actually running anything on a machine. Things like "sudo !!" are INCREDIBLY dangerous, and I would never put that on a cheat sheet.

I use this one like a dozen times a day. user@host$ less /var/log/syslog Permission Denied crap... $ sudo !! sudo less /var/log/syslog Woo!

why would that be bad? You would get to read your file.

Re: Devops/Sysadmin Cheatsheet

#44
post #16

Some random thoughts: - Instead of 'while true;' you can use the shorter 'while :;'. ':' is a null command. - On OS X, dtruss is kinda, sorta like strace (it's a wrapper around dtrace, and the dtruss name comes from Solaris). - For basic host to IP resolution, I prefer ping as it calls gethostbyname(), like most other programs will do. host/dig are suitable for querying/testing DNS independent of how the local box is…

THANK YOU for the insight and effort. Enlightening. Updated the find, MUCH better. Will play with the others and modify the sheet as I go!

Re: Devops/Sysadmin Cheatsheet

#45

Great list. A few more (related or building on those there) Quick mysql "why is my database under so much load suddenly" that doesn't rely on the slow query log: pt-query-digest --processlist h= --interval=0.01 --print > /tmp/queries.out pt-query-digest /tmp/queries.out Tracking down what files exactly are filling up the disk. Go to /, and follow the big numbers: du -smc * Combine strace (for the file handle no), lso…

Thanks for that! I'll take a look at the pt-query-digest stuff again and add!

Re: Devops/Sysadmin Cheatsheet

#47

There's a few typos in this, in case it helps: ps auxww -> ps auxww -H (H is hierarchy) Faster than lsof, and only displays files - although most things in unix are files! lsof -p -> ls -l /proc/$PID/fd Run something forever watch command Overview of all disks du should be df. Find files over 100mb find . -size +100M Low hanging fruit for size ls -al | sort -nk5 Files created (modified) within the past 7 days: find .…

Thanks for catching the ps aux and for the refinements! Deploying new version now...

Re: Devops/Sysadmin Cheatsheet

#48

[Edit oh gads I see now the commands are in text boxes and the full command is not visible. It is "ps aux | head -1 && ps aux | sort -k 4 -nr | head" which maybe correct is even more ridiculous.] > ps aux | head -1 && ps aux | sort Is a wasteful construct and doesn't even do what is claimed "List the top 10 memory hogs". Depending on what you consider "memory" something like this is shorter and correct. ps aux --sort…

Thanks! I've updated that with your version, much MUCH more concise. (Also fixed the df thing, definitely copy paste error!)

Re: Devops/Sysadmin Cheatsheet

#49
post #16

Some random thoughts: - Instead of 'while true;' you can use the shorter 'while :;'. ':' is a null command. - On OS X, dtruss is kinda, sorta like strace (it's a wrapper around dtrace, and the dtruss name comes from Solaris). - For basic host to IP resolution, I prefer ping as it calls gethostbyname(), like most other programs will do. host/dig are suitable for querying/testing DNS independent of how the local box is…

You can use TCP/UDP/GRE for your traceroute packets with the -P switch:

traceroute -P udp

This is super useful if you're probing a network that's hostile to ICMP packets - it's a lot more reliable than ICMP in many scenarios, from my experience.

Re: Devops/Sysadmin Cheatsheet

#50
post #18

Okay, I'll admit it. I don't actually know what devops is. I know what developers do and what sysadmins do. Is devops just a buzzword for one person who can do both? Or does it mean something other than that?

I'm the author of this cheatsheet and I have no clue really. Just wanted to try the word out, see if it felt right.

But yes, my impression is that it's normally a developer who "trends towards doing systems administration" – so someone who knows the codebase, but can provision and wrangle servers. So, someone like me (I write full stack apps, but my "speciality" is the server end of things).

Post reply on HN