Aplicaciones de consola, terminal, ncurses

· osiux's blog


.org | .md | .gmi | .html

chat #

copias #

correo #

descargas #

disco #

editores #

explorador de archivos #

monitoreo #

top #

atop #

Es posible consultar el registro de un día en particular, por ejemplo qué procesos estaban consumiendo mayor acceso a disco el 24/01/2014 en el servidor tempranillo entre las 10 y 12hs:

1ssh tempranillo atop -r /var/log/atop/atop_20140121 -b 10:00 -e 12:00 -D | head -30

ATOP - tempranillo       2014/01/21  10:00:02       ------         10m0s elapsed
PRC | sys    4.15s | user   7.35s | #proc    255 | #zombie    0 | #exit    330 |
CPU | sys       1% | user      1% | irq       0% | idle    798% | wait      0% |
cpu | sys       0% | user      0% | irq       0% | idle     99% | cpu000 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu001 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu005 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu002 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu007 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu006 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu004 w  0% |
cpu | sys       0% | user      0% | irq       0% | idle    100% | cpu003 w  0% |
CPL | avg1    0.00 | avg5    0.01 | avg15   0.05 | csw   137938 | intr  135127 |
MEM | tot     3.8G | free   44.8M | cache   2.1G | buff  258.7M | slab  225.9M |
SWP | tot     4.0G | free    3.9G |              | vmcom   2.3G | vmlim   5.9G |
PAG | scan      84 | stall      0 |              | swin       0 | swout      0 |
DSK |         xvdb | busy      0% | read     171 | write    923 | avio 0.83 ms |
DSK |         xvda | busy      0% | read       8 | write   1095 | avio 0.22 ms |
NET | transport    | tcpi    3900 | tcpo    3845 | udpi     351 | udpo     372 |
NET | network      | ipi     4312 | ipo     3829 | ipfrw      0 | deliv   4295 |
NET | eth0    ---- | pcki    2153 | pcko    1670 | si    3 Kbps | so   18 Kbps |
NET | lo      ---- | pcki    2160 | pcko    2160 | si    5 Kbps | so    5 Kbps |

PID  SYSCPU  USRCPU  VGROW  RGROW  RDDSK  WRDSK ST EXC S  DSK CMD
3595   0.43s   0.61s     0K    28K     0K  2856K --   - S  19% mysqld
4400   0.02s   0.07s  1876K   152K  2180K    56K --   - S  15% imap
2573   0.01s   0.00s     0K     0K     0K  2164K --   - S  15% jbd2/xvdb-8
1358   0.01s   0.00s     0K     0K     0K  1732K --   - S  12% kjournald
2238   0.25s   0.89s   552K   596K     0K  1676K --   - R  11% /usr/sbin/amav

htop #

iftop #

iotop #

1ssh malbec 'sudo iotop -b -o -n 2 -d 5'
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
1552 be/4 root        0.00 B/s  815.89 B/s  0.00 %  0.00 % syslogd

ioping #

1ioping -c 5 /mnt/data
4096 bytes from /mnt/data (xfs /dev/mapper/data): request=1 time=20.8 ms
4096 bytes from /mnt/data (xfs /dev/mapper/data): request=2 time=0.6 ms
4096 bytes from /mnt/data (xfs /dev/mapper/data): request=3 time=0.6 ms
4096 bytes from /mnt/data (xfs /dev/mapper/data): request=4 time=0.6 ms
4096 bytes from /mnt/data (xfs /dev/mapper/data): request=5 time=0.6 ms

--- /mnt/data (xfs /dev/mapper/data) ioping statistics ---
5 requests completed in 4023.8 ms, 216 iops, 0.8 mb/s
min/avg/max/mdev = 0.6/4.6/20.8/8.1 ms

mon #

monit #

munin #

mtr #

