Automatic report generation method, device, computer equipment and storage medium

Through the automated collection technology of Zabbix and Puppteer, the problem of external machines being unable to access the target terminal database was solved, efficient and accurate data collection and report generation were achieved, and the access restrictions of the bastion host were broken.

CN111666743BActive Publication Date: 2025-09-26PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010350330.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-28
Publication Date
2025-09-26
Estimated Expiration
2040-04-28

AI Technical Summary

Technical Problem

The traditional method of generating data reports is cumbersome and inefficient. External machines cannot directly access the database of the target terminal, which makes data collection difficult, and manual processing reduces data accuracy and efficiency.

Method used

Generate custom scripts through Zabbix to collect data from the target terminal, and combine with Puppteer to automatically collect data from the report page, breaking the limitations of the bastion host and improving the accuracy and efficiency of data collection.

Benefits of technology

Without the need for third-party access machines or installation of proxy machines, the accuracy and efficiency of data collection are improved, and collection is automatically resumed in the event of an abnormality, enhancing fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111666743B_ABST
    Figure CN111666743B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, computer equipment and storage medium for automatically generating reports. The method generates a report configuration file by responding to a first user operation, the report configuration file including a custom script address and a task type; generates a custom script through Zabbix according to the custom script address, and uses the custom script to collect target report data from a target terminal; processes the target report data, and displays the processed target report data on a report page; after receiving a task trigger instruction, collects the processed target report data from the report page through Puppeteer; parses and extracts the processed target report data to generate a data report. Combining Zabbix's custom script and Puppeteer's automated collection technology, the method overcomes the limitation of being unable to access the target terminal database due to the presence of a bastion host, improves the accuracy and efficiency of collected data, can monitor the status of the data collection process, and improves the fault tolerance of the collection process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, computer equipment and storage medium for automatically generating reports. Background Art

[0002] With the development of computer technology, data reports have been widely used in the field of data processing technology in system operation and maintenance. As the final link of data collection, evaluating data sources, generating and sending report data to target users need to meet multiple requirements such as timing, fixed point, accuracy and efficiency.

[0003] The traditional method of generating data reports is cumbersome in the steps of establishing a connection to the database and exporting reports. In many application scenarios, the existence of a bastion host will restrict or not allow external machines to connect to the IP address of the local machine, resulting in external machines being unable to obtain data. In the early days, data reports were processed and produced manually. The manual report generation method greatly reduced efficiency, made it impossible to quickly perform statistics, and could not quickly and accurately verify the accuracy of the data. Summary of the Invention

[0004] The embodiments of the present invention provide a method and apparatus for automatically generating a report, a computer device, and a storage medium to solve the problem that an external machine cannot obtain data.

[0005] A method for automatically generating a report, comprising:

[0006] In response to the first user operation, generating a report configuration file, the report configuration file including a custom script address and a task type;

[0007] Generate a custom script through Zabbix according to the custom script address, and use the custom script to collect target report data from the target terminal;

[0008] Processing the target report data and displaying the processed target report data on a report page;

[0009] After receiving the task trigger instruction, collecting the processed target report data from the report page through Puppteer;

[0010] The processed target report data is parsed and extracted to generate a data report.

[0011] A report automatic generation device, comprising:

[0012] A response operation module, configured to generate a report configuration file in response to the first user operation, wherein the report configuration file includes a custom script address and a task type;

[0013] A first collection module is configured to generate a custom script through Zabbix according to the custom script address, and collect target report data from a target terminal using the custom script;

[0014] A first display module is used to process the target report data and display the processed target report data on a report page;

[0015] A second collection module is used to collect the processed target report data from the report page through Puppteer after receiving the task trigger instruction;

[0016] The first report generation module is used to parse and extract the processed target report data to generate a data report.

[0017] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned method for automatically generating a report are implemented.

[0018] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for automatically generating a report.

[0019] The above-mentioned automatic report generation method, device, computer equipment and storage medium generate a report configuration file in response to a first user operation, and the report configuration file includes a custom script address and a task type; generates a custom script through Zabbix according to the custom script address, and uses the custom script to collect target report data from the target terminal; processes the target report data and displays the processed target report data on the report page; after receiving the task trigger instruction, collects the processed target report data from the report page through Puppteer; parses and extracts the processed target report data to generate a data report. Combining Zabbix's custom scripts with Puppteer's automated collection technology, it breaks the limitation of being unable to access the target terminal's database due to the existence of a bastion host, improves the accuracy and efficiency of collected data without the need for a third-party access machine or the installation of an additional agent machine, and can monitor the status of the data collection process. When an exception occurs in the collection process, it returns to the breakpoint to continue collection, thereby improving the fault tolerance of the collection process. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0021] Figure 1 This is a schematic diagram of an application environment of a method for automatically generating reports in one embodiment of the present invention;

