CN105677501B - Fining process monitoring method and system in linux system based on house dog - Google Patents

Fining process monitoring method and system in linux system based on house dog Download PDF

Info

Publication number
CN105677501B
CN105677501B CN201610007790.5A CN201610007790A CN105677501B CN 105677501 B CN105677501 B CN 105677501B CN 201610007790 A CN201610007790 A CN 201610007790A CN 105677501 B CN105677501 B CN 105677501B
Authority
CN
China
Prior art keywords
dog
thread
monitoring
dynamic
business process
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
CN201610007790.5A
Other languages
Chinese (zh)
Other versions
CN105677501A (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.)
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services 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 Fiberhome Telecommunication Technologies Co Ltd, Wuhan Fiberhome Technical Services Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201610007790.5A priority Critical patent/CN105677501B/en
Publication of CN105677501A publication Critical patent/CN105677501A/en
Application granted granted Critical
Publication of CN105677501B publication Critical patent/CN105677501B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • 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/3017Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is implementing multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/88Monitoring involving counting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses the fining process monitoring methods and system in a kind of linux system based on house dog, are related to the process monitoring technical field of linux system.This method comprises: judging that this process monitoring is that static monitoring or dynamic monitor according to the monitoring configuration file of creation;It monitors, then each business process is monitored by way of periodically sending specified signal if static state, once discovery business process is not present, then by stopping executing " feeding dog " operation, reset system reboot;It is monitored if dynamic, then only after business process registration, just start to be monitored the business process, the last state of business process is obtained during monitoring by the status frames constantly sent, once it was found that there is exception in business process or system, then by stopping executing " feeding dog " operation, reset system reboot.The present invention can be realized the process monitoring of fining, meet the high quality requirement of process monitoring;And monitor mode is flexible, saves resource, high-efficient.

Description

