BCC - Linux പെർഫോമൻസ് മോണിറ്ററിംഗ്, നെറ്റ്uവർക്കിംഗ് എന്നിവയ്uക്കായുള്ള ഡൈനാമിക് ട്രെയ്uസിംഗ് ടൂളുകൾ
BCC (BPF കംപൈലർ കളക്ഷൻ) എന്നത് വിഭവസമൃദ്ധമായ കേർണൽ ട്രെയ്uസിംഗും കൃത്രിമത്വ പ്രോഗ്രാമുകളും സൃഷ്ടിക്കുന്നതിനുള്ള ഉചിതമായ ഉപകരണങ്ങളുടെയും ഉദാഹരണ ഫയലുകളുടെയും ശക്തമായ ഒരു കൂട്ടമാണ്. ഇത് വിപുലീകൃത ബിപിഎഫ് (ബെർക്ക്uലി പാക്കറ്റ് ഫിൽട്ടറുകൾ) ഉപയോഗിക്കുന്നു, തുടക്കത്തിൽ eBPF എന്നറിയപ്പെടുന്നു, ഇത് Linux 3.15 ലെ പുതിയ സവിശേഷതകളിൽ ഒന്നായിരുന്നു.
പ്രായോഗികമായി, BCC ഉപയോഗിക്കുന്ന മിക്ക ഘടകങ്ങളും Linux 4.1 അല്ലെങ്കിൽ അതിന് മുകളിലുള്ളവ ആവശ്യമാണ്, കൂടാതെ അതിന്റെ ശ്രദ്ധേയമായ സവിശേഷതകളിൽ ഇവ ഉൾപ്പെടുന്നു:
- മൂന്നാം കക്ഷി കേർണൽ മൊഡ്യൂൾ ആവശ്യമില്ല, കാരണം എല്ലാ ഉപകരണങ്ങളും കേർണലിൽ നിർമ്മിച്ചിരിക്കുന്ന BPF അടിസ്ഥാനമാക്കിയാണ് പ്രവർത്തിക്കുന്നത്, BCC Linux 4.x ശ്രേണിയിൽ ചേർത്ത സവിശേഷതകൾ ഉപയോഗിക്കുന്നു.
- സോഫ്റ്റ്uവെയർ നിർവ്വഹണ നിരീക്ഷണം പ്രവർത്തനക്ഷമമാക്കുന്നു.
- ഉദാഹരണ ഫയലുകളും മാൻ പേജുകളും ഉള്ള നിരവധി പ്രകടന വിശകലന ടൂളുകൾ ഉൾക്കൊള്ളുന്നു.
വികസിത ലിനക്സ് ഉപയോക്താക്കൾക്ക് ഏറ്റവും അനുയോജ്യം, C-യിലെ കേർണൽ ഇൻസ്ട്രുമെന്റേഷൻ ഉപയോഗിച്ച് BPF പ്രോഗ്രാമുകൾ എഴുതുന്നത് BCC എളുപ്പമാക്കുന്നു, കൂടാതെ Python, lua എന്നിവയിലെ ഫ്രണ്ട്-എൻഡുകൾ. കൂടാതെ, പ്രകടന വിശകലനം, നിരീക്ഷണം, നെറ്റ്uവർക്ക് ട്രാഫിക് നിയന്ത്രണം എന്നിവയും അതിലേറെയും പോലുള്ള ഒന്നിലധികം ജോലികളെ ഇത് പിന്തുണയ്ക്കുന്നു.
ലിനക്സ് സിസ്റ്റങ്ങളിൽ BCC എങ്ങനെ ഇൻസ്റ്റാൾ ചെയ്യാം
ലിനക്uസ് കേർണൽ പതിപ്പ് 4.1-ലോ അതിനുമുകളിലോ ചേർത്ത ഫീച്ചറുകൾ BCC ഉപയോഗിക്കുന്നുണ്ടെന്ന കാര്യം ഓർക്കുക, ഒരു ആവശ്യകത എന്ന നിലയിൽ, താഴെ സജ്ജീകരിച്ചിരിക്കുന്ന ഫ്ലാഗുകൾ ഉപയോഗിച്ച് കേർണൽ കംപൈൽ ചെയ്തിരിക്കണം:
CONFIG_BPF=y CONFIG_BPF_SYSCALL=y # [optional, for tc filters] CONFIG_NET_CLS_BPF=m # [optional, for tc actions] CONFIG_NET_ACT_BPF=m CONFIG_BPF_JIT=y CONFIG_HAVE_BPF_JIT=y # [optional, for kprobes] CONFIG_BPF_EVENTS=y
നിങ്ങളുടെ കേർണൽ ഫ്ലാഗുകൾ പരിശോധിക്കുന്നതിന്, /proc/config.gz ഫയൽ കാണുക അല്ലെങ്കിൽ താഴെയുള്ള ഉദാഹരണങ്ങളിലെന്നപോലെ കമാൻഡുകൾ പ്രവർത്തിപ്പിക്കുക:
[email ~ $ grep CONFIG_BPF= /boot/config-`uname -r` CONFIG_BPF=y [email ~ $ grep CONFIG_BPF_SYSCALL= /boot/config-`uname -r` CONFIG_BPF_SYSCALL=y [email ~ $ grep CONFIG_NET_CLS_BPF= /boot/config-`uname -r` CONFIG_NET_CLS_BPF=m [email ~ $ grep CONFIG_NET_ACT_BPF= /boot/config-`uname -r` CONFIG_NET_ACT_BPF=m [email ~ $ grep CONFIG_BPF_JIT= /boot/config-`uname -r` CONFIG_BPF_JIT=y [email ~ $ grep CONFIG_HAVE_BPF_JIT= /boot/config-`uname -r` CONFIG_HAVE_BPF_JIT=y [email ~ $ grep CONFIG_BPF_EVENTS= /boot/config-`uname -r` CONFIG_BPF_EVENTS=y
കേർണൽ ഫ്ലാഗുകൾ പരിശോധിച്ച ശേഷം, Linux സിസ്റ്റങ്ങളിൽ BCC ടൂളുകൾ ഇൻസ്റ്റാൾ ചെയ്യാനുള്ള സമയമാണിത്.
ഉബുണ്ടു 16.04-നായി രാത്രികാല പാക്കേജുകൾ മാത്രമേ സൃഷ്ടിക്കപ്പെട്ടിട്ടുള്ളൂ, എന്നാൽ ഇൻസ്റ്റാളേഷൻ നിർദ്ദേശങ്ങൾ വളരെ ലളിതമാണ്. കേർണൽ നവീകരിക്കുകയോ ഉറവിടത്തിൽ നിന്ന് കംപൈൽ ചെയ്യുകയോ ചെയ്യേണ്ടതില്ല.
$ echo "deb [trusted=yes] https://repo.iovisor.org/apt/xenial xenial-nightly main" | sudo tee /etc/apt/sources.list.d/iovisor.list $ sudo apt-get update $ sudo apt-get install bcc-tools
http://kernel.ubuntu.com/~kernel-ppa/mainline എന്നതിൽ നിന്ന് 4.3+ ലിനക്സ് കേർണൽ ഇൻസ്റ്റാൾ ചെയ്തുകൊണ്ട് ആരംഭിക്കുക.
ഒരു ഉദാഹരണമായി, ചുവടെയുള്ള ഉള്ളടക്കത്തോടൊപ്പം ഒരു ചെറിയ ഷെൽ സ്ക്രിപ്റ്റ് bcc-install.sh എഴുതുക.
ശ്രദ്ധിക്കുക: PREFIX മൂല്യം ഏറ്റവും പുതിയ തീയതിയിലേക്ക് അപ്ഡേറ്റ് ചെയ്യുക, കൂടാതെ യഥാർത്ഥ REL മൂല്യം ലഭിക്കുന്നതിന് നൽകിയിരിക്കുന്ന PREFIX url-ലെ ഫയലുകൾ ബ്രൗസ് ചെയ്യുക, അവ ഷെൽ സ്ക്രിപ്റ്റിൽ പകരം വയ്ക്കുക.
#!/bin/bash VER=4.5.1-040501 PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.1-wily/ REL=201604121331 wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb sudo dpkg -i linux-*${VER}.${REL}*.deb
ഫയൽ സംരക്ഷിച്ച് പുറത്തുകടക്കുക. ഇത് എക്സിക്യൂട്ടബിൾ ആക്കുക, തുടർന്ന് കാണിച്ചിരിക്കുന്നതുപോലെ പ്രവർത്തിപ്പിക്കുക:
$ chmod +x bcc-install.sh $ sh bcc-install.sh
അതിനുശേഷം, നിങ്ങളുടെ സിസ്റ്റം റീബൂട്ട് ചെയ്യുക.
$ reboot
അടുത്തതായി, ഒപ്പിട്ട BCC പാക്കേജുകൾ ഇൻസ്റ്റാൾ ചെയ്യാൻ താഴെയുള്ള കമാൻഡുകൾ പ്രവർത്തിപ്പിക്കുക:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D4284CDD $ echo "deb https://repo.iovisor.org/apt trusty main" | sudo tee /etc/apt/sources.list.d/iovisor.list $ sudo apt-get update $ sudo apt-get install binutils bcc bcc-tools libbcc-examples python-bcc
നിങ്ങളുടെ സിസ്റ്റത്തിന് ആവശ്യമുള്ളതിനേക്കാൾ കുറഞ്ഞ പതിപ്പ് ഉണ്ടെങ്കിൽ, http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug-ൽ നിന്ന് 4.2+ കേർണൽ ഇൻസ്റ്റാൾ ചെയ്യുക. അത് എങ്ങനെ ചെയ്യാമെന്നതിന്റെ ഒരു ഉദാഹരണം ചുവടെ:
$ sudo dnf config-manager --add-repo=http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo $ sudo dnf update $ reboot
അതിനുശേഷം, ബിബിസി ടൂൾസ് റിപ്പോസിറ്ററി ചേർക്കുക, നിങ്ങളുടെ സിസ്റ്റം അപ്ഡേറ്റ് ചെയ്യുക, അടുത്ത ശ്രേണി കമാൻഡുകൾ എക്സിക്യൂട്ട് ചെയ്തുകൊണ്ട് ടൂളുകൾ ഇൻസ്റ്റാൾ ചെയ്യുക:
$ echo -e '[iovisor]\nbaseurl=https://repo.iovisor.org/yum/nightly/f23/$basearch\nenabled=1\ngpgcheck=0' | sudo tee /etc/yum.repos.d/iovisor.repo $ sudo dnf update $ sudo dnf install bcc-tools
നിങ്ങളുടെ കേർണൽ കുറഞ്ഞത് പതിപ്പ് 4.3.1-1 ലേക്ക് അപ്uഗ്രേഡ് ചെയ്തുകൊണ്ട് ആരംഭിക്കണം, തുടർന്ന് pacaur, yaourt, cower മുതലായ ഏതെങ്കിലും ആർച്ച് പാക്കേജ് മാനേജർമാർ ഉപയോഗിച്ച് ചുവടെയുള്ള പാക്കേജുകൾ ഇൻസ്റ്റാൾ ചെയ്യുക.
bcc bcc-tools python-bcc python2-bcc
ലിനക്സ് സിസ്റ്റങ്ങളിൽ BCC ടൂളുകൾ എങ്ങനെ ഉപയോഗിക്കാം
എല്ലാ BCC ടൂളുകളും /usr/share/bcc/tools
ഡയറക്uടറിക്ക് കീഴിൽ ഇൻസ്റ്റാൾ ചെയ്തിട്ടുണ്ട്. എന്നിരുന്നാലും, /tools
എന്നതിന് കീഴിലുള്ള BCC Github റിപ്പോസിറ്ററിയിൽ നിന്ന് നിങ്ങൾക്ക് അവ പ്രവർത്തിപ്പിക്കാം, അവിടെ അവ ഒരു .py
വിപുലീകരണത്തോടെ അവസാനിക്കും.
$ ls /usr/share/bcc/tools argdist capable filetop offwaketime stackcount vfscount bashreadline cpudist funccount old stacksnoop vfsstat biolatency dcsnoop funclatency oomkill statsnoop wakeuptime biosnoop dcstat gethostlatency opensnoop syncsnoop xfsdist biotop doc hardirqs pidpersec tcpaccept xfsslower bitesize execsnoop killsnoop profile tcpconnect zfsdist btrfsdist ext4dist mdflush runqlat tcpconnlat zfsslower btrfsslower ext4slower memleak softirqs tcpretrans cachestat filelife mysqld_qslower solisten tplist cachetop fileslower offcputime sslsniff trace
പൊതുവായ ലിനക്uസ് സിസ്റ്റം പ്രകടനവും നെറ്റ്uവർക്കിംഗും നിരീക്ഷിക്കുന്നതിന് ചുവടെ ഞങ്ങൾ കുറച്ച് ഉദാഹരണങ്ങൾ ഉൾക്കൊള്ളുന്നു.
എല്ലാ open()
syscals-ഉം opensnoop ഉപയോഗിച്ച് ട്രാക്ക് ചെയ്തുകൊണ്ട് നമുക്ക് ആരംഭിക്കാം. വിവിധ ആപ്ലിക്കേഷനുകൾ അവയുടെ ഡാറ്റ ഫയലുകൾ, കോൺഫിഗറേഷൻ ഫയലുകൾ എന്നിവയും മറ്റു പലതും തിരിച്ചറിഞ്ഞ് എങ്ങനെ പ്രവർത്തിക്കുന്നുവെന്ന് ഞങ്ങളോട് പറയാൻ ഇത് ഞങ്ങളെ പ്രാപ്തരാക്കുന്നു:
$ cd /usr/share/bcc/tools $ sudo ./opensnoop PID COMM FD ERR PATH 1 systemd 35 0 /proc/self/mountinfo 2797 udisksd 13 0 /proc/self/mountinfo 1 systemd 35 0 /sys/devices/pci0000:00/0000:00:0d.0/ata3/host2/target2:0:0/2:0:0:0/block/sda/sda1/uevent 1 systemd 35 0 /run/udev/data/b8:1 1 systemd -1 2 /etc/systemd/system/sys-kernel-debug-tracing.mount 1 systemd -1 2 /run/systemd/system/sys-kernel-debug-tracing.mount 1 systemd -1 2 /run/systemd/generator/sys-kernel-debug-tracing.mount 1 systemd -1 2 /usr/local/lib/systemd/system/sys-kernel-debug-tracing.mount 2247 systemd 15 0 /proc/self/mountinfo 1 systemd -1 2 /lib/systemd/system/sys-kernel-debug-tracing.mount 1 systemd -1 2 /usr/lib/systemd/system/sys-kernel-debug-tracing.mount 1 systemd -1 2 /run/systemd/generator.late/sys-kernel-debug-tracing.mount 1 systemd -1 2 /etc/systemd/system/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /etc/systemd/system/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /run/systemd/system/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /run/systemd/system/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /run/systemd/generator/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /run/systemd/generator/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /usr/local/lib/systemd/system/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /usr/local/lib/systemd/system/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /lib/systemd/system/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /lib/systemd/system/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /usr/lib/systemd/system/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /usr/lib/systemd/system/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /run/systemd/generator.late/sys-kernel-debug-tracing.mount.wants 1 systemd -1 2 /run/systemd/generator.late/sys-kernel-debug-tracing.mount.requires 1 systemd -1 2 /etc/systemd/system/sys-kernel-debug-tracing.mount.d 1 systemd -1 2 /run/systemd/system/sys-kernel-debug-tracing.mount.d 1 systemd -1 2 /run/systemd/generator/sys-kernel-debug-tracing.mount.d ....
ഈ ഉദാഹരണത്തിൽ, biolatecncy ഉപയോഗിച്ച് ഡിസ്ക് I/O ലേറ്റൻസിയുടെ സംഗ്രഹിച്ച വിതരണം ഇത് കാണിക്കുന്നു. കമാൻഡ് എക്സിക്യൂട്ട് ചെയ്ത ശേഷം, കുറച്ച് മിനിറ്റ് കാത്തിരിക്കുക, അത് അവസാനിപ്പിച്ച് ഔട്ട്പുട്ട് കാണുന്നതിന് Ctrl-C അമർത്തുക.
$ sudo ./biolatecncy Tracing block device I/O... Hit Ctrl-C to end. ^C usecs : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 0 | | 32 -> 63 : 0 | | 64 -> 127 : 0 | | 128 -> 255 : 3 |****************************************| 256 -> 511 : 3 |****************************************| 512 -> 1023 : 1 |************* |
ഈ വിഭാഗത്തിൽ, execsnoop ടൂൾ ഉപയോഗിച്ച് എക്സിക്യൂഷനിലെ പുതിയ പ്രക്രിയകൾ കണ്ടെത്തുന്നതിലേക്ക് ഞങ്ങൾ നീങ്ങും. ഓരോ തവണയും ഒരു പ്രോസസ്സ് fork()
, exec()
syscals എന്നിവയാൽ ഫോർക്ക് ചെയ്യുമ്പോൾ, അത് ഔട്ട്പുട്ടിൽ കാണിക്കും. എന്നിരുന്നാലും, എല്ലാ പ്രക്രിയകളും പിടിച്ചെടുക്കപ്പെടുന്നില്ല.
$ sudo ./execsnoop PCOMM PID PPID RET ARGS gnome-screensho 14882 14881 0 /usr/bin/gnome-screenshot --gapplication-service systemd-hostnam 14892 1 0 /lib/systemd/systemd-hostnamed nautilus 14897 2767 -2 /home/tecmint/bin/net usershare info nautilus 14897 2767 -2 /home/tecmint/.local/bin/net usershare info nautilus 14897 2767 -2 /usr/local/sbin/net usershare info nautilus 14897 2767 -2 /usr/local/bin/net usershare info nautilus 14897 2767 -2 /usr/sbin/net usershare info nautilus 14897 2767 -2 /usr/bin/net usershare info nautilus 14897 2767 -2 /sbin/net usershare info nautilus 14897 2767 -2 /bin/net usershare info nautilus 14897 2767 -2 /usr/games/net usershare info nautilus 14897 2767 -2 /usr/local/games/net usershare info nautilus 14897 2767 -2 /snap/bin/net usershare info compiz 14899 14898 -2 /home/tecmint/bin/libreoffice --calc compiz 14899 14898 -2 /home/tecmint/.local/bin/libreoffice --calc compiz 14899 14898 -2 /usr/local/sbin/libreoffice --calc compiz 14899 14898 -2 /usr/local/bin/libreoffice --calc compiz 14899 14898 -2 /usr/sbin/libreoffice --calc libreoffice 14899 2252 0 /usr/bin/libreoffice --calc dirname 14902 14899 0 /usr/bin/dirname /usr/bin/libreoffice basename 14903 14899 0 /usr/bin/basename /usr/bin/libreoffice ...
ext4slower ഉപയോഗിച്ച്, 10ms-നേക്കാൾ വേഗത കുറഞ്ഞ ext4 ഫയൽ സിസ്റ്റത്തിന്റെ പൊതുവായ പ്രവർത്തനങ്ങൾ, ഫയൽ സിസ്റ്റം വഴി സ്വതന്ത്രമായി സ്ലോ ഡിസ്ക് I/O തിരിച്ചറിയാൻ ഞങ്ങളെ സഹായിക്കുന്നു.
ഒരു പരിധി കവിയുന്ന പ്രവർത്തനങ്ങൾ മാത്രമേ ഇത് ഔട്ട്പുട്ട് ചെയ്യുന്നുള്ളൂ:
$ sudo ./execslower Tracing ext4 operations slower than 10 ms TIME COMM PID T BYTES OFF_KB LAT(ms) FILENAME 11:59:13 upstart 2252 W 48 1 10.76 dbus.log 11:59:13 gnome-screensh 14993 R 144 0 10.96 settings.ini 11:59:13 gnome-screensh 14993 R 28 0 16.02 gtk.css 11:59:13 gnome-screensh 14993 R 3389 0 18.32 gtk-main.css 11:59:25 rs:main Q:Reg 1826 W 156 60 31.85 syslog 11:59:25 pool 15002 R 208 0 14.98 .xsession-errors 11:59:25 pool 15002 R 644 0 12.28 .ICEauthority 11:59:25 pool 15002 R 220 0 13.38 .bash_logout 11:59:27 dconf-service 2599 S 0 0 22.75 user.BHDKOY 11:59:33 compiz 2548 R 4096 0 19.03 firefox.desktop 11:59:34 compiz 15008 R 128 0 27.52 firefox.sh 11:59:34 firefox 15008 R 128 0 36.48 firefox 11:59:34 zeitgeist-daem 2988 S 0 0 62.23 activity.sqlite-wal 11:59:34 zeitgeist-fts 2996 R 8192 40 15.67 postlist.DB 11:59:34 firefox 15008 R 140 0 18.05 dependentlibs.list 11:59:34 zeitgeist-fts 2996 S 0 0 25.96 position.tmp 11:59:34 firefox 15008 R 4096 0 10.67 libplc4.so 11:59:34 zeitgeist-fts 2996 S 0 0 11.29 termlist.tmp ...
അടുത്തതായി, ബയോസ്നൂപ്പ് ഉപയോഗിച്ച് പ്രോസസ്സ് ഐഡി, സെക്ടർ, ബൈറ്റുകൾ, ലേറ്റൻസി തുടങ്ങിയ വിശദാംശങ്ങളോടെ ഓരോ സെക്കൻഡിലും ഓരോ ഡിസ്കിനും I/O യ്uക്ക് ഒരു ലൈൻ പ്രിന്റ് ചെയ്യുന്നതിലേക്ക് കടക്കാം:
$ sudo ./biosnoop TIME(s) COMM PID DISK T SECTOR BYTES LAT(ms) 0.000000000 ? 0 R -1 8 0.26 2.047897000 ? 0 R -1 8 0.21 3.280028000 kworker/u4:0 14871 sda W 30552896 4096 0.24 3.280271000 jbd2/sda1-8 545 sda W 29757720 12288 0.40 3.298318000 jbd2/sda1-8 545 sda W 29757744 4096 0.14 4.096084000 ? 0 R -1 8 0.27 6.143977000 ? 0 R -1 8 0.27 8.192006000 ? 0 R -1 8 0.26 8.303938000 kworker/u4:2 15084 sda W 12586584 4096 0.14 8.303965000 kworker/u4:2 15084 sda W 25174736 4096 0.14 10.239961000 ? 0 R -1 8 0.26 12.292057000 ? 0 R -1 8 0.20 14.335990000 ? 0 R -1 8 0.26 16.383798000 ? 0 R -1 8 0.17 ...
അതിനുശേഷം, ഓരോ സെക്കൻഡിലും സിസ്റ്റം കാഷെയിൽ നിന്ന് സംഗ്രഹിച്ച സ്ഥിതിവിവരക്കണക്കുകളുടെ ഒരു വരി പ്രദർശിപ്പിക്കുന്നതിന് ഞങ്ങൾ കാഷെസ്റ്റാറ്റ് ഉപയോഗിച്ച് മുന്നോട്ട് പോകുന്നു. കുറഞ്ഞ കാഷെ ഹിറ്റ് അനുപാതവും മിസ്സുകളുടെ ഉയർന്ന നിരക്കും ചൂണ്ടിക്കാണിച്ചുകൊണ്ട് സിസ്റ്റം ട്യൂണിംഗ് പ്രവർത്തനങ്ങൾക്ക് ഇത് പ്രാപ്തമാക്കുന്നു:
$ sudo ./cachestat HITS MISSES DIRTIES READ_HIT% WRITE_HIT% BUFFERS_MB CACHED_MB 0 0 0 0.0% 0.0% 19 544 4 4 2 25.0% 25.0% 19 544 1321 33 4 97.3% 2.3% 19 545 7476 0 2 100.0% 0.0% 19 545 6228 15 2 99.7% 0.2% 19 545 0 0 0 0.0% 0.0% 19 545 7391 253 108 95.3% 2.7% 19 545 33608 5382 28 86.1% 13.8% 19 567 25098 37 36 99.7% 0.0% 19 566 17624 239 416 96.3% 0.5% 19 520 ...
tcpconnect ഉപയോഗിച്ച് ഓരോ സെക്കൻഡിലും TCP കണക്ഷനുകൾ നിരീക്ഷിക്കുന്നു. ഇതിന്റെ ഔട്ട്uപുട്ടിൽ ഉറവിടവും ലക്ഷ്യസ്ഥാന വിലാസവും പോർട്ട് നമ്പറും ഉൾപ്പെടുന്നു. അപ്രതീക്ഷിത TCP കണക്ഷനുകൾ കണ്ടെത്തുന്നതിന് ഈ ഉപകരണം ഉപയോഗപ്രദമാണ്, അതുവഴി ആപ്ലിക്കേഷൻ കോൺഫിഗറേഷനുകളിലോ ആക്രമണകാരിയിലോ ഉള്ള കാര്യക്ഷമതയില്ലായ്മ തിരിച്ചറിയാൻ ഞങ്ങളെ സഹായിക്കുന്നു.
$ sudo ./tcpconnect PID COMM IP SADDR DADDR DPORT 15272 Socket Threa 4 10.0.2.15 91.189.89.240 80 15272 Socket Threa 4 10.0.2.15 216.58.199.142 443 15272 Socket Threa 4 10.0.2.15 216.58.199.142 80 15272 Socket Threa 4 10.0.2.15 216.58.199.174 443 15272 Socket Threa 4 10.0.2.15 54.200.62.216 443 15272 Socket Threa 4 10.0.2.15 54.200.62.216 443 15272 Socket Threa 4 10.0.2.15 117.18.237.29 80 15272 Socket Threa 4 10.0.2.15 216.58.199.142 80 15272 Socket Threa 4 10.0.2.15 216.58.199.131 80 15272 Socket Threa 4 10.0.2.15 216.58.199.131 443 15272 Socket Threa 4 10.0.2.15 52.222.135.52 443 15272 Socket Threa 4 10.0.2.15 216.58.199.131 443 15272 Socket Threa 4 10.0.2.15 54.200.62.216 443 15272 Socket Threa 4 10.0.2.15 54.200.62.216 443 15272 Socket Threa 4 10.0.2.15 216.58.199.132 443 15272 Socket Threa 4 10.0.2.15 216.58.199.131 443 15272 Socket Threa 4 10.0.2.15 216.58.199.142 443 15272 Socket Threa 4 10.0.2.15 54.69.17.198 443 15272 Socket Threa 4 10.0.2.15 54.69.17.198 443 ...
മുകളിലുള്ള എല്ലാ ടൂളുകളും വിവിധ ഓപ്uഷനുകൾക്കൊപ്പം ഉപയോഗിക്കാവുന്നതാണ്, തന്നിരിക്കുന്ന ഉപകരണത്തിനായുള്ള സഹായ പേജ് പ്രവർത്തനക്ഷമമാക്കുന്നതിന്, -h
ഓപ്ഷൻ ഉപയോഗിക്കുക, ഉദാഹരണത്തിന്:
$ sudo ./tcpconnect -h usage: tcpconnect [-h] [-t] [-p PID] [-P PORT] Trace TCP connects optional arguments: -h, --help show this help message and exit -t, --timestamp include timestamp on output -p PID, --pid PID trace this PID only -P PORT, --port PORT comma-separated list of destination ports to trace. examples: ./tcpconnect # trace all TCP connect()s ./tcpconnect -t # include timestamps ./tcpconnect -p 181 # only trace PID 181 ./tcpconnect -P 80 # only trace port 80 ./tcpconnect -P 80,81 # only trace port 80 and 81
പരാജയപ്പെട്ട exec()s syscalls കണ്ടെത്തുന്നതിന്, താഴെ പറയുന്ന പോലെ opensnoop ഉപയോഗിച്ച് -x
ഓപ്ഷൻ ഉപയോഗിക്കുക:
$ sudo ./opensnoop -x PID COMM FD ERR PATH 15414 pool -1 2 /home/.hidden 15415 (ostnamed) -1 2 /sys/fs/cgroup/cpu/system.slice/systemd-hostnamed.service/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/cpu/system.slice/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/cpuacct/system.slice/systemd-hostnamed.service/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/cpuacct/system.slice/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/blkio/system.slice/systemd-hostnamed.service/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/blkio/system.slice/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/memory/system.slice/systemd-hostnamed.service/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/memory/system.slice/cgroup.procs 15415 (ostnamed) -1 2 /sys/fs/cgroup/pids/system.slice/systemd-hostnamed.service/cgroup.procs 2548 compiz -1 2 15416 systemd-cgroups -1 2 /run/systemd/container 15416 systemd-cgroups -1 2 /sys/fs/kdbus/0-system/bus 15415 systemd-hostnam -1 2 /run/systemd/container 15415 systemd-hostnam -1 13 /proc/1/environ 15415 systemd-hostnam -1 2 /sys/fs/kdbus/0-system/bus 1695 dbus-daemon -1 2 /run/systemd/users/0 15415 systemd-hostnam -1 2 /etc/machine-info 15414 pool -1 2 /home/tecmint/.hidden 15414 pool -1 2 /home/tecmint/Binary/.hidden 2599 dconf-service -1 2 /run/user/1000/dconf/user ...
ഒരു ഇഷ്uടാനുസൃത ട്രെയ്uസ് ഓപ്പറേഷൻ എങ്ങനെ എക്uസിക്യൂട്ട് ചെയ്യാമെന്ന് ചുവടെയുള്ള അവസാന ഉദാഹരണം കാണിക്കുന്നു. ഒരു പ്രത്യേക പ്രക്രിയ അതിന്റെ PID ഉപയോഗിച്ച് ഞങ്ങൾ കണ്ടെത്തുകയാണ്.
ആദ്യം പ്രോസസ്സ് ഐഡി നിർണ്ണയിക്കുക:
$ pidof firefox 15437
പിന്നീട്, ഇച്ഛാനുസൃത ട്രേസ് കമാൻഡ് പ്രവർത്തിപ്പിക്കുക. താഴെയുള്ള കമാൻഡിൽ: -p
പ്രോസസ്സ് ഐഡി വ്യക്തമാക്കുന്നു, do_sys_open()
എന്നത് ഒരു കേർണൽ ഫംഗ്uഷനാണ്, അത് അതിന്റെ രണ്ടാമത്തെ ആർഗ്യുമെന്റ് ഒരു സ്ട്രിംഗ് ആയി ഉൾപ്പെടുത്തി ചലനാത്മകമായി കണ്ടെത്തുന്നു.
$ sudo ./trace -p 4095 'do_sys_open "%s", arg2' TIME PID COMM FUNC - 12:17:14 15437 firefox do_sys_open /run/user/1000/dconf/user 12:17:14 15437 firefox do_sys_open /home/tecmint/.config/dconf/user 12:18:07 15437 firefox do_sys_open /run/user/1000/dconf/user 12:18:07 15437 firefox do_sys_open /home/tecmint/.config/dconf/user 12:18:13 15437 firefox do_sys_open /sys/devices/system/cpu/present 12:18:13 15437 firefox do_sys_open /dev/urandom 12:18:13 15437 firefox do_sys_open /dev/urandom 12:18:14 15437 firefox do_sys_open /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf 12:18:14 15437 firefox do_sys_open /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf 12:18:14 15437 firefox do_sys_open /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf 12:18:14 15437 firefox do_sys_open /sys/devices/system/cpu/present 12:18:14 15437 firefox do_sys_open /dev/urandom 12:18:14 15437 firefox do_sys_open /dev/urandom 12:18:14 15437 firefox do_sys_open /dev/urandom 12:18:14 15437 firefox do_sys_open /dev/urandom 12:18:15 15437 firefox do_sys_open /sys/devices/system/cpu/present 12:18:15 15437 firefox do_sys_open /dev/urandom 12:18:15 15437 firefox do_sys_open /dev/urandom 12:18:15 15437 firefox do_sys_open /sys/devices/system/cpu/present 12:18:15 15437 firefox do_sys_open /dev/urandom 12:18:15 15437 firefox do_sys_open /dev/urandom ....
സംഗ്രഹം
സിസ്റ്റം പ്രകടന നിരീക്ഷണം കണ്ടെത്തൽ, ബ്ലോക്ക് ഡിവൈസ് I/O, TCP ഫംഗ്uഷനുകൾ, ഫയൽ സിസ്റ്റം ഓപ്പറേഷനുകൾ, syscalls, Node.js പ്രോബുകൾ, കൂടാതെ മറ്റു പലതും കണ്ടെത്തൽ തുടങ്ങിയ വിവിധ സിസ്റ്റം അഡ്മിനിസ്ട്രേഷൻ ജോലികൾക്കായുള്ള ശക്തവും ഉപയോഗിക്കാൻ എളുപ്പമുള്ളതുമായ ടൂൾകിറ്റാണ് BCC. പ്രധാനമായി, ഇത് നിങ്ങളെ നയിക്കുന്നതിനുള്ള ടൂളുകൾക്കായി നിരവധി ഉദാഹരണ ഫയലുകളും മാൻ പേജുകളും ഉപയോഗിച്ച് ഷിപ്പ് ചെയ്യുന്നു, ഇത് ഉപയോക്തൃ സൗഹൃദവും വിശ്വസനീയവുമാക്കുന്നു.
അവസാനമായി പക്ഷേ, ചുവടെയുള്ള അഭിപ്രായ വിഭാഗത്തിലൂടെ വിഷയത്തെക്കുറിച്ചുള്ള നിങ്ങളുടെ ചിന്തകൾ പങ്കിടുന്നതിലൂടെയോ ചോദ്യങ്ങൾ ചോദിക്കുന്നതിലൂടെയോ ഉപയോഗപ്രദമായ നിർദ്ദേശങ്ങൾ നൽകുന്നതിലൂടെയോ ക്രിയാത്മകമായ എന്തെങ്കിലും ഫീഡ്uബാക്ക് നൽകുന്നതിലൂടെയോ നിങ്ങൾക്ക് ഞങ്ങളെ ബന്ധപ്പെടാം.
കൂടുതൽ വിവരങ്ങൾക്കും ഉപയോഗത്തിനും സന്ദർശിക്കുക: https://iovisor.github.io/bcc/