[0022] Figure 2 This is a flow chart of a method for automatically generating reports in one embodiment of the present invention;

[0023] Figure 3 is another flow chart of a method for automatically generating a report in one embodiment of the present invention;

[0024] Figure 4 is another flow chart of a method for automatically generating a report in one embodiment of the present invention;

[0025] Figure 5 is another flow chart of a method for automatically generating a report in one embodiment of the present invention;

[0026] Figure 6 This is a principle block diagram of an automatic report generation device in one embodiment of the present invention;

[0027] Figure 7 This is another principle block diagram of the automatic report generation device in one embodiment of the present invention;

[0028] Figure 8 This is another principle block diagram of the automatic report generation device in one embodiment of the present invention;

[0029] Figure 9 This is another principle block diagram of the automatic report generation device in one embodiment of the present invention;

[0030] Figure 10 FIG. 1 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0032] The method for automatically generating a report provided by the embodiment of the present invention can be applied as follows: Figure 1Specifically, the report automatic generation method is applied in a report automatic generation system, which includes the following: Figure 1 The client, server, and target terminal shown in the figure, where the target terminal communicates with the server via a network, is used to resolve the problem of external devices being unable to access data. The client and server communicate via a network, and the server sends data to the client. The client, also known as the user end, refers to the program that corresponds to the server and provides local services to the client. The client can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented as a standalone server or a server cluster consisting of multiple servers. The target terminal is an external terminal, and the data stored on the target terminal cannot be directly accessed by the client or server. The target terminal can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.

[0033] In one embodiment, if Figure 2 As shown, a report automatic generation method is provided, which is applied in Figure 1 The server in the example is used as an example, and the steps are as follows:

[0034] S11: In response to the first user operation, generate a report configuration file, where the report configuration file includes a custom script address and a task type.

[0035] The first user operation is a terminal operation performed by a user filling in a report configuration file according to a configuration file template stored on the server. A report configuration file is a file containing user-defined configuration parameters. Furthermore, a report configuration file may include the data source type, Zabbix account and corresponding password, custom script address, report view, task type, email recipients, email CC recipients, and generator. Task types include periodic tasks and scheduled tasks. Periodic tasks are tasks that are executed periodically, while scheduled tasks are tasks that are executed within a fixed time period.

[0036] Specifically, the user fills in the report configuration file according to the configuration file template in the server and sets the parameters in the configuration file. After the user completes filling in the report configuration file, the server saves the report configuration file to the database.

[0037] S12: Generate a custom script through Zabbix according to the custom script address, and use the custom script to collect target report data from the target terminal.

[0038] Zabbix is ​​an enterprise-level, open-source web-based solution that provides distributed system and network monitoring capabilities. A target terminal is a terminal that stores target report data, which can be a personal computer, laptop, smartphone, tablet, or portable wearable device. Target report data is the data used to generate data reports.

[0039] The target report data is stored in the database of the target terminal. Due to the existence of the bastion host, the server cannot directly access the database of the target terminal to collect the target report data. Therefore, a custom script is generated through Zabbix to complete the collection of the target report data from the target terminal. Specifically, the user logs in to Zabbix according to the Zabbix account and password in the report configuration file. After logging in, the user adds a custom script corresponding to the custom script address set in the report configuration file in Zabbix. The server recognizes the custom script in Zabbix and collects the target report data from the target terminal through the custom script.

[0040] S13: Process the target report data and display the processed target report data on the report page.

[0041] The data processing may include directly superimposing or serializing the target report data according to the order of the collected target report data. The report page is a page that displays the target report data after the data processing.

[0042] Specifically, after accessing the database of the target terminal through the custom script generated by Zabbix and collecting the target report data from the database of the target terminal, the server directly superimposes or serializes the collected target report data in the order of collection to obtain the report data to be copied, and then copies the report data to be copied, and stores the copied target report data to be copied in a readable file of Zabbix. The readable file is read by Zabbix, and the read superimposed or serialized target report data is displayed on the report page.

[0043] S14: After receiving the task trigger instruction, the processed target report data is collected from the report page through Puppteer.

[0044] The task trigger instruction is the instruction that triggers the collection event. Puppteer is an official Chrome operation library produced by Google. It can control Chrome navigation pages, sending, receiving, and locating elements with higher granularity.

[0045] Specifically, the report configuration file includes task types, which include scheduled tasks and periodic tasks. According to the task type set by the user in the report configuration file, when the user manually starts the report generation task in the server, a prompt "scheduled task started or periodic task started" will be output in the status bar of the server. When the collection event is triggered, that is, when the server receives the task trigger instruction, a collection instance task is initialized in the memory of the operating system and the instance task is maintained. The collection instance task is to access the report page through Puppteer and collect the target report data after data processing from the report page.

[0046] The time at which the server receives the task trigger instruction can be configured in the report configuration file. The server can trigger the task at a fixed time or periodically after the report generation task starts. To ensure that the instance task is not interrupted during execution, the exception point self-healing function is set in the exception section of the instance task. This function records the status of the collection instance task when the exception occurs. If the exception occurs again, the collection instance task will return to the exception breakpoint and continue collection.

[0047] S15: Analyze and extract the processed target report data to generate a data report.

[0048] The data report is a report generated after parsing and extracting the processed target report data.

[0049] Specifically, after Puppteer collects the processed target report data from the report page, it uses a parser to parse the processed target report data. The parser can parse all fields and content in the processed target report data, classify and integrate all fields and content, and save them to obtain the parsed data. Based on the parsed data, the HTML generator corresponding to the parser generates a web page. After the web page is generated, an extraction request is sent to the web page. After receiving the extraction instruction, the parsed data is extracted from the web page according to the preset extraction method, and a data report is generated based on the extracted data.

[0050] Among them, the preset extraction method can be a method for locating any element in a WEB page. Specifically, the elements in the WEB page may include response, title and label elements, etc. Exemplarily, the preset extraction method can be to locate the label element as the extracted element. After generating the WEB page through the HTML generator corresponding to the parser according to the classified data, the data containing the label element is extracted from the WEB page, and then the report data is generated based on the extracted data containing the label element.

[0051] In this embodiment, a report configuration file is generated in response to a first user operation, the report configuration file including a custom script address and a task type; a custom script is generated through Zabbix according to the custom script address, and the target report data is collected from the target terminal using the custom script; the target report data is processed, and the processed target report data is displayed on the report page; after receiving the task trigger instruction, the processed target report data is collected from the report page through Puppteer; the processed target report data is parsed and extracted to generate a data report. Combining Zabbix's custom scripts with Puppteer's automated collection technology breaks the limitation of being unable to access the target terminal's database due to the existence of a bastion host, and improves the accuracy and efficiency of collected data without the need for a third-party access machine or the installation of an additional agent machine. At the same time, it can monitor the status of the data collection process. When an exception occurs in the collection process, it returns to the breakpoint to continue collection, thereby improving the fault tolerance of the collection process.

[0052] In one embodiment, if Figure 3 As shown, in step S13, the target report data is processed and the processed target report data is displayed on the report page, which specifically includes the following steps:

[0053] S131: reorganize the target report data to obtain first report data, and store the first report data in a first file.

[0054] Reorganization involves reorganizing the target report data into a specific format. The specific format may include the data type, length, or sequence of the target report data. The first report data is the data obtained by reorganizing the target report data. The first file is a file storing the first report data. The first file is an unreadable file stored in a database on the server.

[0055] Specifically, after the target report data is collected from the target terminal using a custom script, the target report data is reorganized. Specifically, the target report data is directly superimposed or serialized in the order of collection to obtain first report data, and the first report data is stored in a first file.

[0056] S132: Copy the first file to obtain a second file, and store the second file in a readable directory of Zabbix.

[0057] The second file is a file that can be accessed and read by other servers, terminals or systems, and the second file is stored in a readable directory of Zabbix.

[0058] Specifically, after directly superimposing or serializing the target report data in the order of collection to obtain first report data, and storing the first report data in the form of a file on the server, the first file is copied to obtain a second file, and the second file is stored in a readable directory of Zabbix. The data in the first file and the second file are the same.