Fining process monitoring method and system in linux system based on house dog
Technical field
The present invention relates to the process monitoring technical field of linux system, more particularly in a kind of linux system based on seeing The fining process monitoring method and system of door dog.
Background technique
In embedded Linux system, since the work of processor usually will receive the interference from external electromagnetic field, make At run of the program, and endless loop is fallen into, so that the normal operation of program is interrupted, system can not work on, and can make Dead state is fallen at whole system, or even unpredictable consequence occurs.Therefore, it is examined for the stability to linux system Consider, it usually needs the process of operations various in linux system is monitored in real time.
In linux system, process monitoring is substantially the IPC (Inter-Process provided using Linux Communication, interprocess communication) mechanism completes the message transmission between monitoring process and business process.Existing process Monitoring method generally uses a kind of static monitoring mode, i.e., monitoring process is by reading a existing configuration file (configuration The business process of all operations in file record linux system), start to supervise all business process in configuration file Control, during monitoring, monitoring process is by constantly sending signal to each business process, to judge whether each business process is also deposited , and if it exists, it is abnormal then to illustrate that the business process does not occur program fleet etc.;If it does not exist, then illustrate that the business process may It is abnormal to there is program fleet etc..
Existing monitor mode is although simple and easy, but following defect is still remained in use process:
(1) the monitoring fineness of existing monitor mode is not high, program fleet etc. whether can only occurs most to each business process Basic state judged, newest operating status etc. can not more be refined in use state to system and business process Monitoring, it is difficult to meet process monitoring high quality requirement.
(2) in practical applications, some business process cycles of operation are short, frequency of use is low, past for these business process Toward without carrying out long-term real time monitoring.And in existing monitor mode, monitoring process can only be unified to the institute in configuration file There is business process to be monitored, monitor mode is not flexible, the waste for largely monitoring resource is caused, so that whole monitoring efficiency It is low.
Summary of the invention
The purpose of the invention is to overcome the shortcomings of above-mentioned background technique, provide in a kind of linux system based on guarding the gate The fining process monitoring method and system of dog, can be realized the process monitoring of fining, and the high quality for meeting process monitoring is wanted It asks;And monitor mode is flexible, saves resource, high-efficient.
To achieve the above objectives, the present invention provides the fining process monitoring side based on house dog in a kind of linux system Method, comprising the following steps:
S1: creation monitoring configuration file, monitoring configuration file includes house dog timeout value, static traffic process name and prison The type of prosecutor formula, the type of monitor mode are dynamic monitoring or static monitoring, are transferred to S2;
S2: according to the type of monitor mode in monitoring configuration file, judge monitor mode used by this process monitoring It is that static monitoring or dynamic monitor, is monitored if static state, be then transferred to S3;It is monitored if dynamic, is then transferred to S4;
S3: creation is static to feed dog thread and sends thread;Static state feeds dog thread when system is normal, periodically hard to house dog Part executes " feeding dog " operation;When sending thread according to the static traffic process name in monitoring configuration file to corresponding business process When periodically sending specified signal, static state, which feeds dog thread, to judge that corresponding business process is according to the return value of each static traffic process It is no still to exist, if so, static dog thread of feeding continues to execute " feeding dog " operation, system is made to continue to operate normally;Otherwise, static Dog thread stopping execution " feeding dog " operation is fed, dwell time is more than system reboot reset after house dog timeout value, end;
S4: creation dynamic feeds dog thread and receiving thread;Dynamic feeds dog thread when system is normal, periodically hard to house dog Part executes " feeding dog " operation;After having business process to be registered to receiving thread, receiving thread starts to receive by the business process not The disconnected status frames issued, and pass through the last state of status frames acquisition business process;Dynamic feed dog thread to business process most The use state of new state and system is monitored, and when business process and normal system, dynamic is fed dog thread and continued to execute " feeding dog " operation, makes system continue to operate normally;When finding that business process or system occur abnormal, dynamic is fed dog thread and is then stopped " feeding dog " operation is only executed, more than after house dog timeout value, system reboot resets dwell time, terminates;
S4 specifically includes the following steps:
S401:, which creating, and initializes dynamic feeds dog thread, will creation communication channel and process status information when initialization Table, wherein process status information table is used to store the status information of all monitored business process, is transferred to S402:
S402: dynamic feeds dog thread creation and starts receiving thread;After receiving thread starting, dynamic is fed dog thread and is entered " feeding dog " circulation: when system is normal, " feeding dog " operation periodically is executed to house dog hardware;When there is business process to be registered to reception After thread, the status information for the business process currently registered can be added in process status information table by receiving thread, business into Journey constantly sends status frames to receiving thread by communication channel, and receiving thread obtains business process according to the status frames received Newest status information, and update process status information table;Dynamic feeds dog thread and inspects periodically process status information table, and in real time The use state information of acquisition system, when business process and normal system, dynamic feeds dog thread and continues to execute " feeding dog " behaviour Make, system is made to continue to operate normally;When finding that business process or system occur abnormal, dynamic feeds dog thread and then stops executing " feeding dog " operation, dwell time are more than system reboot reset after house dog timeout value, end.
Based on the above technical solution, the structure phase of the list item of the process status information table and the status frames Together, include following field:
Process number: for identifying the business process for sending status frames;
Thread number: for sending the thread number or handle of status frames in identification service process;
It terminates the time: indicating that business process sends the largest interval value of status frames, value >=0 next time;
Abnormal coding: the anomalous sign current for identification service process, it is consistent with the errno coding of system;
Prompt information: the information to go wrong for alerting certain thread.
Based on the above technical solution, in S402, when receiving thread updates process status information table every time, will into The termination time field of journey status information table is reset;When dynamic hello dog thread inspects periodically process status information table every time, Termination time field to process status information table is carried out subtracting one operation;Once the termination time field of a certain business process subtracts It is 0, then it is abnormal shows that the business process occurs.
It based on the above technical solution,, will when dynamic hello dog thread inspects periodically process status information table in S402 According to the abnormal code field of process status information table, judge whether the exception will affect the operation of system, if so, showing industry Business process occurs abnormal;Otherwise, show that business thread does not occur exception.
Based on the above technical solution, the content for configuration file being monitored described in S1 further includes under system free memory Boundary's threshold value;The use state information of real-time acquisition system described in S402, specifically includes the following steps: being worked as by df order acquisition Preceding Flash utilization rate;Current system memory usage is obtained using cat/proc/memeinfo order;Use cat/proc/ Stat order obtains current system CPU usage;There is exception in system described in S402, specifically includes following situations: current Flash utilization rate is beyond 80% or current system memory usage beyond system free memory lower bound threshold value in monitoring configuration file Or current system CPU usage exceeds 80%.
Based on the above technical solution, business process described in S402 is constantly sent out to receiving thread by communication channel When sending status frames, business process judges the transmission state to status frames, if transmission process malfunctions, business process will be from Registration is solved in receiving process.
Based on the above technical solution, in S402, receiving thread when updating process status information table, will lock up into Journey status information table;In S402, when dynamic hello dog thread inspects periodically process status information table, process status information will lock up Table.
Based on the above technical solution, it is the spacing wave that number is 0 that signal is specified described in S3.
The present invention also provides the fining process monitoring systems in a kind of linux system for realizing the above method based on house dog System, including monitoring configuration file creation module, monitor mode judgment module, static monitoring module and dynamic monitoring module;
The monitoring configuration file creation module is used for: creation monitoring configuration file, monitoring configuration file includes house dog The type of timeout value, static traffic process name and monitor mode, the type of monitor mode are that dynamic monitoring or static state monitor, to The transmission of monitor mode judgment module judges signal;
The monitor mode judgment module is used for: being received after judging signal, according to monitor mode in monitoring configuration file Type judges that monitor mode used by this process monitoring is that static monitoring or dynamic monitor, monitors if static state, then to Static monitoring module sends static monitoring signal;It is monitored if dynamic, then sends dynamic monitoring signal to dynamic monitoring module;
The static state monitoring module is used for: after receiving static monitoring signal, creation is static to feed dog thread and sends thread;It is quiet State feeds dog thread when system is normal, periodically executes " feeding dog " operation to house dog hardware;It is configured when sending thread according to monitoring When static traffic process name in file periodically sends specified signal to corresponding business process, static state feeds dog thread will be according to each The return value of static traffic process judges whether corresponding business process still exists, if so, static dog thread of feeding continues to execute " feeding dog " operation, makes system continue to operate normally;Otherwise, static dog thread of feeding stops executing " feeding dog " operation, and dwell time is super After crossing house dog timeout value, system reboot resets;
The dynamic monitoring module is used for: after receiving dynamic monitoring signal, creation dynamic feeds dog thread and receiving thread;It is dynamic State feeds dog thread when system is normal, periodically executes " feeding dog " operation to house dog hardware;When there is business process to be registered to reception After thread, receiving thread starts to receive the status frames constantly issued by the business process, and obtains business process by status frames Last state;Dynamic feed dog thread the last state of business process and the use state of system are monitored, when business into When journey and normal system, dynamic feeds dog thread and continues to execute " feeding dog " operation, makes system continue to operate normally, when discovery business When process or system occur abnormal, dynamic feeds dog thread and then stops executing " feeding dog " operation, and dwell time is more than house dog time-out After value, system reboot resets.
Compared with prior art, advantages of the present invention is as follows:
(1) compared with the simple monitor mode using static state in the prior art, the present invention is in general static monitor mode On the basis of joined dynamic monitor mode.In dynamic monitor mode, it is somebody's turn to do using the status frames that business process constantly issues The last state of business process;It is monitored by the use state of last state and system to business process, to realize The process monitoring more refined can satisfy the high quality requirement of process monitoring.
(2) in the present invention, the mode of process monitoring can be selected according to the use demand of user, so that monitor mode It is more flexible, traditional static monitor mode was not only remained, but also joined the stronger dynamic monitor mode of flexibility;Dynamic monitors Mode is by login mechanism, and reaching a kind of passive monitoring state, (only in a certain business process by registration, request is monitored Afterwards, just the business process is monitored).Compared with it must carry out unified monitoring to all business process in the prior art, this Kind passive monitoring state avoids the case where business process progress short to the cycle of operation, that frequency of use is low actively monitors, effectively The waste for reducing monitoring resource, improves whole monitoring efficiency.
(3) static monitor mode of the invention and dynamic monitor mode are based on watchdog technique and realize that restarting for system is multiple Position.Once just stopping operating house dog hardware execution " feeding dog ", dwell time is super it was found that exception occur in business process or system After crossing house dog timeout value, system reboot can be made to reset, ensure that the validity and stabilization of process monitoring on hardware-level Property.
Detailed description of the invention
Fig. 1 is the flow chart of the fining process monitoring method in the embodiment of the present invention in linux system based on house dog;
Fig. 2 is the timing diagram dynamically monitored in the embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawing and specific embodiment the present invention is described in further detail.
Shown in Figure 1, the embodiment of the present invention provides the fining process monitoring based on house dog in a kind of linux system Method, comprising the following steps:
S1: creation monitoring configuration file, monitoring configuration file include system free memory lower bound threshold value, house dog time-out Value, the type of monitor mode (dynamic monitoring or static monitoring) and static traffic process name, are transferred to S2.
When specific operation, the format that configuration file is monitored described in S1 is " configuration item=entry value ", wherein in the system free time Leave boundary's threshold value is indicated with configuration item min-memory;House dog timeout value is indicated with configuration item watchdog-timeout;Prison The type of prosecutor formula is indicated with configuration item type;Static traffic process name is indicated with configuration item task.
S2: according to the type of monitor mode in monitoring configuration file, judge monitor mode used by this process monitoring It is that static monitoring or dynamic monitor, is monitored if static state, be then transferred to S3;It is monitored if dynamic, is then transferred to S4.
S3: creation is static to feed dog thread and sends thread;Static state feeds dog thread when system is normal, periodically hard to house dog Part executes " feeding dog " operation;When sending thread according to the static traffic process name in monitoring configuration file to corresponding business process When periodically sending specified signal, static state, which feeds dog thread, to judge that corresponding business process is according to the return value of each static traffic process It is no still to exist, if so, static dog thread of feeding continues to execute " feeding dog " operation, system is made to continue to operate normally;Otherwise, static Dog thread stopping execution " feeding dog " operation is fed, dwell time is more than system reboot reset after house dog timeout value, end.
When specific operation, it is the spacing wave (being defined by POSIX.1 standard) that number is 0 that signal is specified described in S3.
S4: creation dynamic feeds dog thread and receiving thread;Dynamic feeds dog thread when system is normal, periodically hard to house dog Part executes " feeding dog " operation;After having business process to be registered to receiving thread, receiving thread starts to receive by the business process not The disconnected status frames issued, and pass through the last state of status frames acquisition business process;Dynamic feed dog thread to business process most The use state of new state and system is monitored, and when business process and normal system, dynamic is fed dog thread and continued to execute " feeding dog " operation, makes system continue to operate normally;When finding that business process or system occur abnormal, dynamic is fed dog thread and is then stopped " feeding dog " operation is only executed, more than after house dog timeout value, system reboot resets dwell time, terminates.
House dog hardware is commonly called as " house dog " (watchdog), and house dog can be built in processor, also can handle device External, the present embodiment uses external house dog.
House dog allows system to realize continuous work under unmanned state, its working principle is that: watchdog chip and place An I/O pin for managing device is connected, it is special periodically toward feeding on this pin of house dog by process control for the I/O pin Determine signal (pulse or low and high level), this program be dispersedly be located at other control programs in, once processor due to interference It causes to fall into a certain program segment after program fleet when entering endless loop state, writes the program (being commonly called as " feeding dog ") of house dog pin Just it cannot be performed.This when, the signal that watchdog chip is sent due to cannot get processor, just in it and processor reset A reset signal is sent out on the connected pin of pin, resets processor, i.e. start bit of the program from program storage It sets and starts to execute, just realize the automatic recovery of processor in this way.
The core of house dog is one, and from the counter subtracted, counter starts to subtract certainly after house dog setting initial value, if It has been more than that house dog timeout value does not go also to feed dog, then house dog counter will reduce to 0 so as to cause house dog interruption, has caused System reset.
It is shown in Figure 2 when practical operation, S4 specifically includes the following steps:
S401:, which creating, and initializes dynamic feeds dog thread, will creation communication channel and process status information when initialization Table, wherein process status information table is used to store the status information of all monitored business process, is transferred to S402:
Communication channel of the invention use message queue or pipeline, i.e., the transmission of status frames by message queue or pipeline come It realizes.Using the chained list that can be regarded as a message when message queue, it regards message as a record, and this is remembered Record has specific format and specific priority.There is the process of write permission that can add according to certain rules message queue Add new information;There is the process of read right that can then read message from message queue message queue.The sender of this message The advantages of formula is: the message that sender need not wait recipient to check that it is received can work on down, and recipient If do not receive message also without waiting for.
S402: dynamic feeds dog thread creation and starts receiving thread;After receiving thread starting, dynamic is fed dog thread and is entered " feeding dog " circulation: when system is normal, " feeding dog " operation periodically is executed to house dog hardware;When there is business process to be registered to reception After thread, the status information for the business process currently registered can be added in process status information table by receiving thread, business into Journey constantly sends status frames to receiving thread by communication channel, and receiving thread obtains business process according to the status frames received Newest status information, and update process status information table;Dynamic feeds dog thread and inspects periodically process status information table, and in real time The use state information of acquisition system, when business process and normal system, dynamic feeds dog thread and continues to execute " feeding dog " behaviour Make, system is made to continue to operate normally;When finding that business process or system occur abnormal, dynamic feeds dog thread and then stops executing " feeding dog " operation, dwell time are more than system reboot reset after house dog timeout value, end.
Wherein, process status information table can use chained list or storage of array;Table 1 is process status information table list item, table 2 For state frame structure:
Table 1, process status information table list item
Process number Thread number Terminate the time Exception code Prompt information
4Bytes 4Bytes 4Bytes 4Bytes (1-16)Bytes
Table 2, state frame structure
Process number Thread number Terminate the time Exception code Prompt information
4Bytes 4Bytes 4Bytes 4Bytes (1-16)Bytes
Include following field by table 1, table 2 it is found that the list item of process status information table and the structure of status frames are identical:
Process number: for identifying the business process for sending status frames;
Thread number: for sending the thread number (or handle) of status frames in identification service process;Pass through the information field What can be will be apparent that knows, which the specific thread for sending status frames is, that is to say, that once the appearance of some business process is different Often, we can smoothly find specific corresponding thread number by the field, to realize the thread-level to business process Monitoring is more advantageous to abnormal positioning and investigation so that monitoring is more fine, accurate;
It terminates the time: indicating that business process sends the largest interval value of status frames, value >=0 next time;
Abnormal coding: the anomalous sign current for identification service process, it is consistent with the errno coding of system;
Prompt information: the information to go wrong for alerting certain thread.
Wherein, process number, thread number, termination time, abnormal coding use big end syllable sequence (network bytes sequence).Prompt (the corresponding UTF-8 of ascii character-set is compatible, therefore is concentrated use in the character that appendix A PI is limited using ASCII character for information UTF-8 and ASCII are ok), big small end problem is not present, sequentially sends.
More specifically, in S402, it, will be to process status information table when receiving thread updates process status information table every time Time field is terminated to be reset;When dynamic hello dog thread inspects periodically process status information table every time, process status will be believed The termination time field of breath table carries out subtracting one (update) operation;Once the termination time field of a certain business process is kept to 0, then table There is exception and (exceeds schedule time and do not receive status frames, then it is assumed that business process " is died " or run in the bright business process Fly).
In addition to this, in S402, when dynamic hello dog thread inspects periodically process status information table, will be believed according to process status The abnormal code field for ceasing table, judges whether the exception will affect the operation of system, if so, it is different to show that business process occurs Often;Otherwise, show that business thread does not occur exception.
Further, the use state information of real-time acquisition system described in S402, specifically includes the following steps: passing through df Order obtains current Flash utilization rate;Current system memory usage is obtained using cat/proc/memeinfo order;It uses Cat/proc/stat order obtains current system CPU usage.There is exception in system described in S402, specifically includes following feelings Condition: current Flash utilization rate is beyond 80% or current system memory usage beyond system free memory in monitoring configuration file Lower bound threshold value or current system CPU usage exceed 80%.
In order to improve the validity and reliability of entire monitoring process, business process described in S402 passes through communication channel not Break to receiving thread send status frames when, business process judges the transmission state to status frames, if transmission process goes out Mistake, business process will solve registration from receiving process.
In practical operation, receiving thread and dynamic feed dog thread when accessing process status information table, it may occur however that thread Competition.In order to avoid race problem, receiving thread and dynamic feed dog thread and need to make when being written and read process status information table Use mutual exclusion lock.Specifically, shown in Figure 2, in S402, receiving thread when updating process status information table, will lock up into Journey status information table;In S402, when dynamic hello dog thread inspects periodically process status information table, process status information will lock up Table.
The embodiment of the present invention also provides the fining process based on house dog in a kind of linux system for realizing the above method Monitoring system, including monitoring configuration file creation module, monitor mode judgment module, static monitoring module and dynamic monitoring mould Block;
Wherein, monitoring configuration file creation module is used for: creation monitoring configuration file, monitoring configuration file includes house dog The type of timeout value, static traffic process name and monitor mode, the type of monitor mode are that dynamic monitoring or static state monitor, to The transmission of monitor mode judgment module judges signal;
Monitor mode judgment module is used for: receive after judging signal, according to monitoring configuration file in monitor mode type, Judge that monitor mode used by this process monitoring is that static monitoring or dynamic monitor, is monitored if static state, then to static state Monitoring module sends static monitoring signal;It is monitored if dynamic, then sends dynamic monitoring signal to dynamic monitoring module;
Static monitoring module is used for: after receiving static monitoring signal, creation is static to feed dog thread and sends thread;Static state is fed Dog thread periodically executes " feeding dog " operation to house dog hardware when system is normal;When transmission thread is according to monitoring configuration file In static traffic process name when periodically sending specified signal to corresponding business process, static state feeds dog thread will be according to each static state The return value of business process judges whether corresponding business process still exists, if so, static hello dog thread is continued to execute and " fed Dog " operation, makes system continue to operate normally;Otherwise, static dog thread of feeding stops executing " feeding dog " operation, and dwell time is more than to see After door dog timeout value, system reboot resets;
Dynamic monitoring module is used for: after receiving dynamic monitoring signal, creation dynamic feeds dog thread and receiving thread;Dynamic is fed Dog thread periodically executes " feeding dog " operation to house dog hardware when system is normal;When there is business process to be registered to receiving thread Afterwards, receiving thread starts to receive the status frames constantly issued by the business process, and obtains business process most by status frames New state;Dynamic is fed dog thread and is monitored to the last state of business process and the use state of system, when business process and When system is normal, dynamic feeds dog thread and continues to execute " feeding dog " operation, makes system continue to operate normally, when discovery business process Or system is when occurring abnormal, and dynamic feeds dog thread and then stops executing " feeding dog " operation, after dwell time is more than house dog timeout value, System reboot resets.
Specifically, which includes initial setting up submodule and monitoring management submodule;
Initial setting up submodule is used for: create and initialize dynamic and feed dog thread, when initialization, create communication channel and into Journey status information table, wherein process status information table is used to store the status information of all monitored business process, to monitoring It manages submodule and sends monitoring management signal:
Monitoring management submodule is used for: after receiving monitoring management signal, control dynamic feeds dog thread creation and starts reception Thread;After receiving thread starting, dynamic feeds dog thread and enters " feeding dog " circulation: when system is normal, periodically to house dog hardware Execute " feeding dog " operation;After having business process to be registered to receiving thread, receiving thread can be by the business process currently registered Status information is added in process status information table, and business process constantly sends status frames to receiving thread by communication channel, Receiving thread obtains the newest status information of business process according to the status frames received, and updates process status information table;Dynamically It feeds dog thread and inspects periodically process status information table, and the use state information of real-time acquisition system, when business process and system When normal, dynamic feeds dog thread and continues to execute " feeding dog " operation, and system is made to continue to operate normally;When discovery business process or it is When system occurs abnormal, dynamic feeds dog thread and then stops executing " feeding dog " operation, and dwell time is more than system after house dog timeout value Restart reset.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (9)

1. the fining process monitoring method in a kind of linux system based on house dog, which comprises the following steps:
S1: creation monitoring configuration file, monitoring configuration file includes house dog timeout value, static traffic process name and monitoring side The type of formula, the type of monitor mode are dynamic monitoring or static monitoring, are transferred to S2;
S2: according to the type of monitor mode in monitoring configuration file, judge that monitor mode used by this process monitoring is quiet State monitoring or dynamic monitor, and monitor if static state, are then transferred to S3;It is monitored if dynamic, is then transferred to S4;
S3: creation is static to feed dog thread and sends thread;Static state feeds dog thread when system is normal, periodically holds to house dog hardware Row " feeding dog " operation;It is regular to corresponding business process according to the static traffic process name in monitoring configuration file when sending thread When sending specified signal, static state feed dog thread by according to the return value of each static traffic process judge to correspond to business process whether according to Old presence makes system continue to operate normally if so, static dog thread of feeding continues to execute " feeding dog " operation;Otherwise, static to feed dog Thread stops executing " feeding dog " operation, and more than after house dog timeout value, system reboot resets dwell time, terminates;
S4: creation dynamic feeds dog thread and receiving thread;Dynamic feeds dog thread when system is normal, periodically holds to house dog hardware Row " feeding dog " operation;After having business process to be registered to receiving thread, receiving thread starts to receive constantly to be sent out by the business process Status frames out, and pass through the last state of status frames acquisition business process;Dynamic feeds dog thread to the newest shape of business process The use state of state and system is monitored, and when business process and normal system, dynamic feeds dog thread and continues to execute " hello Dog " operation, makes system continue to operate normally;When finding that business process or system occur abnormal, dynamic is fed dog thread and is then stopped " feeding dog " operation is executed, more than after house dog timeout value, system reboot resets dwell time, terminates;
S4 specifically includes the following steps:
S401:, which creating, and initializes dynamic feeds dog thread, when initialization, will creation communication channel and process status information table, In, process status information table is used to store the status information of all monitored business process, it is transferred to S402:
S402: dynamic feeds dog thread creation and starts receiving thread;After receiving thread starting, dynamic feeds dog thread and enters " feeding dog " Circulation: when system is normal, " feeding dog " operation periodically is executed to house dog hardware;When there is business process to be registered to receiving thread Afterwards, the status information for the business process currently registered can be added in process status information table by receiving thread, and business process is logical It crosses communication channel and constantly sends status frames to receiving thread, receiving thread obtains business process most according to the status frames received New state information, and update process status information table;Dynamic feeds dog thread and inspects periodically process status information table, and obtains in real time The use state information of system, when business process and normal system, dynamic feeds dog thread and continues to execute " feeding dog " operation, makes System continues to operate normally;When finding that business process or system occur abnormal, dynamic feeds dog thread and then stops executing " feeding dog " Operation, dwell time are more than system reboot reset after house dog timeout value, end.
2. the fining process monitoring method in linux system as described in claim 1 based on house dog, it is characterised in that: The list item of the process status information table is identical as the structure of the status frames, includes following field:
Process number: for identifying the business process for sending status frames;
Thread number: for sending the thread number or handle of status frames in identification service process;
It terminates the time: indicating that business process sends the largest interval value of status frames, value >=0 next time;
Abnormal coding: the anomalous sign current for identification service process, it is consistent with the errno coding of system;
Prompt information: the information to go wrong for alerting certain thread.
3. the fining process monitoring method in linux system as claimed in claim 2 based on house dog, it is characterised in that: In S402, when receiving thread updates process status information table every time, the termination time field to process status information table is carried out Resetting;When dynamic hello dog thread inspects periodically process status information table every time, by the termination time word to process status information table Operation that Duan Jinhang subtracts one;Once the termination time field of a certain business process is kept to 0, then it is abnormal to show that the business process occurs.
4. the fining process monitoring method in linux system as claimed in claim 2 based on house dog, it is characterised in that: It, will be according to the abnormal coded word of process status information table when dynamic hello dog thread inspects periodically process status information table in S402 Section, judges whether the exception will affect the operation of system, if so, it is abnormal to show that business process occurs;Otherwise, show service line Cheng Wei occurs abnormal.
5. the fining process monitoring method in linux system as described in claim 1 based on house dog, it is characterised in that: It further includes system free memory lower bound threshold value that the content of configuration file is monitored described in S1;
The use state information of real-time acquisition system described in S402, specifically includes the following steps: being obtained by df order current Flash utilization rate;Current system memory usage is obtained using cat/proc/memeinfo order;Use cat/proc/stat Order obtains current system CPU usage;
Exception occurs in system described in S402, specifically includes following situations: current Flash utilization rate is beyond 80% or current system Memory usage exceeds 80% beyond system free memory lower bound threshold value in monitoring configuration file or current system CPU usage.
6. the fining process monitoring method in linux system as described in claim 1 based on house dog, it is characterised in that: When business process described in S402 constantly sends status frames to receiving thread by communication channel, business process will be to status frames Transmission state is judged, if transmission process malfunctions, business process will solve registration from receiving process.
7. the fining process monitoring method in linux system as described in claim 1 based on house dog, it is characterised in that: In S402, receiving thread will lock up process status information table when updating process status information table;In S402, dynamic feeds dog line When journey inspects periodically process status information table, process status information table will lock up.
8. the fining process monitoring method in linux system as described in claim 1 based on house dog, it is characterised in that: It is the spacing wave that number is 0 that signal is specified described in S3.
9. the fining process monitoring system in a kind of linux system for realizing claim 1 the method based on house dog, It is characterized in that: including monitoring configuration file creation module, monitor mode judgment module, static monitoring module and dynamic monitoring mould Block;
The monitoring configuration file creation module is used for: creation monitoring configuration file, and monitoring configuration file includes house dog time-out The type of value, static traffic process name and monitor mode, the type of monitor mode is dynamic monitoring or static monitoring, to monitoring The transmission of mode judgment module judges signal;
The monitor mode judgment module is used for: receive after judging signal, according to monitoring configuration file in monitor mode type, Judge that monitor mode used by this process monitoring is that static monitoring or dynamic monitor, is monitored if static state, then to static state Monitoring module sends static monitoring signal;It is monitored if dynamic, then sends dynamic monitoring signal to dynamic monitoring module;
The static state monitoring module is used for: after receiving static monitoring signal, creation is static to feed dog thread and sends thread;Static state is fed Dog thread periodically executes " feeding dog " operation to house dog hardware when system is normal;When transmission thread is according to monitoring configuration file In static traffic process name when periodically sending specified signal to corresponding business process, static state feeds dog thread will be according to each static state The return value of business process judges whether corresponding business process still exists, if so, static hello dog thread is continued to execute and " fed Dog " operation, makes system continue to operate normally;Otherwise, static dog thread of feeding stops executing " feeding dog " operation, and dwell time is more than to see After door dog timeout value, system reboot resets;
The dynamic monitoring module is used for: after receiving dynamic monitoring signal, creation dynamic feeds dog thread and receiving thread;Dynamic is fed Dog thread periodically executes " feeding dog " operation to house dog hardware when system is normal;When there is business process to be registered to receiving thread Afterwards, receiving thread starts to receive the status frames constantly issued by the business process, and obtains business process most by status frames New state;Dynamic is fed dog thread and is monitored to the last state of business process and the use state of system, when business process and When system is normal, dynamic feeds dog thread and continues to execute " feeding dog " operation, makes system continue to operate normally, when discovery business process Or system is when occurring abnormal, and dynamic feeds dog thread and then stops executing " feeding dog " operation, after dwell time is more than house dog timeout value, System reboot resets.
CN201610007790.5A 2016-01-07 2016-01-07 Fining process monitoring method and system in linux system based on house dog Active CN105677501B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610007790.5A CN105677501B (en) 2016-01-07 2016-01-07 Fining process monitoring method and system in linux system based on house dog

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610007790.5A CN105677501B (en) 2016-01-07 2016-01-07 Fining process monitoring method and system in linux system based on house dog

Publications (2)

Publication Number Publication Date
CN105677501A CN105677501A (en) 2016-06-15
CN105677501B true CN105677501B (en) 2019-01-29

Family

ID=56299165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610007790.5A Active CN105677501B (en) 2016-01-07 2016-01-07 Fining process monitoring method and system in linux system based on house dog

Country Status (1)

Country Link
CN (1) CN105677501B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107783854B (en) * 2016-08-29 2021-08-20 华为技术有限公司 Method and device for processing progress
CN108694093A (en) * 2017-04-06 2018-10-23 迈普通信技术股份有限公司 Process exception monitoring method and device
CN107133167A (en) * 2017-04-24 2017-09-05 北京北信源软件股份有限公司 The abnormal method and device of real-time monitoring process under a kind of linux system
CN107515796B (en) * 2017-07-31 2020-08-25 奇安信科技集团股份有限公司 Equipment abnormity monitoring processing method and device
CN107623829B (en) * 2017-08-30 2020-07-07 中国航空无线电电子研究所 File management method in video recording equipment
WO2019061407A1 (en) * 2017-09-30 2019-04-04 华为技术有限公司 Method and device for handling timeout of system service
CN109697075A (en) * 2017-10-20 2019-04-30 北京京东尚科信息技术有限公司 File updating method, system and device
CN107844312A (en) * 2017-11-06 2018-03-27 深圳市新国都技术股份有限公司 A kind of software upgrading monitoring method and system
CN108304275A (en) * 2018-01-09 2018-07-20 福州瑞芯微电子股份有限公司 A kind of method and apparatus of detection Android system application layer exception
CN108415806A (en) * 2018-02-07 2018-08-17 深圳市亿联智能有限公司 A kind of high efficiency thread life monitoring mode
CN108762967B (en) * 2018-05-30 2021-08-24 宁波市标准化研究院 Software watchdog implementation method for monitoring Web service in Linux system
CN111078441A (en) * 2018-10-19 2020-04-28 迈普通信技术股份有限公司 System running state monitoring method and device and electronic equipment
CN110032487A (en) * 2018-11-09 2019-07-19 阿里巴巴集团控股有限公司 Keep Alive supervision method, apparatus and electronic equipment
CN112346906A (en) * 2019-08-08 2021-02-09 丰鸟航空科技有限公司 Unmanned aerial vehicle daemon processing method, device, equipment and storage medium
CN110912785A (en) * 2019-12-26 2020-03-24 联陆智能交通科技(上海)有限公司 RSU health detection method and system
CN111856991B (en) * 2020-06-22 2021-11-16 北京遥测技术研究所 Signal processing system and method with five-level protection on single event upset
CN112749038B (en) * 2021-01-26 2023-03-10 北京中电兴发科技有限公司 Method and system for realizing software watchdog in software system
CN113778724B (en) * 2021-05-17 2024-03-22 北京科益虹源光电技术有限公司 Method and device for shielding watchdog

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101311910A (en) * 2008-06-27 2008-11-26 北京星网锐捷网络技术有限公司 Hardware reset control method and apparatus
CN101739305A (en) * 2010-02-09 2010-06-16 太仓市同维电子有限公司 Operating system kernel level real-time dongle monitoring device and monitoring method thereof
CN103885847A (en) * 2014-02-08 2014-06-25 京信通信系统(中国)有限公司 Dog feeding method and device based on embedded system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6282675B1 (en) * 1997-08-06 2001-08-28 Macronix International Co., Ltd. Fault-tolerant architecture for in-circuit programming

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101311910A (en) * 2008-06-27 2008-11-26 北京星网锐捷网络技术有限公司 Hardware reset control method and apparatus
CN101739305A (en) * 2010-02-09 2010-06-16 太仓市同维电子有限公司 Operating system kernel level real-time dongle monitoring device and monitoring method thereof
CN103885847A (en) * 2014-02-08 2014-06-25 京信通信系统(中国)有限公司 Dog feeding method and device based on embedded system

