Saturday, May 1, 2010

CTS System - Basic Linux Tools - Part I

  • Basic checks:
When troubleshooting CTS performance, Linux embedded OS provide a powerful set of tools which will help you to verify system resources utilization:
This guide provides a basic list of tools which will help you troubleshoot your CTS system.
Some of the commands described in our Administration guide provide the same functionality, as they just invoke in the backend the same Linux commands:

http://www.cisco.com/en/US/partner/docs/telepresence/cts_admin/1_6/CLI/cts1_6cli.html

  • System status

date
uptime
CTS:>cat /proc/version
Linux version 2.6.11 (root@TSBU-ENG2.CISCO.COM) (gcc version 3.4.3) #1 Tue Feb 24 03:59:58 UTC 2009

http://www.unixguide.net/linux/linuxshortcuts.shtml


In Linux, a variety of log files are maintained. And its understanding is often vital for troubleshooting system problems. The centralized logging is provided by two daemons :

    * syslogd
    * klogd

For example, running the 'ps' command on my system gives the following output ...

CTS:>ps aux|grep [sk]*logd
  400 root        748 S   /usr/sbin/syslogd
  405 root        524 S   /usr/sbin/klogd
 2271 root        468 S   /usr/local/bin/clogd

The log files generated by these daemons as well as the log files generated by the applications like apache, squid etc are stored under the /var/log directory

  • Memory:
http://mail.nl.linux.org/linux-mm/2003-03/msg00077.html

Running Process:
    ps

    CTS:>ps --help
    BusyBox v1.00-pre8 (2009.02.24-04:32+0000) multi-call binary

    Usage: ps
    Report process status

    This version of ps in CTS accepts no option.
    We can use grep to track specific processes

    CTS:>ps | grep snmpd
     3499 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3517 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3518 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3527 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3528 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3529 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     3530 root       6824 S   snmpd -LS e d -LF n /var/log/snmpdlogPipe -p /var/run
     2851 root        576 S < grep snmpd

    cat /proc/$pid/status

    Check free Memory:

    CTS:>free
                  total         used         free       shared      buffers
      Mem:       516180       494196        21984            0       392900
     Swap:            0            0            0
    Total:       516180       494196        21984

    CTS:>top
    Mem: 494260K used, 21920K free, 0K shrd, 392900K buff, 38816K cached
    Load average: 0.02, 0.16, 0.20    (State: S=sleeping R=running, W=waiting)

      PID USER     STATUS   RSS  PPID %CPU %MEM COMMAND
     4312 root     R <      736 14281  1.9  0.1 top
      678 root     S        28M   208  0.0  5.7 tsLogger
      550 root     S        28M   208  0.0  5.7 tsLogger
      205 root     S        28M     1  0.0  5.7 tsLogger
      298 root     S        28M   208  0.0  5.7 tsLogger
      555 root     S        28M   208  0.0  5.7 tsLogger
      578 root     S        28M   208  0.0  5.7 tsLogger
      212 root     S        28M   208  0.0  5.7 tsLogger
      210 root     S        28M   208  0.0  5.7 tsLogger
      299 root     S        28M   208  0.0  5.7 tsLogger
     1102 root     S        28M   208  0.0  5.7 tsLogger
      446 root     S        28M   208  0.0  5.7 tsLogger
      532 root     S        28M   208  0.0  5.7 tsLogger
      449 root     S        28M   208  0.0  5.7 tsLogger
      209 root     S        28M   208  0.0  5.7 tsLogger
      602 root     S        28M   208  0.0  5.7 tsLogger
      208 root     S        28M   205  0.0  5.7 tsLogger
      447 root     S        28M   208  0.0  5.7 tsLogger
      211 root     S        28M   208  0.0  5.7 tsLogger

    pidof
    ps | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
     

    S=sleeping R=running, W=waiting)

    • Storage 
    CTS:>fdisk -l
      Disk /dev/hda: 256 MB, 256901120 bytes
      16 heads, 32 sectors/track, 980 cylinders
      Units = cylinders of 512 * 512 = 262144 bytes

         Device Boot    Start       End    Blocks   Id  System
      /dev/hda1               1           9        2288   83  Linux
      /dev/hda2              10         193       47104   83  Linux
      /dev/hda3             194         980      201472    5  Extended
      /dev/hda5             194         377       47088   83  Linux
      /dev/hda6             378         561       47088   83  Linux
      /dev/hda7             562         980      107248   83  Linux

      CTS:>df -h
      Filesystem            Size  Used Avail Use% Mounted on
      rootfs                248M  148M  100M  60% /
      /dev/root             248M  148M  100M  60% /
      /dev/hda7             101M   28M   68M  29% /nv

      CTS:>pwd

      CTS:>du --max-depth=1 -h
      du: ./sys/devices/pci0001:01/0001:01:00.0/resource1: Value too large for defined data type
      0       ./sys
      5.8M    ./bin
      1.0k    ./boot
      17k     ./dev
      259k    ./etc
      1.0k    ./home
      36M     ./lib
      9.0k    ./mnt
      du: cannot change to directory ./proc/1118/task: No such file or directory
      du: cannot change to directory ./proc/1118/fd: No such file or directory
      du: ./proc/1119/task/1119/fd/4: No such file or directory
      du: ./proc/1119/fd/4: No such file or directory
      9.7M    ./proc
      11k     ./root
      3.6M    ./sbin
      439k    ./tmp
      79M     ./usr
      20M     ./var
      0       ./debug
      28M     ./nv
      5.0k    ./nv-cache
      3.0k    ./snmp
      184M    .
      • Processor | CPU
      cat /proc/cpuinfo
      • Network
      This command will help you displaying the association for active network connections and its corresponding executable file

      netstat -anp
      • CTS specific tools:
      runtbdiag -n (--- DONT RUN when there is AN ACTIVE CALL ---)
      tbdiag

      When CTS logs are not available to retrieve and we need to find specific patterns before we can afford a reboot grep becomes a useful tool
      For example we want to find exception in CLI commands executed from regular CLI access
      CTS:>pwd
      /nv/log/cli

      grep -i -n 'cmdGeneralIOExec: myCmd.destroy exception' /nv/log/cli/*
      /nv/log/cli/cli00000.log:34:2010-02-10 23:36:58,579 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:42:2010-02-12 11:29:27,116 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:58:2010-02-12 11:29:35,711 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:75:2010-02-12 11:29:41,111 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:93:2010-02-12 11:29:45,653 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:109:2010-02-12 11:30:44,192 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:125:2010-02-12 11:30:49,098 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:146:2010-02-12 11:31:02,991 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:163:2010-02-12 11:31:11,710 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:184:2010-02-12 11:36:21,453 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:205:2010-02-12 11:36:33,361 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:225:2010-02-12 11:37:04,425 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:245:2010-02-12 11:37:26,638 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:264:2010-02-12 11:38:36,594 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:280:2010-02-12 11:38:58,656 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:298:2010-02-12 11:39:22,262 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception
      /nv/log/cli/cli00001.log:318:2010-02-12 11:39:54,417 DEBUG [main] - cmdGeneralIOExec: myCmd.destroy exception

      Please check

      http://mytelepresence.blogspot.com/2010/04/telepresence-system-collect-logs-when.html

      for more information in how to collect logs when GUI is not available

      No comments:

      Post a Comment