[0059] S133: Read the second file through Zabbix, and display the data of the second file on the report page.

[0060] The report page is a page that displays the target report data after the data processing, that is, a page that displays the data of the second file.

[0061] Specifically, since the second file is stored in a readable directory of Zabbix, Zabbix can access and read the second file. The data in the second file is read by Zabbix, and the data is the first report data. After reading the data in the second file, the data is displayed in the report page.

[0062] In this embodiment, the target report data is reorganized to obtain first report data, and the first report data is stored in a first file; the first file is copied to obtain a second file, and the second file is stored in a readable directory of Zabbix; the second file in the readable file is read by Zabbix, and the data of the second file is displayed in the report page. Due to the existence of the bastion host, the server cannot directly access the database of the target terminal to collect the target report data. In Zabbix, the first file is copied and the copied second file is stored in a readable directory. While ensuring the security of the original data, the copied file is used to break the bastion host's restrictions on access to data, and the second file is displayed in the report page, so that the target report data is displayed more clearly and accurately, and it is convenient for the subsequent collection of target report data, thereby improving the convenience of data collection.

[0063] In one embodiment, if Figure 4 As shown, the report configuration file also includes an HTML generator. In step S15, the processed target report data is parsed and extracted to generate a data report, which specifically includes the following steps:

[0064] S151: Using a parser to parse the processed target report data to obtain parsed data.

[0065] The parser is used to parse the processed target report data. The parser can be a MySQL query result parser, a PostgreSQL parser, or a Redis parser, etc. The parsed data is the data obtained after the processed target report data is parsed by the parser.

[0066] Exemplarily, the MySQL query result parser is used to parse the processed target report data. Specifically, the parser queries the processed target report data to obtain the MySQL query result, and then the MySQL query result is parsed by the parser to obtain the parsed data.

[0067] Among them, the MySQL query result can be a table with m rows and n columns, and the data in the table is the processed target report data. Parsing the MySQL query result through the parser can be other parsing methods such as splicing, splitting, filtering, shielding or combining the data in the MySQL query result.

[0068] S152: Generate a WEB page based on the parsed data through the HTML generator corresponding to the parser.

[0069] The HTML generator is used to generate web pages and is used in conjunction with the parser in the report configuration file. The web page is generated based on the parsed data using the HTML generator that matches the parser. This page displays the parsed data.

[0070] Specifically, after the target report data after data processing is parsed by a parser to obtain parsed data, a web page is generated according to the parsed data by using an HTML generator corresponding to the parser, and the parsed data is displayed on the web page.

[0071] Exemplarily, in step S152, the parser uses a MySQL query result parser to parse the processed target report data, and the obtained parsed data is displayed in a tabular form. The WEB page is generated by the HTML generator corresponding to the MySQL query result parser, and the parsed data will be displayed in a tabular form on the WEB page, and the table of the parsed data can be rendered as a color table on the WEB page.

[0072] S153: Send an extraction request to the WEB page, and extract the parsed data from the WEB page according to a preset extraction method to obtain extracted data.

[0073] The extraction request is a request to extract parsed data from a web page. The preset extraction method may be to locate any element in the web page. For example, the element in the web page may include a response, a title, or a tag element. The extracted data is the data extracted from the parsed data in the web page according to the preset extraction method.

[0074] Specifically, after a WEB page is generated according to the parsed data through the HTML generator corresponding to the parser, an extraction request is sent to the WEB page. After receiving an extraction instruction, data is extracted from the WEB page according to a preset extraction method to obtain extracted data.

[0075] Exemplarily, a WEB page contains response, title and label elements. In a specific implementation method, the preset extraction method can be to locate the label element as the extracted element. After the WEB page is generated by the HTML generator corresponding to the parser based on the classified and saved data, an extraction request is sent to the WEB page to extract the data containing the label element from the parsed data on the WEB page.

[0076] S154: Generate a data report based on the extracted data.

[0077] The data report is a report generated based on the extracted data. The data report can be a web page report or a data table.

[0078] Specifically, after extracting the parsed data from the WEB page according to the preset extraction method and obtaining the extracted data, a data report is generated based on the extracted data. For example, the data report is generated based on the extracted data through the HTML generator corresponding to the parser, and the data report is a web page report.

