CN109522186B - Monitoring method and system based on Linux disk access - Google Patents

Monitoring method and system based on Linux disk access Download PDF

Info

Publication number
CN109522186B
CN109522186B CN201811377248.4A CN201811377248A CN109522186B CN 109522186 B CN109522186 B CN 109522186B CN 201811377248 A CN201811377248 A CN 201811377248A CN 109522186 B CN109522186 B CN 109522186B
Authority
CN
China
Prior art keywords
partition
disk
monitoring
linux
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811377248.4A
Other languages
Chinese (zh)
Other versions
CN109522186A (en
Inventor
魏浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811377248.4A priority Critical patent/CN109522186B/en
Publication of CN109522186A publication Critical patent/CN109522186A/en
Application granted granted Critical
Publication of CN109522186B publication Critical patent/CN109522186B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3037Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache

Abstract

The invention provides a monitoring method and a monitoring system based on Linux disk access. The invention can monitor the disk, is beneficial to positioning the problem of the disk and ensures the state of the disk; the method can also monitor the abnormal access of the disk and confirm the safety of the file.

Description

Monitoring method and system based on Linux disk access
Technical Field
The invention relates to the technical field of computers, in particular to a monitoring method and a monitoring system based on Linux disk access.
Background
The disk performance test is a necessary test in server test, and is mainly used for checking the quality condition of a disk, such as the problem of bad tracks of the disk, the bad tracks of the disk are mainly divided into a logic bad track and a physical bad track, and when the problem occurs, the disk can not be read or the reading speed is too slow.
Some errors about the disk are found in the system log in daily tests. For example, an error of "unknown partition table" may occur in the messages log. At this time, we need to find what process and what reason causes the error.
Therefore, a method is needed to solve the problem of monitoring what process is operating on the disk to facilitate the positioning.
Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a monitoring method and system based on Linux disk access, which monitor partitions with different formats through a "check _ partition" structure in a source code of a Linux kernel, and find a process of disk operation, so as to find a reason for error reporting of a disk.
In order to achieve the purpose, the invention is realized by the following technical scheme: a monitoring method based on Linux disk access comprises the following steps:
step 1: installing a probe for system monitoring under a Linux system;
step 2: installing a kernel code package for monitoring the Linux system;
and step 3: calling a check partition structure body to check the disk partition;
and 4, step 4: outputting current time, function name, disk partition and pid information;
and 5: and collecting a monitoring log.
Further, the probe monitored by the system is systemtap-runtime.
Further, the monitoring of the kernel code package of the Linux system includes: kernel-debug fo-common, kernel-debug fo and kernel-level.
Further, the step 4 specifically includes:
step 41: calling ctime (now) function to print current time;
step 42: obtaining a return value of the called check partition structure through a $ return command;
step 43: calling an execname () function to output the process name of the disk partition;
step 44: and calling a pid () function to display the pid information of the disk partition process.
Further, step 42 further comprises: if no value is returned, 0 is output; if yes, and the partition table is valid, outputting a positive value; if there is an error, a negative value is output.
Further, the step 4 further comprises: and calling a pexecname () function and a ppid () function, and displaying the parent process of the disk partition process and the pid information of the parent process.
In addition, based on the method, the invention also provides a monitoring system based on Linux disk access, which comprises the following steps:
the monitoring probe installation module is used for installing a system monitoring probe in a Linux system;
the code package installation module is used for installing a kernel code package for monitoring the Linux system;
the checker calling module is used for calling the check partition structure body to check the disk partition;
the display module is used for displaying the current time, the function name, the disk partition and the pid information;
and the log collection module is used for running a monitoring log collection command and displaying the monitoring log.
Further, the system also comprises a return value output module, which is used for obtaining the return value of the called check partition structure body through a $ return command, and outputting 0 if no return value exists; if yes, and the partition table is valid, outputting a positive value; if there is an error, a negative value is output.
Compared with the prior art, the invention has the advantages that,
1. the invention can monitor the disk, is beneficial to positioning the problem of the disk and ensures the state of the disk;
2. the invention can monitor the abnormal access of the disk and confirm the safety of the file;
3. the invention is based on a Linux system, and the system is widely applied; the system environment required by the test is stable, and the test conclusion is real and reliable.
Therefore, compared with the prior art, the invention has prominent substantive features and remarkable progress, and the beneficial effects of the implementation are also obvious.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Fig. 2 is a system block diagram of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made with reference to the accompanying drawings.
As shown in fig. 1, a monitoring method based on Linux disk access is characterized by comprising the following steps:
step 1: and installing a system monitoring probe under the Linux system.
The probe monitored by the system is systemtap-runtime.
Step 2: and installing a kernel code package for monitoring the Linux system.
The kernel code package includes: kernel-debug fo-common, kernel-debug fo and kernel-level.
And step 3: and calling the check partition structure to check the disk partition.
And 4, step 4: call ctime (now) function to print the current time.
And 5: the return value of the called check partition structure is obtained by the $ return command.
If no value is returned, 0 is output; if yes, and the partition table is valid, outputting a positive value; if there is an error, a negative value is output.
Step 6: and calling an execname () function to output the process name of the disk partition.
And 7: and calling a pid () function to display the pid information of the disk partition process.
And 8: and calling a pexecname () function and a ppid () function, and displaying the parent process of the disk partition process and the pid information of the parent process.
And step 9: and collecting a monitoring log.
The above embodiment of the monitoring method based on Linux disk access is described in detail, and based on the monitoring method based on Linux disk access described in the above embodiment, the embodiment of the present invention further provides a monitoring system based on Linux disk access corresponding to the method, as shown in fig. 2, including:
the monitoring probe installation module is used for installing a system monitoring probe in a Linux system;
the code package installation module is used for installing a kernel code package for monitoring the Linux system;
the checker calling module is used for calling the check partition structure body to check the disk partition;
the display module is used for displaying the current time, the function name, the disk partition and the pid information;
a return value output module, configured to obtain a return value of the called check partition structure through a $ return command, and if there is no return value, output 0; if yes, and the partition table is valid, outputting a positive value; if there is an error, outputting a negative value;
and the log collection module is used for running a monitoring log collection command and extracting the monitoring log.
Based on the monitoring method and the monitoring system based on the Linux disk access, the specific program implementation process and the content are as follows:
first, probe of installing system control
Secondly, installing the kernel-debug fo-common kernel-debug fo-debug
Third, program content
probe kernel.function("check_partition") {
now=gettimeofday_s()
printf( "%-25s kernel.%s - (process %s(%d), parent %s(%d)\n",
ctime(now), probefunc(), execname(), pid(), pexecname(), ppid() )
print_backtrace()
}
And/calling the check partition structure and outputting information such as time, function name and pid. The following function checks for each different partition type. The ctime (now) function prints the current time and $ return is the return value of the previously called checker. If not, 0 is returned. If so, and the partition table is valid, it returns a positive value, and if there is an error, returns a negative value. The method comprises the following steps that an execname () outputs a viewed process name of a disk partition, a pid () shows pid information of a viewed process of the disk partition, and a pexecname () shows a parent process of the viewed process of the disk partition and the pid information of the parent process;
probe kernel.function("efi_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.efi_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("sgi_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.sgi_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("msdos_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.msdos_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("osf_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.osf_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("sun_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.sun_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("amiga_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.amiga_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("mac_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.mac_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
probe kernel.function("karma_partition").return {
now=gettimeofday_s()
printf( "%-25s kernel.karma_partition - return=%d (process %s(%d), parent %s(%d)\n",
ctime(now), $return, execname(), pid(), pexecname(), ppid() )
}
fourth, collecting monitoring log
(1) The name of the tool is "func-watch.
(2) Executing the following commands with root user
stap -g -v func-watch.stp "sleep 3600" > func-watch.log
The invention is further described with reference to the accompanying drawings and specific embodiments. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and these equivalents also fall within the scope of the present application.

Claims (6)

1. A monitoring method based on Linux disk access is characterized by comprising the following steps:
step 1: installing a probe for system monitoring under a Linux system;
step 2: installing a kernel code package for monitoring the Linux system;
and step 3: calling a check partition structure body to check the disk partition;
and 4, step 4: outputting current time, function name, disk partition and pid information;
and 5: collecting a monitoring log;
the step 4 specifically includes:
step 41: calling ctime (now) function to print current time;
step 42: obtaining a return value of the called check partition structure through a $ return command;
step 43: calling an execname () function to output the process name of the disk partition;
step 44: and calling a pid () function to display the pid information of the disk partition process.
2. The Linux disk access-based monitoring method of claim 1, wherein: the probe monitored by the system is systemtap-runtime.
3. The Linux disk access-based monitoring method of claim 1, wherein: the kernel code package for monitoring the Linux system comprises: kernel-debug fo-common, kernel-debug fo and kernel-level.
4. The Linux disk access-based monitoring method of claim 1, wherein the step 42 further comprises: if no value is returned, 0 is output; if yes, and the partition table is valid, outputting a positive value; if there is an error, a negative value is output.
5. The Linux disk access-based monitoring method of claim 1, wherein the step 4 further comprises: and calling a pexecname () function and a ppid () function, and displaying the parent process of the disk partition process and the pid information of the parent process.
6. A monitoring system based on Linux disk access is characterized by comprising:
the monitoring probe installation module is used for installing a system monitoring probe in a Linux system;
the code package installation module is used for installing a kernel code package for monitoring the Linux system;
the checker calling module is used for calling the check partition structure body to check the disk partition;
the display module is used for displaying the function name and the disk partition, calling a ctime (now) function to print the current time, calling an execname () function to output the process name of the disk partition, and calling a pid () function to display the pid information of the process of the disk partition;
the log collection module is used for running a monitoring log collection command and extracting a monitoring log;
a return value output module, configured to obtain a return value of the called check partition structure through a $ return command, and if there is no return value, output 0; if yes, and the partition table is valid, outputting a positive value; if there is an error, a negative value is output.
CN201811377248.4A 2018-11-19 2018-11-19 Monitoring method and system based on Linux disk access Active CN109522186B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811377248.4A CN109522186B (en) 2018-11-19 2018-11-19 Monitoring method and system based on Linux disk access

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811377248.4A CN109522186B (en) 2018-11-19 2018-11-19 Monitoring method and system based on Linux disk access

Publications (2)

Publication Number Publication Date
CN109522186A CN109522186A (en) 2019-03-26
CN109522186B true CN109522186B (en) 2021-11-05

Family

ID=65776662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811377248.4A Active CN109522186B (en) 2018-11-19 2018-11-19 Monitoring method and system based on Linux disk access

Country Status (1)

Country Link
CN (1) CN109522186B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5485579A (en) * 1989-09-08 1996-01-16 Auspex Systems, Inc. Multiple facility operating system architecture
US7689566B1 (en) * 2006-12-12 2010-03-30 Sun Microsystems, Inc. Method for defining non-native operating environments
CN103399812A (en) * 2013-07-22 2013-11-20 西安电子科技大学 Magnetic disc file operation monitoring system and monitoring method based on Xen hardware virtualization
CN105610983A (en) * 2016-03-07 2016-05-25 北京荣之联科技股份有限公司 Distributive network monitoring method and system
CN106970866A (en) * 2017-03-13 2017-07-21 郑州云海信息技术有限公司 A kind of disk monitor system and method
CN107678915A (en) * 2017-09-16 2018-02-09 广西电网有限责任公司电力科学研究院 A kind of power transmission and transforming equipment monitoring platform basic resource monitoring method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130091266A1 (en) * 2011-10-05 2013-04-11 Ajit Bhave System for organizing and fast searching of massive amounts of data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5485579A (en) * 1989-09-08 1996-01-16 Auspex Systems, Inc. Multiple facility operating system architecture
US7689566B1 (en) * 2006-12-12 2010-03-30 Sun Microsystems, Inc. Method for defining non-native operating environments
CN103399812A (en) * 2013-07-22 2013-11-20 西安电子科技大学 Magnetic disc file operation monitoring system and monitoring method based on Xen hardware virtualization
CN105610983A (en) * 2016-03-07 2016-05-25 北京荣之联科技股份有限公司 Distributive network monitoring method and system
CN106970866A (en) * 2017-03-13 2017-07-21 郑州云海信息技术有限公司 A kind of disk monitor system and method
CN107678915A (en) * 2017-09-16 2018-02-09 广西电网有限责任公司电力科学研究院 A kind of power transmission and transforming equipment monitoring platform basic resource monitoring method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Linux-based Memory Efficient ARINC 653 Partition Scheduler;Cheolsoon Kown et al;《IEEE Emerging Technology and Factory Automation》;20141231;1-5页 *
面向NTFS的已损坏文件恢复技术研究;林森;《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》;20180415;第2018年卷(第04期);I138-266页 *

Also Published As

Publication number Publication date
CN109522186A (en) 2019-03-26

Similar Documents

Publication Publication Date Title
CN109284269B (en) Abnormal log analysis method and device, storage medium and server
CN108388489B (en) Server fault diagnosis method, system, equipment and storage medium
US20130132933A1 (en) Automated compliance testing during application development
WO2022089202A1 (en) Fault identification model training method, fault identification method, apparatus and electronic device
CN109213132B (en) Method, device and equipment for generating UDS (Universal description System) diagnosis interface software
CN101093462A (en) Automatization method for testing schooling pressure on database application
CN112287009A (en) Interface calling and interface data warehousing method, device, equipment and storage medium
WO2021244535A1 (en) Vehicle software fault detection method, apparatus and device, and storage medium
CN110379410A (en) Voice response speed automatic analysis method and system
CN112235262A (en) Message analysis method and device, electronic equipment and computer readable storage medium
CN110806955A (en) Method and system for testing DC Cycle of server based on python
CN109522186B (en) Monitoring method and system based on Linux disk access
CN111475351A (en) Method and device for testing IOPS (input/output protection system) consistency of solid state disk and storage medium
US7415560B2 (en) Method of automatically monitoring computer system debugging routine
CN115757045A (en) Transaction log analysis method, system and device
CN109062797B (en) Method and device for generating information
CN105868092A (en) Log file processing method and device
CN113050981A (en) Code on-line automatic publishing method, server and storage medium
CN111338956A (en) Automatic pressure measurement method, device, equipment and storage medium
CN111367765A (en) Method and device for monitoring interface response performance, server and storage medium
CN113821407B (en) Storm distributed real-time computing method and system
CN114024576B (en) Low-voltage power line carrier operation and maintenance control method
CN116302365B (en) Method and device for testing data persistence layer, electronic equipment and storage medium
CN114356061B (en) Power failure detection method, device, system and detection equipment
CN113076379B (en) Method and system for distinguishing element number areas based on digital ICD

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant