CN110601879B - Method and device for forming Zabbix alarm process information and storage medium - Google Patents

Method and device for forming Zabbix alarm process information and storage medium Download PDF

Info

Publication number
CN110601879B
CN110601879B CN201910814528.5A CN201910814528A CN110601879B CN 110601879 B CN110601879 B CN 110601879B CN 201910814528 A CN201910814528 A CN 201910814528A CN 110601879 B CN110601879 B CN 110601879B
Authority
CN
China
Prior art keywords
alarm
information
zabbix
command
log file
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
CN201910814528.5A
Other languages
Chinese (zh)
Other versions
CN110601879A (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.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN201910814528.5A priority Critical patent/CN110601879B/en
Publication of CN110601879A publication Critical patent/CN110601879A/en
Application granted granted Critical
Publication of CN110601879B publication Critical patent/CN110601879B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0246Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • H04L41/064Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis involving time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method for forming Zabbix alarm process information, which comprises the following steps: acquiring a host IP (Internet protocol) and alarm time when an alarm occurs; acquiring a shell script monitored by Zabbix on the alarm host; obtaining a log file which needs to be inquired in the shell script; analyzing the obtained shell script and extracting a command of a part where an alarm occurs; substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and analyzing the obtained log file by operating the new command to obtain process information data for triggering the alarm. The method and the system can automatically inquire the process information for triggering the alarm and have stronger generalization capability.

Description

Method and device for forming Zabbix alarm process information and storage medium
Technical Field
The invention relates to the technical field of cloud monitoring, in particular to a method and a device for forming Zabbix alarm process information and a storage medium.
Background
Zabbix is an enterprise-level open source solution providing distributed system monitoring and network monitoring functions based on a WEB interface, and can realize monitoring of CPU load, memory use state, disk use state, network condition, ports and logs.
For a simple monitoring scene, the monitoring can be realized through a function carried by Zabbix; for complex monitoring scenarios, custom shell scripts are needed to assist Zabbix monitoring. For complex monitoring scenarios, the general implementation logic is in the shell script part, and the shell script only returns an alarm result to Zabbix, so that when such an alarm occurs, the alarm mail only carries one result, and the root cause of the alarm needs to be manually inquired.
Therefore, a method for automatically displaying the cause of the Zabbix alarm is needed.
Disclosure of Invention
The invention provides a method for forming Zabbix alarm process information, an electronic device and a computer readable storage medium, and mainly aims to realize automatic inquiry of alarm-triggering process information through a shell script, and the method can be applied to various scenes and has stronger generalization capability.
In order to achieve the above object, the present invention further provides a method for forming Zabbix alarm process information, which includes: s110, acquiring the IP of a host with alarm and alarm time; s120, obtaining a shell script monitored by Zabbix on the alarm host; s130, obtaining a log file needing to be inquired in the shell script; s140, analyzing the acquired shell script and extracting a command of an alarm part; s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and S160, analyzing the obtained log file by operating the new command to obtain process information data for triggering the alarm.
Preferably, the analyzing the obtained shell script in the step S140 and extracting the command for generating the alarm part includes: s210, intercepting a log file from the obtained log file for analysis; s220, intercepting a row containing a time period for generating an alarm in the intercepted log file; s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information causing the alarm; and S240, determining a shell command for triggering the alarm according to the alarm information.
Preferably, when the information causing the Zabbix alarm is that the response time of the interface is too long, the method for obtaining the average response time of the interface includes: in step S220, after intercepting a row containing a time period during which an alarm is generated in the intercepted log file, extracting a row containing interface response time in the intercepted row; determining a total number of rows and a total interface response time from the extracted rows containing the interface response time, and obtaining an average response time according to the following formula: average response time = total response time/total number of rows. Preferably, the shell script comprises a shell command, and the shell command is used for capturing and displaying information data of an alarm process.
Preferably, the information data of the alarm process includes the execution content information and the archive operation information of the execution time.
To achieve the above object, the present invention provides an electronic device, comprising: the device comprises a memory and a processor, wherein the memory comprises a forming program of the Zabbix alarm process information, and the forming program of the Zabbix alarm process information realizes the following steps when being executed by the processor: s110, acquiring the IP of a host with alarm and alarm time; s120, obtaining a shell script monitored by Zabbix on the alarm host; s130, obtaining a log file needing to be inquired in the shell script; s140, analyzing the acquired shell script and extracting a command of an alarm part; s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and S160, analyzing the acquired log file by operating the new command to obtain process information data for triggering the alarm.
In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a Zabbix alarm procedure information forming program, and when the Zabbix alarm procedure information forming program is executed by a processor, the steps of the Zabbix alarm procedure information forming method are implemented.
According to the forming method of the Zabbix warning process information, the electronic device and the computer readable storage medium, the display of the warning process information under the condition that the Zabbix monitoring scene is assisted by the shell script needing to be customized is achieved by additionally establishing the shell script, and the problem that only the warning result is displayed in the warning process is solved.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of a method for forming Zabbix alarm process information in accordance with the present invention;
FIG. 2 is a flow chart of the present invention for analyzing a shell script and extracting a command for generating an alarm portion;
FIG. 3 is a schematic diagram of a method for forming Zabbix alarm process information according to the present invention;
FIG. 4 is a schematic diagram of an electronic device according to a preferred embodiment of the invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a method for forming Zabbix alarm process information. Fig. 1 is a flow chart showing a preferred embodiment of the method for forming Zabbix alarm process information according to the present invention. The method may be performed by an apparatus, which may be implemented by software and/or hardware. In the application, the method is realized through shell scripts.
zabbix carries a lot of functional monitoring, and the self-carried monitoring has limitations, but is not applicable under the condition that the scene needing monitoring is complex; at this time, the zabbix monitoring under some scenes needs to be realized through the custom shell script. The step of adding the custom shell script is as follows, firstly, modifying the configuration of the zabbix-agent client, adding the script (the execution permission of the added script) to be monitored at the monitored zabbix-agent end, modifying the configuration of the zabbix-server end, and then testing through third-party software to complete the addition.
In the zabbix monitoring system, a linux host is used as a springboard, and the springboard is used for monitoring the switch. And (4) the administrator inputs a shell starting instruction on the board skipping machine to start the shell. The zabbix monitoring system issues an instruction according to a received test script, and the test script comprises a plurality of shell commands. Executing a shell command according to a received script operation instruction, and extracting alarm process information; and finally, generating a report form by the process information, and displaying the report form on the board skipping machine.
In this embodiment, the method for forming Zabbix alarm process information includes: step S110-step S160.
S110, obtaining the IP of the host with the alarm and the alarm time. S120, acquiring a shell script monitored by Zabbix on the alarm host; and S130, obtaining a log file which needs to be inquired in the shell script.
The setting method of the shell script comprises the following steps: creating a log file storage position; modifying the path and the file authority; adding and taking effect a shell command, and performing archiving operation; when suspected problems occur, checking a log file executed by the command; and then restoring the related operation before, and searching the cause of the problem. The file authority comprises root user authority and general user authority.
Through the setting of the shell script, information such as a command execution user, time, login and use IP during execution and the like can be recorded; as well as the time at which the command was executed, the joining of the user was performed, etc. All the information is stored and enters log files, and workers can check the log files. That is, the log file to be queried can be obtained through the shell script.
When an alarm problem occurs, a related log (log file) is acquired at the first time and is as accurate and comprehensive as possible, and the longer the waiting time is, the log can be covered, or cleared, or the environment is overlapped, so that the alarm positioning work is hindered.
It should be noted that, the user is directly faced with not the computer hardware but the shell, and the user tells the shell the instruction, and then the shell transmits the instruction to the system kernel, and then the kernel governs the computer hardware to execute various operations.
In other words, a shell script refers to a method of executing several commands in a computer. Shell is the user interface of the system, and provides an interface for the user to interact with the kernel. It receives the user input command and feeds it to the kernel for execution. The Shell script may be textual or graphical. Shell commands, such as directory List (ls), file move (mv), and delete (rm), are included in the Shell tools. A shell script is stored in a file and contains a set of shell commands.
S140, analyzing the acquired shell script and extracting a command of an alarm part; s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and S160, analyzing the acquired log file by operating the new command to obtain process information data for triggering the alarm.
An exemplary description is as follows:
taking monitoring tomcat interface response time as an example, a monitoring object is created in a zabbix system, a monitoring item is created under the monitoring object, data of the monitoring item is obtained by the shell script, the storage space data and the operation condition of a node are analyzed by capturing a page, then the data are sent to the zabbix and finally displayed in a web page in real time, and when the average interface response time exceeds 10s within 5 minutes of tomcat, alarm information is generated to remind a user.
However, the alarm information only carries one result. Therefore, it is necessary to further add a shell command capable of customizing a process information data, such as the time when the custom script generates an alarm, and the like. Firstly, creating a log storage position, modifying a path and file authority, then adding a shell command and taking effect, and performing archiving operation; wherein the shell command executes the steps of S110-S160. And the log file of the shell command comprises archive operation information of execution content and execution time.
Therefore, after the alarm occurs, the log file when the alarm occurs is checked first, and then the related operation of the previous alarm is restored, so that the data of the process information triggering the alarm is obtained.
In summary, after the alarm occurs, the IP of the host in which the alarm occurs and the alarm time are obtained first; acquiring a shell script monitored by Zabbix on the alarm host; obtaining a log file which needs to be inquired in the shell script; after the information is acquired, analyzing and extracting the information, and generating a new command capable of restoring an alarm scene by using the extracted information; and finally, analyzing the log file containing the alarm information of the alarm shell script acquired by running a new command, and finally obtaining process information data for triggering the alarm.
By the method, when a large number of alarms occur in different hosts, the reasons of the alarms can be obtained in batches, and operation and maintenance personnel can be helped to quickly locate the reasons of the alarms and quickly repair the alarms.
Referring to fig. 2, fig. 2 is a flowchart of analyzing a shell script and extracting a command of an alarm generation part according to the present invention. Analyzing the shell script, and extracting the command of the alarm part, wherein the step comprises the following steps: steps S210-S240.
S210, intercepting a log file from the obtained log file for analysis; s220, intercepting a row containing a time period for generating an alarm in the intercepted log file; s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information generating the alarm; and S240, determining a shell command for triggering the alarm according to the information of the alarm.
It should be further noted that, in step S140, the obtained shell script is analyzed, and a command of an alarm occurrence part is extracted; the shell script is the shell script acquired in step S120, and the command for generating the alarm portion is, that is, the shell command included in the shell script of the acquisition process involved in steps S210 to S240 is extracted.
Take the example that the average response time of the interface within 5 minutes of tomcat exceeds 10s, where the average response time = total response time/total number of rows, e.g., the total number of rows is 10 rows; the response time of the first to fourth lines is 1s, the response time of the fifth to seventh lines is 30s, the response time of the eighth line is 20s, and the response time of the ninth and tenth lines is 2 s. Since the calm response time exceeds 10s, an alarm is triggered, but in reality, the response times of the first to fourth rows, and the ninth and tenth rows are normal, and only the response times of the fifth to eighth rows are excessively long. The interfaces involved in the fifth to eighth rows having long response times can be found by steps S140 and S160.
The specific step of analyzing the obtained shell script in step S120 includes step S210 of intercepting a log file from the log file for analysis; a log file may be about 100000 lines; s220, intercepting a row containing a time period for generating an alarm in the intercepted log file; in the specific implementation process, the row with 13 columns is extracted;
s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information generating the alarm; in the specific embodiment, the line number containing the alarm time period is intercepted according to the alarm time, and the corresponding response time is extracted; that is, in the truncated rows, rows containing information of response time are further extracted (of the truncated rows, rows not containing information of response time are removed, and the remaining rows are rows containing information of response time), and an average response time is calculated based on the total number of extracted response rows and the total time of response, where the average response time = total response time/total number of rows.
S240, determining a shell command for triggering the alarm according to the information of the alarm; in a specific embodiment, a row with the average response time exceeding the set time is selected as a shell command for triggering an alarm.
An exemplary code is represented as follows:
tail-1000000$acclog_path|awk'{if(NF==13)print$0}'|awk-vold_time="[$old_time"-v now="[$now"'$7>=old_time&&$7<=now{print$0}'|awk'{sum+=$6}END{if(NR>0)print sum/NR}'
extract the row containing information of response time:
tail-1000000$acclog_path|awk'{if(NF==13)print$0}'|awk-vold_time="[$old_time"-v now="[$now"'$7>=old_time&&$7<=now{print$0}'
that is, the portion not containing the response time information is eliminated: l awk ' { sum + = $6} END bearing sum/NR } ' of '
Generally speaking, the invention can customize a shell command which can capture and display the process information data such as the time of the alarm of the customized script.
Wherein, the information of alarm occurrence is obtained in step S230; in step S240, the shell command is determined according to the obtained information. The method for forming the shell command comprises the following steps: firstly, compiling a script file and writing a log file; and giving execution permission to the script. Therefore, after acquiring the information of the alarm, the shell command can be successfully acquired, which is a known technology of those skilled in the art and will not be described herein again.
The method comprises the steps of capturing some key information required by a user when an alarm occurs by compiling the shell script, and generating a log file to facilitate checking of a manager, so that the alarm problem can be positioned more quickly and accurately. The complicated procedures that the monitoring script is manually checked and the log file is checked according to the monitoring script are omitted.
Referring to fig. 3, fig. 3 is a schematic diagram of a method for forming Zabbix alarm process information according to the present invention.
The principle of the forming method of the Zabbix warning process information is that the display of the warning process information under the condition that the shell script is required to be customized to assist the Zabbix monitoring scene is realized by additionally establishing a shell script, so that the problem that only a warning result is displayed in the warning process is solved, and the problem of complicated operation in manual inquiry of the warning process information is avoided.
It should be noted that the shell script includes a shell command, and the shell command captures and displays information data in the alarm process. And the information data of the alarm process comprises the execution content information and the archive operation information of the execution time. Finally, the information of the alarm process is displayed by Zabbix.
The setting method of the shell script comprises the following steps: creating a log file storage position; modifying the path and the file authority; adding and taking effect a shell command, and performing archiving operation; when suspected problems occur, checking a log file executed by the command; and then restoring the related operation before, and searching the cause of the problem. The file authority comprises root user authority and general user authority.
Through the setting of the shell script, information such as a command execution user, time, login and use IP during execution and the like can be recorded; as well as the time at which the command was executed, the joining of the user was performed, etc. All the information is stored and enters log files, and workers can check the log files.
The specific principle is that after the alarm occurs, the IP of the host in which the alarm occurs and the alarm time are obtained firstly; acquiring a shell script monitored by Zabbix on the alarm host; obtaining a log file needing to be inquired in the shell script; after the information is acquired, analyzing and extracting the information, and generating a new command capable of restoring an alarm scene by using the extracted information; and finally, analyzing the log file containing the alarm information of the alarm shell script acquired by running a new command, and finally acquiring process information data for triggering the alarm.
For complex monitoring scenarios, custom shell scripts are needed to assist Zabbix monitoring. In the scene, the shell command which can capture and display the process information data such as the time of the alarm of the custom script can be customized. The method comprises the steps of capturing some key information required by a user when an alarm occurs by compiling the shell script, and generating a log file to facilitate checking of a manager, so that the alarm problem can be positioned more quickly and accurately.
Aiming at the complicated monitoring scene of Zabbix (using a self-defined shell monitoring script), the invention can quickly display the process information of the alarm (only one command is needed), thereby avoiding manually checking the monitoring script, and then checking the log file according to the monitoring script (the log file is required to be logged in an alarm host and inquired in the manual checking process, the parameters such as alarm time and the like are manually substituted, the command in the shell monitoring script is manually updated, and the new command checking result is manually operated).
When a large number of alarms occur in different hosts, the reasons of the alarms can be obtained in batches, and operation and maintenance personnel can be helped to quickly locate the reasons of the alarms and quickly make repairs.
The invention also provides a forming device of the Zabbix warning process information, which comprises a warning time acquisition unit, a shell script acquisition unit, a log file acquisition unit, a reduction warning command generation unit and a warning process information acquisition unit;
the alarm time acquisition unit is used for acquiring the IP of the host with the alarm and the alarm time; the shell script obtaining unit is used for obtaining a shell script monitored by Zabbix on the alarm host; a log file obtaining unit, configured to obtain a log file to be queried in the shell script; a recovery alarm command generating unit, which is used for analyzing the acquired shell script and extracting the command of the alarm part; substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and the alarm process information acquisition unit is used for analyzing the acquired log file by operating the new command to obtain process information data triggering the alarm and displaying the process information data through Zabbix.
In one embodiment, the alarm information carries only one result. Therefore, it is necessary to add a shell command capable of customizing a process information data, such as the time when the custom script generates an alarm, and the like. Firstly, creating a log storage position, modifying a path and file authority, then adding a shell command and taking effect, and performing archiving operation; wherein the shell command executes the steps of S110-S160. And the log file of the shell command comprises archive operation information of execution content and execution time.
Through the setting of the shell script, information such as a command execution user, time, login and use IP during execution and the like can be recorded; as well as the time at which the command was executed, the joining of the user was performed, etc. All the information is stored and enters log files, and workers can check the log files.
Therefore, after the alarm occurs, the log file when the alarm occurs is checked first, and then the related operation of the previous alarm is restored, so that the data of the process information triggering the alarm is obtained.
The invention can customize a shell command which can capture and display the process information data such as the time of the alarm of the customized script. Capturing some key information required by people when the alarm occurs by compiling the shell script, and generating a log file so as to be convenient for a manager to check, so that the alarm problem can be positioned more quickly and accurately.
The specific implementation of the apparatus for forming Zabbix alarm process information of the present invention is substantially the same as the specific implementation of the method for forming Zabbix alarm process information, and will not be described herein again.
The invention provides a forming method of Zabbix warning process information, which is applied to an electronic device 4. Fig. 4 is a schematic diagram of an application environment of a method for forming Zabbix alarm process information according to a preferred embodiment of the present invention.
In the present embodiment, the electronic device 1 may be a terminal device having an arithmetic function, such as a server, a smart phone, a tablet computer, a portable computer, or a desktop computer.
The electronic device 4 includes: a processor 42, a memory 41, a communication bus 43, and a network interface 44.
The memory 41 includes at least one type of readable storage medium. The at least one type of readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card type memory 41, and the like. In some embodiments, the readable storage medium may be an internal storage unit of the electronic device 4, such as a hard disk of the electronic device 4. In other embodiments, the readable storage medium may also be an external memory 41 of the electronic apparatus 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the electronic apparatus 4.
In the present embodiment, the readable storage medium of the memory 41 is generally used for storing the formation program 40 of Zabbix alert procedure information installed in the electronic apparatus 4, and the like. The memory 41 may also be used to temporarily store data that has been output or is to be output.
The processor 42 may be, in some embodiments, a Central Processing Unit (CPU), microprocessor or other data Processing chip, for executing program codes stored in the memory 41 or Processing data, such as executing the Zabbix alarm process information forming program 40.
The communication bus 43 is used to realize connection communication between these components.
The network interface 44 may optionally include a standard wired interface, a wireless interface (e.g., a WI-FI interface), and is typically used to establish a communication link between the electronic apparatus 4 and other electronic devices.
Fig. 4 only shows the electronic device 4 with components 41-44, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Optionally, the electronic apparatus 4 may further include a user interface, which may include an input unit such as a Keyboard (Keyboard), a voice input device such as a microphone (microphone) and other devices with voice recognition function, a voice output device such as a sound device, a headset and other devices, and optionally, the user interface may further include a standard wired interface and a wireless interface.
Optionally, the electronic device 4 may further include a display, which may also be referred to as a display screen or a display unit. In some embodiments, the display device may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch device, or the like. The display is used for displaying information processed in the electronic apparatus 4 and for displaying a visualized user interface.
Optionally, the electronic device 4 may further include a Radio Frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described in detail herein.
In the apparatus embodiment shown in fig. 4, a memory 41, which is a kind of computer storage medium, may include therein an operating system, and a formation program 40 of Zabbix alert process information; the processor 42 implements the following steps when executing the forming program 40 of Zabbix alert procedure information stored in the memory 41:
s110, obtaining the IP of the host with the alarm and the alarm time. S120, acquiring a shell script monitored by Zabbix on the alarm host; s130, obtaining a log file needing to be inquired in the shell script; s140, analyzing the acquired shell script and extracting a command of an alarm part; s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and S160, analyzing the obtained log file by operating the new command to obtain process information data for triggering the alarm.
The method for extracting the command of the alarm part comprises the following steps: s210, intercepting a log file from the obtained log file for analysis; s220, intercepting a row containing a time period for generating an alarm in the intercepted log file; s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information generating the alarm; and S240, determining a shell command for triggering the alarm according to the information of the alarm.
In one embodiment, the setting method of the shell script comprises the following steps: creating a log file storage position; modifying the path and the file authority; adding and taking effect a shell command, and performing archiving operation; when a suspected problem occurs, checking a log file executed by the command; and then restoring the related operation before, and searching the cause of the problem. The file authority comprises root user authority and general user authority.
The electronic device 4 provided in the above embodiment defines a shell command that can capture and display process information data such as the time when the custom script gives an alarm. Capturing some key information required by people when the alarm occurs by compiling the shell script, and generating a log file so as to be convenient for a manager to check, so that the alarm problem can be positioned more quickly and accurately.
In other embodiments, the Zabbix alert process information forming program 40 may also be divided into one or more modules, which are stored in the memory 41 and executed by the processor 42 to implement the present invention. A module as referred to herein is a set of computer program instruction segments capable of performing a specified function.
The formation procedure 40 of Zabbix alert procedure information may be divided into: the method comprises an alarm time acquisition unit, a shell script acquisition unit, a log file acquisition unit, a reduction alarm command generation unit and an alarm process information acquisition unit. The functions or operation steps implemented by the alarm time obtaining unit, the shell script obtaining unit and the log file obtaining unit, the recovery alarm command generating unit and the alarm process information obtaining unit are similar to those described above, and are not described in detail here, for example, where: the alarm time acquisition unit is used for acquiring the IP of the host with the alarm and the alarm time; the shell script obtaining unit is used for obtaining a shell script monitored by Zabbix on the alarm host; and the log file acquisition unit is used for acquiring the log file to be inquired in the shell script.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a program for forming Zabbix alarm process information, and when executed by a processor, the program for forming Zabbix alarm process information implements the following operations:
acquiring a host IP (Internet protocol) and alarm time when an alarm occurs; acquiring a shell script monitored by Zabbix on the alarm host; and obtaining a log file needing to be inquired in the shell script. Analyzing the obtained shell script and extracting a command of an alarm part; substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and analyzing the obtained log file by operating the new command to obtain process information data for triggering the alarm.
In one embodiment, a section of log file is intercepted from the log file for analysis; a log file may be about 100000 lines; intercepting a row containing a time period for generating an alarm in the intercepted log file; in the specific implementation process, the row with 13 columns is extracted; intercepting the line number containing the alarm time period according to the alarm time and extracting corresponding response time; that is, within the truncated rows, rows containing information of response time are further extracted (of the truncated rows, rows containing no information of response time are excluded); extracting a command of a part where the alarm occurs in the above mode; substituting the extracted command into the alarm time to form a new command for restoring the alarm scene; and running the new command to analyze the log file acquired before so as to obtain process information data for triggering the alarm.
The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the Zabbix alarm process information forming method and the electronic apparatus, and will not be described herein again.
In general, the method can quickly display the process information of the alarm aiming at the complicated monitoring scene of Zabbix (the process information of the alarm is displayed, the condition that an alarm host needs to be logged in and a log file needs to be inquired in the manual checking process, parameters such as alarm time and the like are manually substituted, the command in the shell monitoring script is manually updated, and a new command checking result is manually operated.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, apparatus, article, or method comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A forming method of Zabbix alarm process information is applied to an electronic device, and is characterized in that the method comprises the following steps:
s110, acquiring the IP of a host with alarm and alarm time;
s120, obtaining a shell script monitored by Zabbix on the alarm host; the shell script is a self-defined shell script used for assisting the Zabbix to monitor and realize a preset function;
s130, obtaining a log file needing to be inquired in the shell script;
s140, analyzing the acquired shell script and extracting a command of an alarm part;
s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene;
and S160, analyzing the acquired log file by operating the new command to obtain process information data for triggering the alarm.
2. The method for forming Zabbix alarm procedure information according to claim 1, wherein the step of analyzing the obtained shell script in step S140 and extracting a command of an alarm occurrence part comprises:
s210, intercepting a log file from the obtained log file for analysis;
s220, intercepting a row containing a time period for generating an alarm in the intercepted log file;
s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information causing the alarm;
and S240, determining a shell command for triggering the alarm according to the alarm generation information.
3. The method of claim 2, wherein when the information causing the Zabbix alarm is that the response time of the interface is too long, the method of obtaining the average response time of the interface comprises: in step S220, after intercepting a row containing a time period for generating an alarm in the intercepted log file, extracting a row containing interface response time in the intercepted row; determining a total number of rows and a total interface response time from the extracted rows containing the interface response time, and obtaining an average response time according to the following formula:
average response time = total response time/total number of rows.
4. The method for forming Zabbix alarm procedure information according to any one of claims 1 to 3, wherein the shell script comprises shell commands for grabbing and displaying information data for alarm procedure to occur.
5. The method of claim 4, wherein the information data for the alarm process comprises archive operation information of execution content information and execution time.
6. An electronic device, comprising: the device comprises a memory and a processor, wherein the memory comprises a forming program of the Zabbix warning process information, and the forming program of the Zabbix warning process information realizes the following steps when being executed by the processor:
s110, acquiring a host IP (Internet protocol) and alarm time when an alarm occurs;
s120, acquiring a shell script monitored by Zabbix on the alarm host; the shell script is a self-defined shell script used for assisting the Zabbix to monitor and realize a preset function;
s130, obtaining a log file needing to be inquired in the shell script;
s140, analyzing the acquired shell script and extracting a command of an alarm part;
s150, substituting the extracted command into the alarm time to form a new command for restoring the alarm scene;
and S160, analyzing the obtained log file by operating the new command to obtain process information data for triggering the alarm.
7. The electronic device according to claim 6, wherein the step of analyzing the obtained shell script and extracting the command for generating the alarm portion in step S140 comprises:
s210, intercepting a log file from the obtained log file for analysis;
s220, intercepting a row containing a time period for generating an alarm in the intercepted log file;
s230, in the intercepted row, eliminating information except the information causing the alarm to obtain the information generating the alarm;
and S240, determining a shell command for triggering the alarm according to the alarm information.
8. The electronic device of claim 6, wherein the shell script comprises shell commands, and the shell commands are used for grabbing and displaying information data of an alarm process.
9. The electronic device according to claim 7, wherein the information data in which the alarm process occurs comprises archive operation information of execution content information and execution time.
10. A computer-readable storage medium, characterized in that a program for forming Zabbix alert process information is included in the computer-readable storage medium, and when the program for forming Zabbix alert process information is executed by a processor, the steps of the method for forming Zabbix alert process information according to any one of claims 1 to 5 are implemented.
CN201910814528.5A 2019-08-30 2019-08-30 Method and device for forming Zabbix alarm process information and storage medium Active CN110601879B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910814528.5A CN110601879B (en) 2019-08-30 2019-08-30 Method and device for forming Zabbix alarm process information and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910814528.5A CN110601879B (en) 2019-08-30 2019-08-30 Method and device for forming Zabbix alarm process information and storage medium

Publications (2)

Publication Number Publication Date
CN110601879A CN110601879A (en) 2019-12-20
CN110601879B true CN110601879B (en) 2022-11-08

Family

ID=68857018

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910814528.5A Active CN110601879B (en) 2019-08-30 2019-08-30 Method and device for forming Zabbix alarm process information and storage medium

Country Status (1)

Country Link
CN (1) CN110601879B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711511B (en) * 2020-12-29 2023-09-01 航天信息股份有限公司 Method and system for monitoring terminal equipment based on script server

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103545922B (en) * 2013-09-24 2015-10-28 许继集团有限公司 Based on the intelligent alarm inference method of many scene analysis
CN104484836B (en) * 2014-12-26 2018-08-21 国家电网公司 A kind of electric network fault aid decision visualization system and its method
CN105183609B (en) * 2015-09-16 2017-03-15 焦点科技股份有限公司 A kind of real-time monitoring system for being applied to software system and method
US10361905B2 (en) * 2015-11-03 2019-07-23 International Business Machines Corporation Alert remediation automation
CN106681882A (en) * 2015-11-06 2017-05-17 上海瑞致软件有限公司 IT-service concentrated monitoring and managing system based on Apriori algorithm
CN106371986A (en) * 2016-09-08 2017-02-01 上海新炬网络技术有限公司 Log treatment operation and maintenance monitoring system
CN108306749B (en) * 2017-01-12 2021-11-05 阿里巴巴集团控股有限公司 Monitoring system alarming method, monitoring system and monitoring device
CN107632918B (en) * 2017-08-30 2020-09-11 中国工商银行股份有限公司 Monitoring system and method for computing storage equipment

Also Published As

Publication number Publication date
CN110601879A (en) 2019-12-20

Similar Documents

Publication Publication Date Title
CN108108297B (en) Method and device for automatic testing
CN110795325B (en) Visual point burying method, device, equipment and storage medium
US8171406B1 (en) Automating user interface navigation
US10176327B2 (en) Method and device for preventing application in an operating system from being uninstalled
WO2015027816A1 (en) Devices and methods for acquiring abnormal information
WO2020237877A1 (en) Log monitoring method and apparatus, terminal, and storage medium
CN110515679B (en) Data acquisition method, device, equipment and storage medium
US20110054964A1 (en) Automatic Documentation of Ticket Execution
CN111211929A (en) Fault positioning method, fault positioning device, control equipment and intelligent equipment
CN111459495A (en) Unit test code file generation method, electronic device and storage medium
CN110647471A (en) Interface test case generation method, electronic device and storage medium
CN112148606B (en) Buried point test method, buried point test device, buried point test equipment and computer readable medium
CN112650658A (en) Application program exception recording and reproduction method, device and storage medium
CN111654495B (en) Method, apparatus, device and storage medium for determining traffic generation source
CN115543827A (en) Buried point data display method and device
CN110347565B (en) Application program abnormity analysis method and device and electronic equipment
CN110908855A (en) Micro-service operation maintenance device and method and electronic equipment
CN111767262A (en) Log display method, device, equipment and storage medium
CN110601879B (en) Method and device for forming Zabbix alarm process information and storage medium
CN113986689A (en) Custom configuration alarm method, system and terminal
CN111966630B (en) File type detection method, device, equipment and medium
CN110727595B (en) Application login interface identification method, intelligent terminal and storage medium
CN113806138A (en) Backup recovery detection method and device for database, electronic equipment and storage medium
CN112148545A (en) Security baseline detection method and security baseline detection system of embedded system
US20070250543A1 (en) Differential data managing apparatus

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