[0079] In this embodiment, the parser parses the processed target report data to obtain parsed data; based on the parsed data, a web page is generated using an HTML generator corresponding to the parser; an extraction request is sent to the web page, and the parsed data is extracted from the web page according to a preset extraction method to obtain extracted data; and a data report is generated based on the extracted data. The parser parses the processed target report data, which can be integrated to improve the effectiveness of data extraction in subsequent steps. The HTML generator corresponding to the parser generates the web page and can render it as a color table, which can more intuitively display the data and make the data display clearer.

[0080] In one embodiment, if Figure 5As shown, the report configuration file also includes a receiving mailbox and a copy mailbox. After parsing and extracting the processed target report data and generating a data report, the automatic report generation method further includes:

[0081] S16: Determine the execution status of the task type.

[0082] The execution status is the running status of the task type.

[0083] Specifically, when a task of a task type starts to be executed, the server monitors the execution status of the task type and determines the execution status of the task type to determine whether the task type is executed without errors.

[0084] S17: If the execution status is the first status, determine whether the data report meets the preset requirements. The first status indicates that no error occurs during the execution of the task type.

[0085] The first state is a state in which the task in the task type is executed without error during execution. The preset requirement indicates that the data in the data report has no error.

[0086] Specifically, during the execution of a periodic task or a scheduled task in the task type, it is necessary to determine whether the state of the task execution is correct or incorrect. If the state of the task execution is correct, then it is necessary to determine whether the data report meets the preset requirements. If the state of the task execution is incorrect, then it is not necessary to determine whether the data report meets the preset requirements, but to correct the specific circumstances of the incorrect state. The incorrect state may include: network connection error, failure to access the report page or the web page, empty target report data, incorrect format of the target report data, or parsing error.

[0087] S18: If the data report meets the preset requirements, the data report is sent to the receiving mailbox and the copy mailbox in the form of an email.

[0088] The report configuration file also includes a receiving email address and a copy email address. The receiving email address is the email address of the recipient. The copy email address is the email address of the recipient. The preset requirement indicates that the data in the data report is error-free.

[0089] Specifically, after determining that the execution state is the first state, a determination is made as to whether the data report meets preset requirements. If the data report meets the preset requirements, i.e., the data in the data report contains no errors, the data report is emailed to a receiving mailbox and a copy mailbox. The data report meeting the preset requirements means that the data report contains no errors. Cases where the data report does not meet the preset requirements may include empty data in the data report, format errors in the data report, or errors occurring during the data report generation process.

[0090] Furthermore, a Boolean variable can be set to determine whether the data report meets the preset requirements, that is, whether to send the data report to the receiving mailbox and the copy mailbox as an email based on the value of the Boolean variable. Assuming that the Boolean variable isMailShouldBeSent, if the data report does not meet the preset requirements, the value returned by isMailShouldBeSent is false, indicating that the step of sending the data report to the receiving mailbox and the copy mailbox as an email will not be executed.

[0091] Furthermore, in this embodiment, the method for sending emails does not use a designated email account as the sender's mailbox, but instead directly calls Outlook methods to send emails. Calling Outlook methods not only automatically sends emails to the receiving mailbox and the copy mailbox, but also receives emails, automatically replies to and processes eligible emails, automatically drafts emails, automatically modifies signatures, automatically identifies and processes alert emails, and saves emails in batches.

[0092] In this embodiment, the execution status of the task type is determined; if the execution status is the first state, whether the data report meets the preset requirements is determined, and the first state indicates that no errors occurred during the execution of the task type; if the data report meets the preset requirements, the data report is sent to the receiving mailbox and the copy mailbox in the form of an email. By determining the execution status of the task type and whether the data report meets the preset requirements, the data in the data report can be ensured to meet the requirements, improving the accuracy of the data report. By directly calling Outlook methods to send emails, emails can be sent more efficiently and with greater flexibility. There is no need to use a third-party email account, i.e., the sender's email account, thus saving email service costs while effectively utilizing existing accounts.

[0093] In one embodiment, after collecting target report data using a custom script, the method for automatically generating a report further includes:

[0094] Receive task type information;

[0095] If the task type information indicates that the task type is a periodic task, the interval of the timer is set to periodic milliseconds, where the periodic milliseconds is the time of the periodic system, and the time unit is milliseconds;

[0096] If the task type information indicates that the task type is a timed task, the interval of the timer is set to a fixed number of milliseconds, where the fixed number of milliseconds is a fixed time period, and the time unit is milliseconds.

