Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Real-time Monitoring and Control of basic process Management in Linux Operation and maintenance

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "example analysis of real-time monitoring and control of Linux operation and maintenance basic process management", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of real-time monitoring and control of Linux operation and maintenance basic process management".

1. 1.sleep 999 & (run Job) [root@localhost ~] # sleep 999 & [1] 36702.ps-ef | grep sleep (View process) [root@localhost ~] # ps-ef | grep sleeproot 3670 3642 0 10:54 pts/1 00:00:00 sleep 999root 3671 3642 0 10:54 pts/1 00:00:00 sleep 999root 3672 3642 0 10:54 pts/1 00:00:00 sleep 999root 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3674 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 3642 0 10:54 pts/1 00:00:00 sleep 999root 3676 3642 0 10:54 pts/1 00:00:00 sleep 999root 3677 3642 0 10:54 pts/1 00:00:00 sleep 999root 3678 3642 0 10:54 pts/1 00:00: 00 sleep 999root 3686 9500 10:54? 00:00:00 sleep 603.fg (Last key) [root@localhost ~] # fgsleep 9994.jobs (View Task) [root@localhost ~] # jobs [1] sleep & [3] sleep 999 & [4] sleep 999 & [6]-sleep 999 & [7] + Sleep 999 ctr1+z (Done) completed 5. Explain fg% N (call the specified task) stopped (stagnant state) bg% 3 (running state) + (default operation)-(second operation) 2. Use the signal control process basic process management signal number ID short name to define the name usage 1HUP suspension allows a process to reread the configuration file without restarting, and lets the new configuration information take effect. The 2INT keyboard interrupts a foreground process. Ctrl+c is the SIGINT signal used 9KILL interrupt, unable to intercept resulting in immediate termination of the program. Cannot be intercepted, ignored, or handled 15 default TERM termination causes the program to terminate. Unlike SIGKILL, it can be intercepted, ignored, or handled. A friendly way to require the termination of the program, allowing self-cleaning

The kill command sends a signal to the process according to ID. Although its name is kill, this command can be used to send any signal, not just the signal that terminates the program

1. View the process [root@localhost ~] # ps-ef | grep sleeproot 3670 3642 0 10:54 pts/1 00:00:00 sleep 999root 3672 3642 0 10:54 pts/1 00:00:00 sleep 999root 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 0 10:54 pts/1 00:00:00 sleep 999root 3676 3642 0 10:54 pts/1 00:00:00 sleep 999root 3901 9500 10:59? 00:00:00 sleep 60root 3904 3642 0 10:59 pts/1 00:00:00 grep-- color=auto sleep2. Delete the specified task [root@localhost ~] # kill% 1 [root@localhost ~] # ps-ef | grep sleeproot 3672 3642 0 10:54 pts/1 00:00:00 sleep 999root 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 3642 01 0:54 pts/1 00:00:00 sleep 999root 3676 3642 10:54 pts/1 00:00:00 sleep 999root 3901 9500 010 59? 00:00:00 sleep 60root 3906 3642 0 11:00 pts/1 00:00:00 grep-- color=auto sleep [1] sleep 9993.kill-l (list all supported programs) [root@localhost ~] # kill-l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR111) SIGSEGV 12) SIGUSR2 13) SIGALRM 14) SIGTERM16 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41 ) SIGRTMIN+7 42) SIGRTMIN+843) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+12 47) SIGRTMIN+1348) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-758) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-263) SIGRTMAX-1 64) SIGRTMAX [root@localhost ~] # 4. Kill 3672 (delete process) View process [root@localhost ~] # ps-ef | grep sleeproot 3672 3642 0 10:54 pts/1 00:00:00 sleep 999root 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 3642 0 10:54 pts/1 00:00:00 sleep 999root 3676 3642 0 10:54 pts/1 00:00:00 sleep 999root 3925 9500 11:00? 00:00:00 sleep 60root 4039 3642 0 11:00 pts/1 00:00:00 grep-- color=auto sleep [root@localhost ~] # kill 3672 [root@localhost ~] # ps-ef | grep sleeproot 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 3642 0 10:54 pts/1 00:00:00 sleep 999root 3676 3642 0 10:54 pts/1 00:00:00 sleep 999root 3925 9500 11:00? 00:00 : 00 sleep 60root 4054 3642 0 11:01 pts/1 00:00:00 grep-- color=auto sleep [3] sleep 995.killall sleep (delete all sleep) View process: [root@localhost ~] # ps-ef | grep sleeproot 3673 3642 0 10:54 pts/1 00:00:00 sleep 999root 3675 3642 0 10:54 pts/1 00:00:00 sleep 999root 3676 3642 0 10:54 pts / 1 00:00:00 sleep 999root 4164 9500 11:01? 00:00:00 sleep 60root 4174 3642 0 11:01 pts/1 00:00:00 grep-- color=auto sleep successfully deleted [root@localhost ~] # ps-ef | grep sleeproot 4185 3642 0 11:02 pts/1 00:00:00 grep-- color=auto sleep3. Monitor process activity IO load