1mtr -r -c 5 -n osiux.com
HOST: amaretto                    Loss%   Snt   Last   Avg  Best  Wrst StDev
1.|-- 192.168.10.3               0.0%     5    0.2   0.2   0.2   0.2   0.0
2.|-- 10.29.64.1                 0.0%     5    7.3   7.3   6.9   8.0   0.4
3.|-- 181.47.254.17              0.0%     5    8.4   8.4   7.1   9.8   1.0
4.|-- 208.178.195.210            0.0%     5    9.4  10.1   8.8  11.9   1.4
5.|-- 208.178.195.209            0.0%     5    7.5   7.8   7.0   9.1   0.9
6.|-- 67.16.142.93               0.0%     5  171.9 175.3 170.2 192.6   9.7
7.|-- 204.93.144.25              0.0%     5  171.4 178.4 171.4 201.7  13.1
8.|-- 204.93.204.153            40.0%     5  173.3 174.2 173.3 174.6   0.8
9.|-- 50.31.170.122              0.0%     5  180.6 180.9 179.6 183.6   1.6
10.|-- 206.217.137.250            0.0%     5  181.1 182.3 179.5 188.5   3.6
11.|-- 96.8.118.251              20.0%     5  178.4 178.0 176.9 178.7   0.8
12.|-- 96.8.118.129              20.0%     5  181.5 182.2 181.5 183.0   0.6

sysstat #

vnstat #

  1. top 10
1ssh osiux 'vnstat -i venet0 -t'
venet0  /  top 10

#      day          rx      |     tx      |    total    |   avg. rate
-----------------------------+-------------+-------------+---------------
1   03/19/13       4.09 GiB |   64.21 GiB |   68.30 GiB |    6.63 Mbit/s
2   03/20/13     930.99 MiB |   23.57 GiB |   24.48 GiB |    2.38 Mbit/s
3   11/09/13       3.58 GiB |   18.64 GiB |   22.23 GiB |    2.16 Mbit/s
4   03/26/13       1.02 GiB |   18.19 GiB |   19.22 GiB |    1.87 Mbit/s
5   03/25/13     735.60 MiB |   16.55 GiB |   17.27 GiB |    1.68 Mbit/s
6   03/27/13     695.73 MiB |   13.61 GiB |   14.29 GiB |    1.39 Mbit/s
7   03/21/13     700.46 MiB |   13.58 GiB |   14.26 GiB |    1.38 Mbit/s
8   04/09/13     648.98 MiB |   13.32 GiB |   13.95 GiB |    1.35 Mbit/s
9   01/07/14      13.21 GiB |  356.93 MiB |   13.56 GiB |    1.32 Mbit/s
10   07/03/13     830.55 MiB |   12.69 GiB |   13.50 GiB |    1.31 Mbit/s
-----------------------------+-------------+-------------+---------------
  1. vista mensual
1ssh osiux 'vnstat -i venet0 -m'
venet0  /  monthly

month        rx      |     tx      |    total    |   avg. rate
------------------------+-------------+-------------+---------------
Mar '13     16.50 GiB |  190.62 GiB |  207.12 GiB |  648.70 kbit/s
Apr '13     20.32 GiB |  125.04 GiB |  145.36 GiB |  470.42 kbit/s
May '13     15.09 GiB |    6.23 GiB |   21.33 GiB |   66.79 kbit/s
Jun '13     15.15 GiB |   10.28 GiB |   25.43 GiB |   82.29 kbit/s
Jul '13     19.02 GiB |   19.53 GiB |   38.55 GiB |  120.75 kbit/s
Aug '13     24.59 GiB |   21.24 GiB |   45.83 GiB |  143.53 kbit/s
Sep '13     15.25 GiB |    8.18 GiB |   23.43 GiB |   75.84 kbit/s
Oct '13     26.23 GiB |   25.19 GiB |   51.42 GiB |  161.03 kbit/s
Nov '13     10.20 GiB |   30.08 GiB |   40.28 GiB |  130.36 kbit/s
Dec '13      1.67 GiB |    9.41 GiB |   11.08 GiB |   34.69 kbit/s
Jan '14     25.88 GiB |    7.73 GiB |   33.61 GiB |  105.25 kbit/s
Feb '14      4.46 GiB |    2.76 GiB |    7.22 GiB |   70.61 kbit/s
------------------------+-------------+-------------+---------------
estimated     12.57 GiB |    7.79 GiB |   20.36 GiB |
  1. vista semanal