[0097] Task types include periodic tasks and scheduled tasks. If the task type is set to periodic, the interval of the task type's timer will be set to the periodic number of milliseconds; if the task type is set to scheduled, the interval of the task type's timer will be set to a fixed number of milliseconds. Furthermore, during the execution of a task, as the amount of data collected decreases, the interval parameter configuration of the task type can be changed in the report configuration file. This can be done by directly assigning a value to the set interval parameter.

[0098] In one embodiment, the method for automatically generating a report further includes the following steps:

[0099] Performs a minimize operation, which indicates that a task of the task type is running in the background.

[0100] In the process of executing a task, the window for executing the task may be minimized and an icon may be retained in the task bar. Minimization means that the task executed by the task type runs in the background.

[0101] After the data report is successfully sent to the receiving mailbox and the copy mailbox, the task completion prompt is triggered.

[0102] The task completion prompts the result of the task execution.

[0103] When the data report is successfully sent to the receiving mailbox and the copy mailbox in the form of an email, a task completion prompt will be triggered, and the task completion prompt indicates that the task execution is completed.

[0104] Specifically, after the data report is successfully sent in the form of an email, a pop-up window can be used to notify the completion of the task execution. The task completion prompt can be through voice prompts, interface text display prompts, interface animation prompts or other effective prompt methods.

[0105] In this embodiment, by minimizing the task, the task type indicated by the minimization is run in the background; after the data report is successfully sent via email, a task completion notification is triggered. This method ensures that the task can continue to execute while not occupying screen display space during task execution, and can trigger a task completion notification after the task is completed.

[0106] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0107] In one embodiment, a report automatic generation device is provided, which corresponds to the report automatic generation method in the above embodiment. Figure 6As shown, the report automatic generation device includes a response operation module 11, a first acquisition module 12, a first display module 13, a second acquisition module 14 and a report generation module 15. The functional modules are described in detail as follows:

[0108] The response operation module 11 is used to generate a report configuration file in response to a first user operation. The report configuration file includes a custom script address and a task type.

[0109] The first collection module 12 is configured to generate a custom script through Zabbix according to the custom script address, and collect target report data from the target terminal using the custom script.

[0110] The first display module 13 is configured to process the target report data and display the processed target report data on a report page.

[0111] The second collection module 14 is configured to collect the processed target report data from the report page through Puppteer after receiving the task triggering instruction.

[0112] The first report generation module 15 is used to parse and extract the processed target report data to generate a data report.

[0113] Preferably, if Figure 7 As shown, the first display module 13 further includes:

[0114] The data reorganization module 131 is configured to reorganize the target report data to obtain first report data, and store the first report data in a first file.

[0115] The file copying module 132 is configured to copy the first file to obtain a second file, and store the second file in a readable directory of Zabbix.

[0116] The second display module 133 is configured to read the second file through Zabbix and display the data of the second file on a report page.

[0117] Preferably, if Figure 8 As shown, the report generation module 15 includes:

[0118] The data parsing module 151 is configured to parse the processed target report data using a parser to obtain parsed data.

[0119] The page generation module 152 is used to generate a WEB page according to the parsed data through the HTML generator corresponding to the parser.

[0120] The data extraction module 153 is used to send an extraction request to the WEB page, and extract the parsed data from the WEB page according to a preset extraction method to obtain extracted data.

[0121] The second report generation module 154 is configured to generate a data report based on the extracted data.

[0122] Preferably, if Figure 9 As shown, the report automatic generating device also includes:

[0123] The state determination module 16 is configured to determine the execution state of the task type.

[0124] The data judgment module 17 is configured to judge whether the data report meets preset requirements if the execution status is a first status, wherein the first status indicates that no error occurs during the execution of the task type.

[0125] The email sending module 18 sends the data report to the receiving mailbox and the copy mailbox in the form of an email if the data report meets the preset requirements.

[0126] Preferably, the automatic report generation device further includes:

[0127] The information receiving module is used to receive task type information.

[0128] The first setting module is configured to set the timer interval to periodic milliseconds if the task type information indicates that the task type is a periodic task, where the periodic milliseconds is the periodic time and the time unit is milliseconds.

[0129] The second setting module is configured to set the timer interval to a fixed number of milliseconds if the task type information indicates that the task type is a timed task, where the fixed number of milliseconds is a fixed time period and the time unit is milliseconds.

[0130] Preferably, the automatic report generation device further includes:

[0131] The minimization module is used to perform a minimization operation, where the minimization operation instructs the task of the task type to run in the background.

[0132] The task completion prompt module is used to trigger a task completion prompt after the data report is successfully sent to the receiving mailbox and the copy mailbox.

[0133] The specific definition of the automatic report generation device can be found in the definition of the automatic report generation method above and will not be repeated here. The various modules in the automatic report generation device described above can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0134] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 10 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used in the automatic report generation method in the above embodiment. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for automatic report generation is implemented.

[0135] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for automatically generating a report in the above embodiment is implemented.

[0136] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for automatically generating a report in the above embodiment is implemented.

[0137] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0138] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0139] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A method for automatically generating a report, characterized in that: The report automatic generation method comprises: In response to the first user operation, generating a report configuration file, the report configuration file including a custom script address and a task type; Generate a custom script through Zabbix according to the custom script address, and use the custom script to collect target report data from the target terminal; Processing the target report data and displaying the processed target report data on a report page; After receiving the task trigger instruction, collecting the processed target report data from the report page through Puppteer; Parsing and extracting the processed target report data to generate a data report; The processing of the target report data and displaying the processed target report data on the report page includes: Reorganizing the target report data to obtain first report data, and storing the first report data in a first file; the first file is an unreadable file and is stored in a database of a server; Copy the first file to obtain a second file, and store the second file in a readable directory of Zabbix; The second file is read by Zabbix, and the data of the second file is displayed on a report page.

2. The automatic report generation method according to claim 1, wherein the report configuration file further comprises an HTML generator, characterized in that: The processing of the target report data and extracting the processed target report data to generate a data report includes: Parsing the processed target report data using a parser to obtain parsed data; Generate a WEB page based on the parsed data through the HTML generator corresponding to the parser; Sending an extraction request to the WEB page, extracting the parsed data from the WEB page according to a preset extraction method to obtain extracted data; A data report is generated based on the extracted data.

3. The automatic report generation method according to claim 1, wherein the report configuration file further includes a receiving mailbox and a copy mailbox, wherein: After parsing and extracting the processed target report data to generate a data report, the automatic report generation method further includes: Determining the execution status of the task type; If the execution state is the first state, determining whether the data report meets the preset requirements, the first state indicating that no error occurs during the execution of the task type; If the data report meets the preset requirements, the data report will be sent to the receiving mailbox and the copy mailbox in the form of an email.

4. The method for automatically generating a report according to claim 1, wherein: After the target report data is collected using the custom script, the automatic report generation method further includes: Receive task type information; If the task type information indicates that the task type is a periodic task, the interval of the timer is set to periodic milliseconds, where the periodic milliseconds is based on the periodic time and the time unit is milliseconds; If the task type information indicates that the task type is a timed task, the timer interval is set to a fixed number of milliseconds, where the fixed number of milliseconds is spaced at a fixed time period, and the time unit is milliseconds.

5. The method for automatically generating a report according to claim 1, wherein: The automatic report generation method further includes: Performing a minimize operation, wherein the minimize operation indicates that a task of the task type is to be run in the background; After the data report is successfully sent to the receiving mailbox and the copy mailbox, a task completion prompt is triggered.

6. A report automatic generation device, characterized in that: include: A response operation module, configured to generate a report configuration file in response to the first user operation, wherein the report configuration file includes a custom script address and a task type; A first collection module is configured to generate a custom script through Zabbix according to the custom script address, and collect target report data from a target terminal using the custom script; A first display module is used to process the target report data and display the processed target report data on a report page; A second collection module is used to collect the processed target report data from the report page through Puppteer after receiving the task trigger instruction; A first report generation module is used to parse and extract the processed target report data to generate a data report; The first display module further includes: a data reorganization module, configured to reorganize the target report data to obtain first report data, and store the first report data in a first file; the first file is an unreadable file and is stored in a database of a server; A file copy module, configured to copy the first file to obtain a second file, and store the second file in a readable directory of Zabbix; The second display module is used to read the second file through Zabbix and display the data of the second file on a report page.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for automatically generating a report according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for automatically generating a report according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Cascading style sheet maintenance method and device, computer equipment and storage medium

    CN109725965A

  • Business performance inspection report generation method, system and device

    CN109800254A