The number of loads is calculated by global counters and is the sum of all CPU.

Since tasks returned from sleep may be rescheduled to a different CPU, it is difficult to accurately count per CPU, but the accuracy of the cumulative count can be guaranteed.

The average load shown represents all CPU.

Display load values and implement monitorin

[root@localhost ~] # top

1. Check the load [root@localhost] # uptime 11:12:36 up 45 min, 2 users, load average: 0.06,0.01,0.20 2. Show load valu Implement monitoring [root@localhost ~] # toptop-11:15:03 up 47 min, 2 users, load average: 0.00,0.00, 0.16Tasks: 328 total, 1 running, 327 sleeping, 0 stopped, 0 zombie%Cpu (s): 0.0 us, 0.7 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.3 hi, 0.0 si, 0.0 stMiB Mem: 804.8 total, 67.5 free 474.7 used, 262.5 buff/cacheMiB Swap: 2048.0 total, 1427.5 free, 620.5 used. 196.8 avail Mem PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 3884 root 20 00 I 0.3 0.0 MEM TIME+ COMMAND 00.57 kworker+ 4404 root 200 64856 4880 4008 R 0.3 0.6 VR 00.17 top 1 root 200 245372 7252 4356 S 0.0. 9 0kthreadd 03.43 systemd 2 root 20 00 00 S 0.0 0.00: 00.00 kthreadd 3 root 0-20 000 I 0.0 0.00: 00.00 rcu_gp 4 root 0-20 000 I 0.0 0.00: 00.00 Rcu_par+ 6 root 0-2000 0 I 0.0 0.00: 00.00 kworker+ 8 root 0-20 000 I 0.0 0.00: 00.00 mm_perc+ 9 root 20 00 S 0.0 0.00: 00.24 ksoftir+ 10 root 20 00 00 I 0.0 0.00: 00.35 rcu_sch+ 11 root rt 00 00 S 0.0 0.00: 00.00 migrati+ 12 root rt 00 00 S 0.0 0.00: 00.00 watchdo+ 13 root 20 00 0 0 S 0.0 0.00: 00.00 cpuhp/0 15 root 20 00 S 0.0 0.00: 00.00 kdevtmp+ 16 root 0-20 00 I 0.0 0.00: 00.00 netns 17 root 20 00 S 0.00. 00: 00.00 kauditd 18 root 20 00 00 S 0.0 0.00: 00.00 khungta+ description press m t l [root@localhost ~] # top not to display 1 display cpu information 4. Real-time process monitoring top is used to dynamically display system information on full screen / / top command interactive subcommand: M / / sort according to the size of resident memory Sort by default according to percentage of CPU P / / sort by percentage of CPU usage T / sort by cumulative time (occupied CPU time) l / / whether average load and startup time t / / display process and CPU status related information m / / whether memory related information c / / whether full life is displayed Command line information Q / / exit top command k / / terminate a process 1 / / display information for all CPU s / / modify refresh interval us / / indicates user space Sy / / represents kernel space; ni / / indicates the percentage of time taken up by CPU to adjust the nice value; id / / represents the percentage of idle time; wa / / represents the percentage of time spent waiting for IO to complete; hi / / represents hard interrupt, the percentage of time occupied by hardware interrupts; si / / represents the percentage of time occupied by soft interrupts St / / represents steal, time stolen by virtualization technology (such as running virtual machines) PR / / priority NI / / Nice value VIRT / / Virtual memory set RES / / resident memory set SHR / / shared memory size S / / process status above is all the contents of the article "sample Analysis of Real-time Monitoring and Control of Linux Operation and maintenance basic process Management". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report