Sublime Text 2 – Save All KeyBinding
Easier Way The easier way and cleaner way is to set the user keybinding instead of mess with the defaults. The user keybindings override the default key binds. Here I change myRead More…
Easier Way The easier way and cleaner way is to set the user keybinding instead of mess with the defaults. The user keybindings override the default key binds. Here I change myRead More…
IFS Variable $IFS is the linux delimiter character its used in for loops. $IFS by default just hold a space character, thus the for loop will iterate over items with spaces. EachRead More…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
######################## ######################## # MAKING COLONY GRAPHS # ######################## ######################## # All credit goes to Brendan, here is why: # Thanks to Brendan Gregg on his website he has this (he invented this): http://www.brendangregg.com/ColonyGraphs/cloud.html I just rewrote it so that I can remember it and study it. Also I have added some added variations so that linux users can play around as well (very simple ps line). Anyhow this persons the system performance linux/unix God, so i trust this as a great method to get a snapshot of processes. You can use this process to get a pic of every process on your server/rack/datacenter. # / startrant # Brendan Greggs work is something every linux/unix geek/nerd should look into. Brendan if you see this, thank you! I want to read your Biography if you have one (its prob on your site, havent looked deep enough yet - nvm... just noticed it on your site). But I want to know how you started learning all this so that I can follow in your footsteps! Also please give me the code on how to make the gif versions that utilizes the "present" variable so i can make visualized models. Im positive this will help everyone! Infact I think I will send you an email on this topic. # / endrant |
Colony Graph of Processes on My Readynas 312 Colony Graphs of my Readynas 312 (Click to See)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# Here is his site: http://www.brendangregg.com/ColonyGraphs/cloud.html # Your about to embark on making this apt-get install graphviz apt-get install awk # wget the files necessary for this from brendan greggs site: wget http://www.brendangregg.com/ColonyGraphs/ps2gv-p.sh wget http://www.brendangregg.com/ColonyGraphs/colors.awk # if links down - source code of those files below # since linux and mac dont really use zone files, we manually add them in # in linux: ps -o ppid,pid,rss,pcpu,comm x | awk '{ print "-", $0 }' > ps.txt # in mac: ps -eo ppid,pid,rss,pcpu,comm | awk '{ print "-", $0 }' > ps.txt # in solaris: ps -eo zone,ppid,pid,rss,pcpu,comm > ps.txt # basically if your sys doesnt support zones, then your ps output should be like this (not including awk): PPID PID RSS %CPU COMMAND 0 1 3772 0.0 systemd 0 2 0 0.0 kthreadd 2 3 0 0.0 ksoftirqd/0 2 6 0 0.0 migration/0 2 7 0 0.0 watchdog/0 2 8 0 0.0 migration/1 # after the awk command the final txt file should look like this (this is the ps and awk): - PPID PID RSS %CPU COMMAND - 0 1 3768 0.0 systemd - 0 2 0 0.0 kthreadd - 2 3 0 0.0 ksoftirqd/0 - 2 6 0 0.0 migration/0 - 2 7 0 0.0 watchdog/0 - 2 8 0 0.0 migration/1 # and if it does support zones, it should be like this: ZONE PPID PID RSS %CPU COMMAND global 0 0 0 0.0 sched global 0 1 1284 0.0 /sbin/init global 0 2 0 0.0 pageout global 0 3 0 0.1 fsflush global 1 159 1672 0.0 /usr/lib/power/powerd global 1 39 19560 0.0 /lib/svc/bin/svc.startd # generate .gv file (an ascii file with dot info) ./ps2gv-p.sh ps.txt # note if had several "ps.txts" you can combine them like this ./ # generate pictures neato -Tpng -Nfontsize=12 -Elen=1.9 ps.gv -o ps.png # NOTE FROM DEV: # Adjust -Nfontsize and -Elen (edge length) as desired. You can also customize the colors.awk file, which maps process names to colors. It uses gray if a mapping isn't present. There is also setting in ps2gv-p.sh, cpulimit, which adjusts the scaling of the node sizes. ############### # ps2gv-p.sh # ############### #!/bin/sh # # ps2gv-p.sh ptree info to graphvis, with present column. # # USAGE: ps2gv-p.sh ptree1.txt [...] # # Converts provided ptree input files to .gv files. The input file has the # following format (space or tab delimitered): # # zonename ppid pid rss pcpu comm [present=1] # # Which can be generated using "ps -eo zone,ppid,pid,rss,pcpu,comm". # If your OS does not have the zone field, then add a dummy field using awk, # or edit this script to drop it. The final optional column, present, can be # post-generated using perl, and is used for animated sequences. # # See: http://www.brendangregg.com/ColonyGraphs/cloud.html hidezone=1 # convert zonenames to "zone-000n" cpulimit=10 # scale node size from 0 to cpulimit percent # For an OS where a single busy process shows pcpu as 100%, such as Linux, # cpulimit can be set to 100. You may want to use smaller values, eg, 10, to # emphasize smaller CPU consumers. For OSes where pcpu is the average across # all CPUs, eg, Solaris, you will want to make cpulimit much smaller (divide # by number of CPUs). for infile in $*; do outfile=${infile%.txt}.gv echo processing $infile '->' $outfile echo $outfile ( echo 'digraph ptree {' echo 'node [ style = filled ];' cat $infile | awk ' BEGIN { curzone = ""; '"`cat colors.awk`"' hidezone = '$hidezone' cpulimit = '$cpulimit' } $1 != curzone { curzone = $1 } $3 > 10 && $3 != "PID" { ppid = $2 pid = $3 realppid = ppid gsub(/.*-/, "", realppid) cpu = $5 if (cpu == "-") { cpu = "0" } comm = $6 present = $7; if (realppid == 1) { realzone = curzone gsub(/.*-/, "", realzone) ppid = ppid "-" realzone if (hidezone && !hidezonemask[curzone]) { hidezonemask[curzone] = 1 zoneid++ printf " \"%s\" [ label = \"zone-%05d\" ];\n", ppid, zoneid } } gsub(/^\/.*\//, "", comm) colortxt = "" if (comm2color[comm] != "") { colortxt = "color = \"" comm2color[comm] "\" " } # animation, if column provided: if (present != "" && present == "0") { colortxt = colortxt " style = \"invis\"" } # node size, based an pcpu: if (cpu < 0.1) { sizetxt = "" } else { if (cpu > cpulimit) { cpu = cpulimit; } ratio = cpu / cpulimit; width = sprintf("%.2f", 1 + 1.8 * ratio); height = sprintf("%.2f", 0.7 + 2.3 * ratio); sizetxt = " width = \"" width " \" height = \"" height "\" " } print " \"" ppid "\" -> \"" pid "\" [ " colortxt " ];" print " \"" pid "\" [ label = \"" comm "\" " colortxt sizetxt " ];" } ' echo '}' ) > $outfile done ############## # colors.awk # ############## # web comm2color["httpd"] = "palevioletred3"; comm2color["nginx"] = "palevioletred3"; comm2color["zeus.zxtm"] = "palevioletred3"; comm2color["zeus.monitor"] = "palevioletred3"; comm2color["zeus.eventsd"] = "palevioletred3"; comm2color["zeus.admin"] = "palevioletred3"; comm2color["zeus.eventd"] = "palevioletred3"; comm2color["zeus.flipper"] = "palevioletred3"; comm2color["curl"] = "palevioletred3"; comm2color["wget"] = "palevioletred3"; # databases comm2color["mysqld"] = "orchid"; comm2color["./mysqld"] = "orchid"; comm2color["mysql"] = "orchid"; comm2color["mysqladmin"] = "orchid"; comm2color["memcached"] = "orchid"; comm2color["riak"] = "orchid"; # languages comm2color["ruby"] = "palegreen3"; comm2color["ruby18"] = "palegreen3"; comm2color["php"] = "palegreen3"; comm2color["php5-cgi"] = "palegreen3"; comm2color["php-cgi"] = "palegreen3"; comm2color["perl"] = "palegreen3"; comm2color["miniperl"] = "palegreen3"; comm2color["python"] = "palegreen3"; comm2color["python2.5"] = "palegreen3"; comm2color["python2.6"] = "palegreen3"; comm2color["java"] = "palegreen3"; comm2color["erl"] = "palegreen3"; comm2color["run_erl"] = "palegreen3"; comm2color["beam.smp"] = "palegreen3"; comm2color["Beam.smp"] = "palegreen3"; # user comm2color["screen"] = "olivedrab3"; comm2color["vi"] = "olivedrab3"; comm2color["vim"] = "olivedrab3"; comm2color["emacs"] = "olivedrab3"; comm2color["ssh"] = "olivedrab3"; comm2color["firefox"] = "olivedrab3"; comm2color["Google"] = "olivedrab3"; # compiler comm2color["gcc"] = "peachpuff3"; comm2color["ld"] = "peachpuff3"; # other comm2color["sendmail"] = "skyblue3"; comm2color["nrpe"] = "skyblue3"; comm2color["master"] = "skyblue3"; comm2color["qmgr"] = "skyblue3"; comm2color["tslmgr"] = "skyblue3"; comm2color["pickup"] = "skyblue3"; comm2color["zabbix"] = "skyblue3"; comm2color["zabbix_agentd"] = "skyblue3"; comm2color["rrdtool"] = "skyblue3"; comm2color["couriertls"] = "skyblue3"; comm2color["couriertcpd"] = "skyblue3"; comm2color["courierlogger"] = "skyblue3"; #comm2color["authdaemond"] = "skyblue3"; comm2color["imapd"] = "skyblue3"; comm2color["postgres"] = "skyblue3"; comm2color["authdeamond"] = "skyblue3"; comm2color["smtp"] = "skyblue3"; # highlight comm2color["iperf"] = "lightsalmon"; comm2color["bonnie"] = "lightsalmon"; comm2color["bonnie++"] = "lightsalmon"; comm2color["sysbench"] = "lightsalmon"; comm2color["top"] = "lightsalmon"; # shell scripting comm2color["cat"] = "lightblue3"; comm2color["ggrep"] = "lightblue3"; comm2color["grep"] = "lightblue3"; comm2color["sed"] = "lightblue3"; comm2color["awk"] = "lightblue3"; comm2color["gawk"] = "lightblue3"; comm2color["head"] = "lightblue3"; comm2color["tail"] = "lightblue3"; comm2color["cut"] = "lightblue3"; comm2color["wc"] = "lightblue3"; comm2color["basename"] = "lightblue3"; comm2color["dirname"] = "lightblue3"; comm2color["hostname"] = "lightblue3"; comm2color["uname"] = "lightblue3"; comm2color["dc"] = "lightblue3"; comm2color["bc"] = "lightblue3"; comm2color["date"] = "lightblue3"; comm2color["sleep"] = "lightblue3"; # unused: lightcyan3 # system comm2color["zlogin"] = "paleturquoise3"; comm2color["sh"] = "paleturquoise3"; comm2color["sshd"] = "paleturquoise3"; comm2color["bash"] = "paleturquoise3"; comm2color["-bash"] = "paleturquoise3"; comm2color["login"] = "paleturquoise3"; comm2color["init"] = "paleturquoise3"; comm2color["fsflush"] = "paleturquoise3"; comm2color["pageout"] = "paleturquoise3"; comm2color["sulogin"] = "paleturquoise3"; comm2color["<defunct>"] = "paleturquoise3"; comm2color["rotatelogs"] = "paleturquoise3"; comm2color["zoneadmd"] = "paleturquoise3"; comm2color["ttymon"] = "paleturquoise3"; comm2color["syseventd"] = "paleturquoise3"; comm2color["fmd"] = "paleturquoise3"; comm2color["devfsadmd"] = "paleturquoise3"; comm2color["ntpd"] = "paleturquoise3"; comm2color["rcapd"] = "paleturquoise3"; comm2color["in.ndpd"] = "paleturquoise3"; comm2color["picld"] = "paleturquoise3"; comm2color["ldap_cachemgr"] = "paleturquoise3"; comm2color["dlmgmtd"] = "paleturquoise3"; comm2color["sac"] = "paleturquoise3"; comm2color["ps"] = "paleturquoise3"; comm2color["sort"] = "paleturquoise3"; comm2color["nscd"] = "paleturquoise3"; comm2color["ttymod"] = "paleturquoise3"; comm2color["lockd"] = "paleturquoise3"; comm2color["statd"] = "paleturquoise3"; comm2color["poold"] = "paleturquoise3"; comm2color["lockd"] = "paleturquoise3"; comm2color["svc.startd"] = "paleturquoise3"; comm2color["svc.configd"] = "paleturquoise3"; comm2color["cron"] = "paleturquoise3"; comm2color["inetd"] = "paleturquoise3"; comm2color["utmpd"] = "paleturquoise3"; comm2color["syslogd"] = "paleturquoise3"; comm2color["zsched"] = "paleturquoise3"; comm2color["kcfd"] = "paleturquoise3"; comm2color["snmpd"] = "paleturquoise3"; comm2color["rpcbind"] = "paleturquoise3"; color2trans["palevioletred3"] = "#cd68893f"; color2trans["orchid"] = "#da70d63f"; color2trans["palegreen3"] = "#7ccd7c3f"; color2trans["olivedrab3"] = "#9acd323f"; color2trans["peachpuff3"] = "#cdaf953f"; color2trans["skyblue3"] = "#6ca6cd3f"; color2trans["lightsalmon"] = "#ffa07a3f"; color2trans["lightblue3"] = "#9ac0cd3f"; color2trans["paleturquoise3"] = "#96cdcd3f"; color2hex["palevioletred3"] = "#cd6889"; color2hex["orchid"] = "#da70d6"; color2hex["palegreen3"] = "#7ccd7c"; color2hex["olivedrab3"] = "#9acd32"; color2hex["peachpuff3"] = "#cdaf95"; color2hex["skyblue3"] = "#6ca6cd"; color2hex["lightsalmon"] = "#ffa07a"; color2hex["lightblue3"] = "#9ac0cd"; color2hex["paleturquoise3"] = "#96cdcd"; |
A Snoopy How To – plus a mini explanation to linux libraries Snoopy works for linux (it might also work for unix, im not sure). Here is watch_execve which works for FreeBSD: http://ram.kossboss.com/snoppy-freebsd-watch_execve-watch-command-executions-freebsd/Read More…
Monitoring Commands (top program for this) Click here to see my new discovery (thanks to a user on reddit for helping me find this) SNOOPY Here is watch_execve which works for FreeBSD: http://ram.kossboss.com/snoppy-freebsd-watch_execve-watch-command-executions-freebsd/Read More…
SNTP and NTP use the same protocol on the wire “Ethernet Time Server” messages to compute accurate times. The difference is in the application that is running on each PC. The differenceRead More…
HOW TO LOWER MOUSE SENSITIVITY IN UBUNTU 12.04 OR IN ANY XSERVER DESKTOP Im using Unity, and also XFCE (mostly XFCE as this laptop is under powered). I have a wireless HPRead More…
Text Compressor: http://www.unit-conversion.info/texttools/compress/ This takes text and converts it to compressed text (using all characters excluding none printable characters and spaces, so only keyboard characters are used) For example here is aRead More…
INSTALLING LATEST BTRFS-TOOLS WITH TROUBLESHOOTING TOOLS: I got these instructions from: http://www.funtoo.org/BTRFS_Fun INSTALL NORMAL TOOLS Note might need these dependencies:
1 |
# apt-get install uuid-dev libattr1-dev zlib1g-dev libacl1-dev e2fslibs-dev libblkid-dev liblzo2-dev |
To install regular tools (none experimental):
1 2 3 4 5 |
# mkdir ~/src # git clone git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git # cd btrfs-progs # make # make install |
INSTALL BONUS TOOLS To getRead More…
From What I have watched My favorite so far: The Wire The Walking Dead True Detective Dexter (went bad last Season, the rest was good- especially season 4) Game Of Thrones WhyRead More…