1ssh osiux 'vnstat -i venet0 -w'
venet0  /  weekly

rx      |     tx      |    total    |   avg. rate
---------------------------+-------------+-------------+---------------
last 7 days      3.16 GiB |    2.30 GiB |    5.46 GiB |   76.48 kbit/s
last week      3.19 GiB |    2.19 GiB |    5.39 GiB |   74.70 kbit/s
current week    418.63 MiB |  265.81 MiB |  684.44 MiB |   70.05 kbit/s
---------------------------+-------------+-------------+---------------
estimated      3.12 GiB |    1.98 GiB |    5.09 GiB |
  1. vista por horas
1ssh osiux 'vnstat -i venet0 -h'
venet0                                                                   22:14
^                                                                       r
|                                                                       r
|  r  r  r  r  r  r  r  r  r  r                                         r
|  r  r  r  r  rt r  r  r  r  r                                         r
|  r  r  r  r  rt r  r  r  r  r                           t             r
|  r  r  r  r  rt r  r  r  r  rt                          t        t    r
|  rt r  r  r  rt r  rt r  r  rt                          t  t     t    r
|  rt r  r  r  rt r  rt rt r  rt                       t  t  t     t    r
|  rt rt rt r  rt r  rt rt r  rt              t  t     t  t  t     t    r
|  rt rt rt r  rt r  rt rt r  rt        t  t  t  t  t  t  t rt  t  t  t r
-+--------------------------------------------------------------------------->
|  23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22

h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)
23      38043      18600    07      39022       3080    15       1618       6379
00      39348       9530    08      38429      23452    16       2715      17279
01      39080      10637    09       1997       3372    17       3533      27827
02      38853       3011    10       2148       3307    18       4522      21075
03      38293      32727    11       1117       5484    19       2201       6809
04      38632       4056    12       2979       7545    20       4449      23659
05      39518      18170    13       2040      10555    21       2587       8113
06      37873      14265    14       3063      10136    22      44656       1721

multitail #

logcheck #

musica #

red #

rss #

seguridad #

utilitarios #

versionado #

ssh #

parallel-ssh #

Armamos un listado con los hostnames de cada servidor y lo guardarmos en un archivo, por ejemplo en ~/.ssh/gcoop, ahora solo falta indicar el comando a ejecutar uptime en este caso y listo!

1parallel-ssh -i -h ~/.ssh/gcoop uptime | tee
[1] 13:14:09 [SUCCESS] redmine
13:13:37 up 6 days, 12:08,  0 users,  load average: 0.00, 0.02, 0.00
[2] 13:14:09 [SUCCESS] mysqlcentos
13:13:37 up 6 days, 12:38,  0 users,  load average: 0.00, 0.00, 0.00
[3] 13:14:09 [SUCCESS] torrontes
13:13:37 up 37 days, 22:39,  0 users,  load average: 0.20, 0.21, 0.22
[4] 13:14:09 [SUCCESS] ssug0003lx
13:13:37 up 6 days, 12:11,  0 users,  load average: 0.00, 0.00, 0.00
[5] 13:14:09 [SUCCESS] squeeze
13:13:37 up 6 days, 12:16,  0 users,  load average: 0.00, 0.00, 0.00
[6] 13:14:09 [SUCCESS] symfony
13:13:37 up 6 days, 12:25,  0 users,  load average: 0.00, 0.00, 0.00
[7] 13:14:09 [SUCCESS] tempranillo
13:13:37 up 67 days, 17:51,  0 users,  load average: 0,07, 0,09, 0,06
[8] 13:14:09 [SUCCESS] malbec
13:13:50 up 37 days, 22:45,  0 users,  load average: 0.01, 0.58, 0.57
[9] 13:14:09 [SUCCESS] merlot
13:13:59 up 97 days,  4:57,  0 users,  load average: 0.28, 0.12, 0.05
[10] 13:14:12 [FAILURE] recibos Exited with error code 255
Stderr: ssh_exchange_identification: Connection closed by remote host