Also Published As

Publication number Publication date
CN105677501A (en) 2016-06-15

Similar Documents

Publication Publication Date Title
CN105677501B (en) Fining process monitoring method and system in linux system based on house dog
US10372199B2 (en) Apparatus for managing power and running and booting an inter-processor communication link between independently operable processors
CN101799751B (en) Method for building monitoring agent software of host machine
CN100555228C (en) A kind of method for supervising of embedded LINUX applications progress
CN109388537B (en) Operation information tracking method and device and computer readable storage medium
CN102761439B (en) Device and method for detecting and recording abnormity on basis of watchdog in PON (Passive Optical Network) access system
US8843930B2 (en) Thread scheduling and control framework
CN102902589B (en) The management of a kind of cluster MIC operation and dispatching method
CN108259270A (en) A kind of data center's system for unified management design method
WO2012055303A1 (en) Method and system for detecting anomaly of network processor
CN102999384B (en) Managing processes within suspend states and execution states
CN101464811A (en) Multitask monitoring management system
KR20130086371A (en) A method and system for cell recovery in telecommunication networks
CN106775659A (en) Embedded dual core Flight Control Software framework method based on high speed Linkport interfaces
CN1784656A (en) Monitoring operational data in data processing systems
CN105527878B (en) A kind of collecting method, device and data acquire debugging system
CN101639803A (en) Exception handling method and exception handling device for multithread application system
CN109271256A (en) A kind of cloud resource management and monitoring system and method based on distributed deployment
US9176783B2 (en) Idle transitions sampling with execution context
CN109117279A (en) The method that is communicated between electronic device and its limiting process, storage medium
CN109947576B (en) Method for managing internal agent program of virtual machine
CN111078441A (en) System running state monitoring method and device and electronic equipment
CN102521060A (en) Pseudo halt solving method of high-availability cluster system based on watchdog local detecting technique
CN112068963B (en) Distributed scheduling system of embedded system
CN108121730B (en) Device and method for quickly synchronizing data update to service system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20180322

Address after: 430074 Wuhan, Hongshan Province District Road, Department of mail, No. 88 hospital

Applicant after: Fenghuo Communication Science &. Technology Co., Ltd.

Applicant after: WUHAN FIBERHOME TECHNICAL SERVICES CO., LTD.

Address before: 430074 East Lake Development Zone, Hubei, Optics Valley Venture Street, No. 67, No.

Applicant before: Fenghuo Communication Science &. Technology Co., Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant