[go: up one dir, main page]

CN109446100B - Method and apparatus for managing script files of devices - Google Patents

Method and apparatus for managing script files of devices Download PDF

Info

Publication number
CN109446100B
CN109446100B CN201811336967.1A CN201811336967A CN109446100B CN 109446100 B CN109446100 B CN 109446100B CN 201811336967 A CN201811336967 A CN 201811336967A CN 109446100 B CN109446100 B CN 109446100B
Authority
CN
China
Prior art keywords
script file
name
rule
data
symbol
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
CN201811336967.1A
Other languages
Chinese (zh)
Other versions
CN109446100A (en
Inventor
何万县
张保林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811336967.1A priority Critical patent/CN109446100B/en
Publication of CN109446100A publication Critical patent/CN109446100A/en
Application granted granted Critical
Publication of CN109446100B publication Critical patent/CN109446100B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3604Analysis of software for verifying properties of programs
    • G06F11/3608Analysis of software for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种管理设备的脚本文件的方法和装置。所述方法包括:获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则;在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容;对所述不符合规则的内容进行处理。

Figure 201811336967

The invention discloses a method and device for managing script files of equipment. The method includes: obtaining a benchmark writing rule for attribute values of a script file of a device, wherein the benchmark writing rule is a writing rule for setting symbols and/or fields according to a cache directory of the script file; after receiving the script file of the device , identify the content of the received script file by using the benchmark writing rule, and obtain the content that does not conform to the rules; and process the content that does not conform to the rules.

Figure 201811336967

Description

管理设备的脚本文件的方法和装置Method and apparatus for managing script files of devices

技术领域technical field

本发明涉及信息处理领域,尤指一种管理设备的脚本文件的方法和装置。The present invention relates to the field of information processing, in particular to a method and device for managing script files of equipment.

背景技术Background technique

随着海量数据的存储和应用,越来越多的硬件设备被应用在数据中心中,这些硬件设备的运行情况,必然会受到高度的重视和必要的监管。在对设备的监管中,需要定时检测这些设备的运行状态以及设置中的硬件的运行状态以及这些硬件的使用情况,其中硬件可以为CPU、内存、硬盘、raid和网卡等。服务器管理软件会通过运行脚本文件定时去抓取上述信息,进而得知设备的运行情况。然而在现实生产环境中,所需要的设备的类型和设备的厂商多种多样,设备的类型可以为服务器、存储设备、交换机和防火墙等,厂商可以为华为、中兴、思科和浪潮。由于厂商的差异造成设备的异构性,设备的功能的差异造成对每种设备的关注点不同,进而所需要的脚本文件也不同。每种厂商的每种设备需要不同脚本文件,因此需要大量的脚本文件。With the storage and application of massive data, more and more hardware devices are used in data centers, and the operation of these hardware devices will inevitably receive high attention and necessary supervision. In the supervision of devices, it is necessary to regularly detect the running status of these devices, the running status of the hardware in the settings, and the usage of these hardware, where the hardware can be CPU, memory, hard disk, raid, and network card. The server management software will periodically capture the above information by running the script file, and then know the operation status of the device. However, in a real production environment, there are various types of equipment and equipment manufacturers. The types of equipment can be servers, storage devices, switches, and firewalls, and the manufacturers can be Huawei, ZTE, Cisco, and Inspur. Due to the heterogeneity of the equipment caused by the difference of the manufacturers, the difference of the functions of the equipment results in different concerns for each equipment, and thus the required script files are also different. Different script files are required for each device of each manufacturer, so a large number of script files are required.

脚本的正确与否是通过脚本文件中的字段名是不是符合对该类型设备的字段名的定义来进行判断的,现有技术中脚本文件字段属性正确与否需要人工进行比对,每次写完一个脚本文件,都需要花费时间和精力进行排错。Whether the script is correct or not is judged by whether the field name in the script file conforms to the definition of the field name of the type of equipment. In the prior art, whether the field attribute of the script file is correct or not needs to be manually compared. After completing a script file, it takes time and effort to troubleshoot.

发明内容SUMMARY OF THE INVENTION

为了解决上述技术问题,本发明提供了一种管理设备的脚本文件的方法和装置,能够降低脚本文件的审核成本。In order to solve the above technical problems, the present invention provides a method and apparatus for managing script files of a device, which can reduce the audit cost of script files.

为了达到本发明目的,本发明提供了一种管理设备的脚本文件的方法,包括:In order to achieve the purpose of the present invention, the present invention provides a method for managing script files of equipment, including:

获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则;Obtaining a benchmark writing rule for attribute values of a script file of a device, wherein the benchmark writing rule is a writing rule set to symbols and/or fields according to a cache directory of the script file;

在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容;After receiving the script file of the device, use the benchmark writing rule to identify the content of the received script file, and obtain the content that does not meet the rules;

对所述不符合规则的内容进行处理。The content that does not meet the rules is processed.

在一个示例性实施例中,所述基准编写规则包括asset脚本文件对应的asset编辑规则和/或monitor脚本文件对应的monitor编辑规则;其中:In an exemplary embodiment, the benchmark writing rules include asset editing rules corresponding to the asset script file and/or monitor editing rules corresponding to the monitor script file; wherein:

所述asset编辑规则包括asset符号编写规则和/或asset字段编写规则;其中:The asset editing rules include asset symbol writing rules and/or asset field writing rules; wherein:

所述asset符号编写规则包括如下至少一个:The asset symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“-”符号;The symbol after the hardware name of a piece of data is the "-" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号,所述数据的其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon, and the symbol combination of other groups of data of the data is colon and comma;

所述asset字段编写规则包括:一条数据的字段名和“-”后的和逗号后的字段与asset脚本文件缓存目录中记录的信息一致;The asset field writing rules include: the field name of a piece of data and the fields after "-" and commas are consistent with the information recorded in the asset script file cache directory;

所述monitor编辑规则包括monitor符号编写规则和/或monitor字段编写规则;其中:The monitor editing rules include monitor symbol writing rules and/or monitor field writing rules; wherein:

所述monitor符号编写规则包括如下至少一个:The monitor symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“=”符号;The symbol after the hardware name of a piece of data is the "=" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号;所述数据中在符号“@_@后的”其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon; the symbol combination of other groups of data after the symbol "@_@" in the data is colon and comma;

其中,所述monitor字段编写规则包括:一条数据的字段名和“@_@”后的和逗号后的字段与monitor脚本文件缓存目录中记录的信息一致。Wherein, the monitor field writing rule includes: the field name of a piece of data and the fields after "@_@" and after the comma are consistent with the information recorded in the monitor script file cache directory.

在一个示例性实施例中,所述利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容之前,所述方法包括:In an exemplary embodiment, the method includes:

获取所述接收的脚本文件的名字信息,其中所述名字信息包括脚本文件的类型,其中脚本文件的类型为asset或monitor;Obtain the name information of the received script file, wherein the name information includes the type of the script file, and the type of the script file is asset or monitor;

根据所述脚本文件的类型,选择与所述脚本文件的类型匹配的基准编写规则。According to the type of the script file, a benchmark writing rule matching the type of the script file is selected.

在一个示例性实施例中,所述利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容,包括:In an exemplary embodiment, identifying the content of the received script file by using the benchmark writing rule to obtain content that does not conform to the rule, including:

对接收的脚本文件的内容编写顺序,依次获取脚本文件的设备名,判断所述第i个设备名是否与所述脚本文件的类型匹配的脚本文件的缓存目录中第一级缓存目录的第i个字段一致;其中,i=1,2,3……;For the content writing sequence of the received script file, obtain the device name of the script file in turn, and judge whether the i-th device name matches the i-th device name of the script file in the cache directory of the script file type. The fields are consistent; among them, i=1, 2, 3...;

获取所述脚本文件中第i个设备名对应的第j个硬件名,判断所述第j个硬件名是否与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段一致;Obtain the jth hardware name corresponding to the ith device name in the script file, and judge whether the jth hardware name is the second level cache directory in the cache directory of the script file that matches the type of the script file. The jth field is consistent;

获取所述述脚本文件中第j个硬件名对应的参数名,判断所述第j个硬件名对应的参数名与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段下对应的字段一致;其中,j=1,2,3……。Obtain the parameter name corresponding to the jth hardware name in the script file, and judge that the parameter name corresponding to the jth hardware name is the second-level cache directory in the cache directory of the script file that matches the type of the script file. The corresponding fields under the jth field of are consistent; among them, j=1, 2, 3... .

在一个示例性实施例中,所述对所述不符合规则的内容进行处理,包括:In an exemplary embodiment, the processing of the content that does not meet the rules includes:

获取所述不符合规则的内容在所述基准编写规则对应的目标信息;Obtain the target information corresponding to the benchmark writing rule for the content that does not conform to the rules;

利用所述目标信息,更正所述不符合规则的内容。Using the target information, the content that does not conform to the rules is corrected.

为了达到本发明目的,本发明提供了一种管理设备的脚本文件的装置,包括:In order to achieve the purpose of the present invention, the present invention provides a device for managing script files of equipment, including:

第一获取模块,用于获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则;a first acquiring module, used for acquiring a benchmark writing rule of attribute values of a script file of the device, wherein the benchmark writing rule is a writing rule set to symbols and/or fields according to the cache directory of the script file;

识别模块,用于在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容;The identification module is used to identify the content of the received script file by using the benchmark writing rule after receiving the script file of the device, and obtain the content that does not conform to the rules;

处理模块,用于对所述不符合规则的内容进行处理。A processing module, configured to process the content that does not conform to the rules.

在一个示例性实施例中,所述第一获取模块获取的基准编写规则包括asset脚本文件对应的asset编辑规则和/或monitor脚本文件对应的monitor编辑规则;其中:In an exemplary embodiment, the benchmark writing rules obtained by the first obtaining module include asset editing rules corresponding to the asset script file and/or monitor editing rules corresponding to the monitor script file; wherein:

所述asset编辑规则包括asset符号编写规则和/或asset字段编写规则;其中:The asset editing rules include asset symbol writing rules and/or asset field writing rules; wherein:

所述asset符号编写规则包括如下至少一个:The asset symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“-”符号;The symbol after the hardware name of a piece of data is the "-" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号,所述数据的其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon, and the symbol combination of other groups of data of the data is colon and comma;

所述asset字段编写规则包括:一条数据的字段名和“-”后的和逗号后的字段与asset脚本文件缓存目录中记录的信息一致;The asset field writing rules include: the field name of a piece of data and the fields after "-" and commas are consistent with the information recorded in the asset script file cache directory;

所述monitor编辑规则包括monitor符号编写规则和/或monitor字段编写规则;其中:The monitor editing rules include monitor symbol writing rules and/or monitor field writing rules; wherein:

所述monitor符号编写规则包括如下至少一个:The monitor symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“=”符号;The symbol after the hardware name of a piece of data is the "=" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号;所述数据中在符号“@_@后的”其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon; the symbol combination of other groups of data after the symbol "@_@" in the data is colon and comma;

其中,所述monitor字段编写规则包括:一条数据的字段名和“@_@”后的和逗号后的字段与monitor脚本文件缓存目录中记录的信息一致。Wherein, the monitor field writing rule includes: the field name of a piece of data and the fields after "@_@" and after the comma are consistent with the information recorded in the monitor script file cache directory.

在一个示例性实施例中,所述装置还包括:In an exemplary embodiment, the apparatus further comprises:

第二获取模块,用于在利用所述基准编写规则对接收到的脚本文件的内容进行识别之前,获取所述接收的脚本文件的名字信息,其中所述名字信息包括脚本文件的类型,其中脚本文件的类型为asset或monitor;The second obtaining module is configured to obtain name information of the received script file before identifying the content of the received script file by using the benchmark writing rule, wherein the name information includes the type of the script file, wherein the script file The type of the file is asset or monitor;

选择模块,用于根据所述脚本文件的类型,选择与所述脚本文件的类型匹配的基准编写规则。A selection module, configured to select a benchmark writing rule matching the type of the script file according to the type of the script file.

在一个示例性实施例中,所述识别模块包括:In an exemplary embodiment, the identification module includes:

第一匹配单元,用于对接收的脚本文件的内容编写顺序,依次获取脚本文件的设备名,判断所述第i个设备名是否与所述脚本文件的类型匹配的脚本文件的缓存目录中第一级缓存目录的第i个字段一致;其中,i=1,2,3……;The first matching unit is used to write the order of the content of the received script file, obtain the device name of the script file in turn, and judge whether the i-th device name matches the type of the script file in the cache directory of the script file. The i-th field of the first-level cache directory is consistent; where, i=1, 2, 3...;

第二匹配单元,用于获取所述脚本文件中第i个设备名对应的第j个硬件名,判断所述第j个硬件名是否与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段一致;The second matching unit is configured to obtain the jth hardware name corresponding to the ith device name in the script file, and determine whether the jth hardware name is the cache directory of the script file matching the type of the script file The jth field of the second-level cache directory is consistent;

第三匹配单元,获取所述述脚本文件中第j个硬件名对应的参数名,判断所述第j个硬件名对应的参数名与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段下对应的字段一致;其中,j=1,2,3……。The third matching unit obtains the parameter name corresponding to the jth hardware name in the script file, and judges that the parameter name corresponding to the jth hardware name is in the cache directory of the script file matching the type of the script file The corresponding fields under the jth field of the second-level cache directory are consistent; among them, j=1, 2, 3 . . .

在一个示例性实施例中,所述处理模块包括:In an exemplary embodiment, the processing module includes:

获取单元,用于获取所述不符合规则的内容在所述基准编写规则对应的目标信息;an acquisition unit, configured to acquire target information corresponding to the content that does not conform to the rules in the benchmark writing rule;

更正单元,用于利用所述目标信息,更正所述不符合规则的内容。A correction unit, configured to correct the content that does not conform to the rules by using the target information.

本发明提供的实施例,获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则,并在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容,对所述不符合规则的内容进行处理,实现自动识别出不符合规则的内容的目的,不再依赖于人工核对,降低脚本文件的审核成本。In an embodiment provided by the present invention, a benchmark writing rule for attribute values of a script file of a device is obtained, wherein the benchmark writing rule is a writing rule for setting symbols and/or fields according to the cache directory of the script file, and is received when the device's script file is received. After the script file, use the benchmark writing rules to identify the content of the received script file, obtain the content that does not conform to the rules, process the content that does not conform to the rules, and realize the purpose of automatically identifying the content that does not conform to the rules , no longer rely on manual verification, and reduce the audit cost of script files.

本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the description, claims and drawings.

附图说明Description of drawings

附图用来提供对本发明技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本发明的技术方案,并不构成对本发明技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solutions of the present invention, and constitute a part of the specification. They are used to explain the technical solutions of the present invention together with the embodiments of the present application, and do not limit the technical solutions of the present invention.

图1为本发明提供的管理设备的脚本文件的方法的流程图;1 is a flowchart of a method for managing a script file of a device provided by the present invention;

图2为本发明提供的管理设备的脚本文件的装置的结构图。FIG. 2 is a structural diagram of an apparatus for managing script files of a device provided by the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the objectives, technical solutions and advantages of the present invention clearer, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, the embodiments in the present application and the features in the embodiments may be arbitrarily combined with each other if there is no conflict.

在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps shown in the flowcharts of the figures may be performed in a computer system, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.

图1为本发明提供的管理设备的脚本文件的方法的流程图。图1所示方法包括:FIG. 1 is a flowchart of a method for managing script files of a device provided by the present invention. The method shown in Figure 1 includes:

步骤101、获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则;Step 101, obtaining the benchmark writing rule of the attribute value of the script file of the device, wherein the benchmark writing rule is a writing rule set to symbols and/or fields according to the cache directory of the script file;

其中上述两个脚本的缓存目录内容均配置如下:第一级目录为设备名,第二级目录为硬件名,第三级为硬件参数名。The contents of the cache directories of the above two scripts are configured as follows: the first-level directory is the device name, the second-level directory is the hardware name, and the third-level directory is the hardware parameter name.

其中,字符的编写规则是根据脚本文件中约定的符号使用规范设置的,字段的编写规则是根据缓存目录设置的;Among them, the writing rules of characters are set according to the usage specification of symbols agreed in the script file, and the writing rules of fields are set according to the cache directory;

步骤102、在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容;Step 102, after receiving the script file of the device, use the benchmark writing rule to identify the content of the received script file, and obtain the content that does not meet the rules;

其中,通过对接收的脚本文件进行字符的解析,比对出不符合规则的内容;Among them, by analyzing the characters of the received script file, the content that does not conform to the rules is compared;

步骤103、对所述不符合规则的内容进行处理。Step 103: Process the content that does not meet the rules.

在本步骤中,可以将不符合规则的内容进行输出,或者,对该内容进行更正处理。In this step, the content that does not conform to the rules may be output, or the content may be corrected.

本发明提供的方法实施例,获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则,并在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容,对所述不符合规则的内容进行处理,实现自动识别出不符合规则的内容的目的,不再依赖于人工核对,降低脚本文件的审核成本。In the method embodiment provided by the present invention, a benchmark writing rule for attribute values of a script file of a device is obtained, wherein the benchmark writing rule is a writing rule for setting symbols and/or fields according to the cache directory of the script file, and when the device receives the After writing the script file, use the benchmark writing rules to identify the content of the received script file, obtain the content that does not meet the rules, process the content that does not meet the rules, and realize automatic identification of the content that does not meet the rules. The purpose is to no longer rely on manual verification and reduce the audit cost of script files.

下面对本发明提供的方法作进一步说明:The method provided by the invention is further described below:

每种厂商的每种设备有两类脚本文件,名字分别为asset和monitor,其中asset主要是用来获取硬件的状态、厂家、型号、类型和容量等信息,monitor主要是用来获取硬件的温度,使用情况和剩余情况等信息。由于对每种设备的关注点相同,不同厂商的同种设备的脚本文件中字段名是相同的,每种设备的所有属性都存在一个带有二级目录的缓存中,而且脚本文件中的字段名和缓存中相应位置的的属性名是一一对应的。There are two types of script files for each device of each manufacturer, named asset and monitor. Asset is mainly used to obtain information such as hardware status, manufacturer, model, type, and capacity, and monitor is mainly used to obtain hardware temperature. , usage and remaining information. Due to the same focus on each device, the field names in the script file of the same device from different manufacturers are the same, all attributes of each device are stored in a cache with a secondary directory, and the fields in the script file There is a one-to-one correspondence between the name and the attribute name in the corresponding position in the cache.

此时需要对脚本文件的字段名进行自动校验,并且将不合法的字段名进行自动修正。At this time, it is necessary to automatically verify the field names of the script file, and automatically correct the invalid field names.

基于上述技术需求,发明人设计的技术方案包括文件内容检查模块、名字识别模块、不合法字段检查与修复模块,用于实现对脚本文件中字段属性的自动校验。Based on the above technical requirements, the technical solution designed by the inventor includes a file content checking module, a name recognition module, and an illegal field checking and repairing module, which are used to realize automatic verification of field attributes in script files.

首先准备两个缓存文件,分别存放asset脚本和monitor脚本的所有属性信息,配置两个缓存文件的存储的目录结构。First, prepare two cache files to store all the attribute information of the asset script and the monitor script respectively, and configure the storage directory structure of the two cache files.

其中上述两个脚本的缓存目录内容均配置如下:第一级目录为设备名,第二级目录为硬件名,第三级为硬件参数名。The contents of the cache directories of the above two scripts are configured as follows: the first-level directory is the device name, the second-level directory is the hardware name, and the third-level directory is the hardware parameter name.

其中,asset缓存目录表如表1所示:Among them, the asset cache directory table is shown in Table 1:

Figure GDA0003513365550000071
Figure GDA0003513365550000071

Figure GDA0003513365550000081
Figure GDA0003513365550000081

表1其中,monitor缓存目录表如表2所示:Among them, the monitor cache directory table is shown in Table 2:

Figure GDA0003513365550000082
Figure GDA0003513365550000082

Figure GDA0003513365550000091
Figure GDA0003513365550000091

表2Table 2

其中,表1和表2中存入的硬件名和字段名为括号的英文,其中的中文用于辅助理解。Among them, the hardware names and field names stored in Table 1 and Table 2 are in English in brackets, and Chinese in them is used to assist understanding.

在一个示例性实施例中,所述基准编写规则包括asset脚本文件对应的asset编辑规则和/或monitor脚本文件对应的monitor编辑规则;其中:In an exemplary embodiment, the benchmark writing rules include asset editing rules corresponding to the asset script file and/or monitor editing rules corresponding to the monitor script file; wherein:

所述asset编辑规则包括asset符号编写规则和/或asset字段编写规则;其中:The asset editing rules include asset symbol writing rules and/or asset field writing rules; wherein:

所述asset符号编写规则包括如下至少一个:The asset symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“-”符号;The symbol after the hardware name of a piece of data is the "-" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号,所述数据的其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon, and the symbol combination of other groups of data of the data is colon and comma;

所述asset字段编写规则包括:一条数据的字段名和“-”后的和逗号后的字段与asset脚本文件缓存目录中记录的信息一致;The asset field writing rules include: the field name of a piece of data and the fields after "-" and commas are consistent with the information recorded in the asset script file cache directory;

所述monitor编辑规则包括monitor符号编写规则和/或monitor字段编写规则;其中:The monitor editing rules include monitor symbol writing rules and/or monitor field writing rules; wherein:

所述monitor符号编写规则包括如下至少一个:The monitor symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“=”符号;The symbol after the hardware name of a piece of data is the "=" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号;所述数据中在符号“@_@后的”其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon; the symbol combination of other groups of data after the symbol "@_@" in the data is colon and comma;

其中,所述monitor字段编写规则包括:一条数据的字段名和“@_@”后的和逗号后的字段与monitor脚本文件缓存目录中记录的信息一致。Wherein, the monitor field writing rule includes: the field name of a piece of data and the fields after "@_@" and after the comma are consistent with the information recorded in the monitor script file cache directory.

通过设置上述的编写规则,可以对脚本文件中的符号和/或字段进行校验,降低脚本文件的审核成本。By setting the above writing rules, the symbols and/or fields in the script file can be verified, thereby reducing the audit cost of the script file.

在一个示例性实施例中,所述利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容之前,所述方法包括:In an exemplary embodiment, the method includes:

获取所述接收的脚本文件的名字信息,其中所述名字信息包括脚本文件的类型,其中脚本文件的类型为asset或monitor;Obtain the name information of the received script file, wherein the name information includes the type of the script file, and the type of the script file is asset or monitor;

根据所述脚本文件的类型,选择与所述脚本文件的类型匹配的基准编写规则。According to the type of the script file, a benchmark writing rule matching the type of the script file is selected.

在本示例性实施例中,设置脚本文件的内容格式,其中脚本文件的名字命名方式如下:In this exemplary embodiment, the content format of the script file is set, wherein the name of the script file is named as follows:

厂商名-设备名-asset(或monitor);Manufacturer name-device name-asset (or monitor);

例如:inspur-rackserver-asset。For example: inspur-rackserver-asset.

asset脚本内容格式中每类硬件可以采用如下方式记录:Each type of hardware in the asset script content format can be recorded as follows:

硬件名-参数名1:参数值1,参数名2:参数值2,……参数名m:参数值m;其中m为大于等于1的整数。Hardware name - parameter name 1: parameter value 1, parameter name 2: parameter value 2, ... parameter name m: parameter value m; where m is an integer greater than or equal to 1.

CPU-cpuslot:slot,cpufrequency:frequency,cpucore:core,cpustatus:status,cpuvendor:vendor,cputhread:thread;CPU-cpuslot:slot,cpufrequency:frequency,cpucore:core,cpustatus:status,cpuvendor:vendor,cputhread:thread;

monitor脚本内容格式可以采用如下方式记录:The content format of the monitor script can be recorded as follows:

硬件名=@_@参数名1:参数值1,参数名2:参数值2,……参数名m:参数值n;其中n为大于等于1的整数。Hardware name = @_@Parameter name 1: parameter value 1, parameter name 2: parameter value 2, ... parameter name m: parameter value n; where n is an integer greater than or equal to 1.

CPU=@_@cpuusage:usage,cputemp:temp;CPU=@_@cpuusage:usage,cputemp:temp;

当完成一个脚本文件的编写后,先根据文件名中的最后一个单词,识别出来是asset类型还是monitor类型。After completing the writing of a script file, first identify whether it is an asset type or a monitor type according to the last word in the file name.

然后,启动内容检查模块判断改脚本是不是符合该类脚本的符号编写规范,可以包括如下内容:Then, start the content checking module to determine whether the modified script conforms to the symbol writing specification of this type of script, which can include the following:

若为asset脚本,首先查看第一列的编写方式是否符合预先设置的asset符号编写规则,其中所述asset符号编写规则包括:If it is an asset script, first check whether the writing method of the first column complies with the preset writing rules for asset symbols, where the writing rules for asset symbols include:

1、硬件名后的符号是否为“-”符号;1. Whether the symbol after the hardware name is a "-" symbol;

2、除该条数据的最后一组数据的符号组合为冒号和分号;该条数据的其他组数据的符号组合均为冒号和逗号;2. The symbol combination of the last group of data except this piece of data is colon and semicolon; the symbol combination of other groups of data of this piece of data is colon and comma;

若不符合以上规范,则进行改正;If it does not meet the above specifications, make corrections;

若为monitor脚本,首先查看第一列的编写方式是否符合预先设置的monitor符号编写规则,其中所述编写规则包括:If it is a monitor script, first check whether the writing method of the first column complies with the preset monitor symbol writing rules, where the writing rules include:

1、硬件名后的符号是否为“=”符号;1. Whether the symbol after the hardware name is an "=" symbol;

2、除该条数据的最后一组数据的符号组合为冒号和分号;该条数据中在符号“@_@后的”其他组数据的符号组合均为冒号和逗号;2. The symbol combination of the last group of data except this piece of data is colon and semicolon; the symbol combination of other groups of data after the symbol "@_@" in this piece of data are colon and comma;

若不符合以上规范,则进行改正。If it does not meet the above specifications, make corrections.

其中,所说的标点符号皆为英文标点符号。Among them, the punctuation marks mentioned are all English punctuation marks.

在完成对符号编写的识别后,启动名字识别流程,可以包括如下内容:After completing the recognition of the symbol writing, start the name recognition process, which can include the following:

在一个示例性实施例中,所述利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容,包括:In an exemplary embodiment, identifying the content of the received script file by using the benchmark writing rule to obtain content that does not conform to the rule, including:

对接收的脚本文件的内容编写顺序,依次获取脚本文件的设备名,判断所述第i个设备名是否与所述脚本文件的类型匹配的脚本文件的缓存目录中第一级缓存目录的第i个字段一致;其中,i=1,2,3……;For the content writing sequence of the received script file, obtain the device name of the script file in turn, and judge whether the i-th device name matches the i-th device name of the script file in the cache directory of the script file type. The fields are consistent; among them, i=1, 2, 3...;

获取所述脚本文件中第i个设备名对应的第j个硬件名,判断所述第j个硬件名是否与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段一致;Obtain the jth hardware name corresponding to the ith device name in the script file, and judge whether the jth hardware name is the second level cache directory in the cache directory of the script file that matches the type of the script file. The jth field is consistent;

获取所述述脚本文件中第j个硬件名对应的参数名,判断所述第j个硬件名对应的参数名与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段下对应的字段一致;其中,j=1,2,3……。Obtain the parameter name corresponding to the jth hardware name in the script file, and judge that the parameter name corresponding to the jth hardware name is the second-level cache directory in the cache directory of the script file that matches the type of the script file. The corresponding fields under the jth field are consistent; among them, j=1, 2, 3....

在一个示例性实施例中,所述对所述不符合规则的内容进行处理,包括:In an exemplary embodiment, the processing of the content that does not meet the rules includes:

获取所述不符合规则的内容在所述基准编写规则对应的目标信息;Obtain the target information corresponding to the benchmark writing rule for the content that does not conform to the rules;

利用所述目标信息,更正所述不符合规则的内容。在脚本文件中找出设备名,取出设备名找缓存文件中对应的位置,在缓存文件中找出第一个硬件名,取出该硬件名中所有字段。Using the target information, the content that does not conform to the rules is corrected. Find the device name in the script file, take out the device name to find the corresponding position in the cache file, find the first hardware name in the cache file, and take out all the fields in the hardware name.

进入不合法字段检查与修复模块,拿刚才取出的设备名查找脚本文件中对应的行,可以包括:Enter the illegal field check and repair module, and use the device name just taken out to find the corresponding line in the script file, which can include:

若为asset文件,把刚才取出的字段名和“-”后的和逗号后的字段一一进行比较,若脚本文件中的与缓存文件中的不一致,则改正脚本文件中的字段名,如果发现脚本文件中的字段名不够,则把硬件名记录下来,通知人工修复;If it is an asset file, compare the field name just taken out with the fields after "-" and the fields after the comma one by one. If the script file is inconsistent with the cache file, correct the field name in the script file. If the script file is found If the field name in the file is not enough, record the hardware name and notify manual repair;

若为monitor文件,把刚才取出的字段名和“@_@”后的和逗号后的字段一一进行比较,若脚本文件中的与缓存文件中的不一致,则改正脚本文件中的字段名,如果发现脚本文件中的字段名不够,则把硬件名记录下来,通知人工修复。If it is a monitor file, compare the field name just taken out with the fields after "@_@" and the fields after the comma one by one. If the script file is inconsistent with the cache file, correct the field name in the script file. If If the field name in the script file is found to be insufficient, record the hardware name and notify manual repair.

在校验完一个硬件的信息后,从缓存中取下一个硬件名及其字段,直到校验完缓存文件中第一级目录下的所有硬件名为止。After verifying the information of a piece of hardware, a hardware name and its fields are removed from the cache until all hardware names in the first-level directory in the cache file are verified.

例如,在脚本文件中找出的设备名为rackserver,取出设备名找到缓存文件中对应的位置,即该设备名对应的第一级目录,在缓存文件中找出第一个硬件名,即该设备名的第二级目录,可以为CPU,取出该硬件名中所有字段,例如,可以为cpuslot、cpufrequency、cpucore、cpustatus、cpuvendor和cputhread。进入不合法字段检查与修复模块,拿刚才取出的设备名(CPU)查找脚本文件中对应的行,把刚才取出的字段名和“-”后的和逗号后的字段一一进行比较。若脚本文件中的与缓存文件中的不一致,则改正脚本文件中的字段名,如果发现脚本文件中的字段名不够,则把硬件名(CPU)记录下来,通知人工修复。校验完一个硬件的信息后,从缓存中取下一个硬件名及其字段,直到校验完缓存文件中第一级目录下的所有硬件名为止。For example, the name of the device found in the script file is rackserver, take out the device name to find the corresponding location in the cache file, that is, the first level directory corresponding to the device name, and find the first hardware name in the cache file, that is, the The second-level directory of the device name can be CPU, and all fields in the hardware name can be extracted, for example, cpuslot, cpufrequency, cpucore, cpustatus, cpuvendor, and cputhread. Enter the illegal field check and repair module, find the corresponding line in the script file with the device name (CPU) just taken out, and compare the field name just taken out with the fields after "-" and commas one by one. If the script file is inconsistent with the cache file, correct the field name in the script file. If the field name in the script file is found to be insufficient, record the hardware name (CPU) and notify manual repair. After verifying the information of a piece of hardware, a hardware name and its fields are removed from the cache until all hardware names in the first-level directory in the cache file are verified.

本发明为对脚本文件中字段属性的自动校验装置,该装置能自动校验脚本文件中不规范与不正确的地方,并能适当进行自动修复,从而不再依赖于人工进行核对,而是通过自动校验与修复脚本中不正确的位置,快速而准确的完成一个脚本的编写。The present invention is an automatic verification device for field attributes in a script file. The device can automatically verify the irregular and incorrect places in the script file, and can automatically repair it properly, so that it no longer relies on manual verification, but Write a script quickly and accurately by automatically checking and fixing incorrect positions in the script.

图2为本发明提供的管理设备的脚本文件的装置的结构图。图2所示装置包括:FIG. 2 is a structural diagram of an apparatus for managing script files of a device provided by the present invention. The device shown in Figure 2 includes:

第一获取模块201,用于获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则;a first obtaining module 201, configured to obtain a benchmark writing rule for attribute values of a script file of the device, wherein the benchmark writing rule is a writing rule set to symbols and/or fields according to a cache directory of the script file;

识别模块202,用于在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容;The identification module 202 is configured to, after receiving the script file of the device, identify the content of the received script file by using the benchmark writing rule, and obtain the content that does not conform to the rule;

处理模块203,用于对所述不符合规则的内容进行处理。The processing module 203 is configured to process the content that does not meet the rules.

在一个示例性实施例中,所述第一获取模块201获取的基准编写规则包括asset脚本文件对应的asset编辑规则和/或monitor脚本文件对应的monitor编辑规则;其中:In an exemplary embodiment, the benchmark writing rules obtained by the first obtaining module 201 include asset editing rules corresponding to the asset script file and/or monitor editing rules corresponding to the monitor script file; wherein:

所述asset编辑规则包括asset符号编写规则和/或asset字段编写规则;其中:The asset editing rules include asset symbol writing rules and/or asset field writing rules; wherein:

所述asset符号编写规则包括如下至少一个:The asset symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“-”符号;The symbol after the hardware name of a piece of data is the "-" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号,所述数据的其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon, and the symbol combination of other groups of data of the data is colon and comma;

所述asset字段编写规则包括:一条数据的字段名和“-”后的和逗号后的字段与asset脚本文件缓存目录中记录的信息一致;The asset field writing rule includes: the field name of a piece of data and the fields after "-" and commas are consistent with the information recorded in the asset script file cache directory;

所述monitor编辑规则包括monitor符号编写规则和/或monitor字段编写规则;其中:The monitor editing rules include monitor symbol writing rules and/or monitor field writing rules; wherein:

所述monitor符号编写规则包括如下至少一个:The monitor symbol writing rule includes at least one of the following:

一条数据的硬件名后的符号为“=”符号;The symbol after the hardware name of a piece of data is the "=" symbol;

除一条数据的最后一组数据的符号组合为冒号和分号;所述数据中在符号“@_@后的”其他组数据的符号组合均为冒号和逗号;The symbol combination of the last group of data except one piece of data is colon and semicolon; the symbol combination of other groups of data after the symbol "@_@" in the data is colon and comma;

其中,所述monitor字段编写规则包括:一条数据的字段名和“@_@”后的和逗号后的字段与monitor脚本文件缓存目录中记录的信息一致。Wherein, the monitor field writing rule includes: the field name of a piece of data and the fields after "@_@" and after the comma are consistent with the information recorded in the monitor script file cache directory.

在一个示例性实施例中,所述装置还包括:In an exemplary embodiment, the apparatus further comprises:

第二获取模块,用于在利用所述基准编写规则对接收到的脚本文件的内容进行识别之前,获取所述接收的脚本文件的名字信息,其中所述名字信息包括脚本文件的类型,其中脚本文件的类型为asset或monitor;The second obtaining module is configured to obtain name information of the received script file before identifying the content of the received script file by using the benchmark writing rule, wherein the name information includes the type of the script file, wherein the script file The type of the file is asset or monitor;

选择模块,用于根据所述脚本文件的类型,选择与所述脚本文件的类型匹配的基准编写规则。A selection module, configured to select a benchmark writing rule matching the type of the script file according to the type of the script file.

在一个示例性实施例中,所述识别模块202包括:In an exemplary embodiment, the identification module 202 includes:

第一匹配单元,用于对接收的脚本文件的内容编写顺序,依次获取脚本文件的设备名,判断所述第i个设备名是否与所述脚本文件的类型匹配的脚本文件的缓存目录中第一级缓存目录的第i个字段一致;其中,i=1,2,3……;The first matching unit is used to write the order of the content of the received script file, obtain the device name of the script file in turn, and judge whether the i-th device name matches the type of the script file in the cache directory of the script file. The i-th field of the first-level cache directory is consistent; where, i=1, 2, 3...;

第二匹配单元,用于获取所述脚本文件中第i个设备名对应的第j个硬件名,判断所述第j个硬件名是否与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段一致;The second matching unit is configured to obtain the jth hardware name corresponding to the ith device name in the script file, and determine whether the jth hardware name is the cache directory of the script file matching the type of the script file The jth field of the second-level cache directory is consistent;

第三匹配单元,获取所述述脚本文件中第j个硬件名对应的参数名,判断所述第j个硬件名对应的参数名与与所述脚本文件的类型匹配的脚本文件的缓存目录中第二级缓存目录的第j个字段下对应的字段一致;其中,j=1,2,3……。The third matching unit obtains the parameter name corresponding to the jth hardware name in the script file, and judges that the parameter name corresponding to the jth hardware name is in the cache directory of the script file matching the type of the script file The corresponding fields under the jth field of the second-level cache directory are consistent; among them, j=1, 2, 3 . . .

在一个示例性实施例中,所述处理模块203包括:In an exemplary embodiment, the processing module 203 includes:

获取单元,用于获取所述不符合规则的内容在所述基准编写规则对应的目标信息;an acquisition unit, configured to acquire target information corresponding to the content that does not conform to the rules in the benchmark writing rule;

更正单元,用于利用所述目标信息,更正所述不符合规则的内容。A correction unit, configured to correct the content that does not conform to the rules by using the target information.

本发明提供的装置实施例,获取设备的脚本文件的属性值的基准编写规则,其中所述基准编写规则是根据脚本文件的缓存目录对符号和/或字段设置的编写规则,并在接收到设备的脚本文件后,利用所述基准编写规则对接收到的脚本文件的内容进行识别,得到不符合规则的内容,对所述不符合规则的内容进行处理,实现自动识别出不符合规则的内容的目的,不再依赖于人工核对,降低脚本文件的审核成本。According to an apparatus embodiment provided by the present invention, a benchmark writing rule for attribute values of a script file of a device is obtained, wherein the benchmark writing rule is a writing rule for setting symbols and/or fields according to a cache directory of the script file, and when the device receives the After writing the script file, use the benchmark writing rules to identify the content of the received script file, obtain the content that does not meet the rules, process the content that does not meet the rules, and realize automatic identification of the content that does not meet the rules. The purpose is to no longer rely on manual verification and reduce the audit cost of script files.

本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, functional modules/units in the systems, and devices can be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be composed of several physical components Components execute cooperatively. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules or other data flexible, removable and non-removable media. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .

Claims (8)

1. A method of managing a script file for a device, comprising:
acquiring a reference writing rule of an attribute value of a script file of equipment, wherein the reference writing rule is a writing rule set for symbols and/or fields according to a cache directory of the script file;
after receiving the script file of the equipment, identifying the content of the received script file by using the reference writing rule to obtain the content which does not accord with the rule;
processing the content which does not accord with the rule;
each type of hardware in the asset script content format can be recorded in the following manner:
hardware name-parameter name 1: parameter value 1, parameter name 2: parameter values 2, … … parameter name m: a parameter value m; wherein m is an integer greater than or equal to 1;
the monitor script content format may be recorded as follows:
hardware name @ parameter name 1: parameter value 1, parameter name 2: parameter values 2, … … parameter name m: a parameter value n; wherein n is an integer greater than or equal to 1; the standard compiling rule comprises an asset editing rule corresponding to an asset script file and/or a monitor editing rule corresponding to a monitor script file; wherein:
the asset editing rule comprises an asset symbol writing rule and/or an asset field writing rule; wherein:
the asset symbol writing rule comprises at least one of:
the symbol after the hardware name of a piece of data is a "-" symbol;
except that the symbol combination of the last group of data of one piece of data is colon and semicolon, and the symbol combinations of other groups of data of the data are colon and comma;
the asset field writing rule comprises the following steps: the field name, the fields after the "-" and the comma of one piece of data are consistent with the information recorded in the cache directory of the asset script file;
the monitor editing rule comprises a monitor symbol writing rule and/or a monitor field writing rule; wherein:
the monitor symbol writing rule comprises at least one of the following:
the symbol after the hardware name of one piece of data is a symbol;
dividing the symbol combination of the last group of data of one piece of data into colon and semicolon; the symbol combinations of other groups of data after the symbol "@ are both colon and comma in the data;
wherein the monitor field writing rule comprises: the field name of a piece of data, the fields after "@ _ @ and comma are consistent with the information recorded in the cache directory of the monitor script file.
2. The method according to claim 1, wherein before identifying the content of the received script file using the reference composition rule and obtaining the content that does not conform to the rule, the method comprises:
acquiring name information of the received script file, wherein the name information comprises the type of the script file, and the type of the script file is asset or monitor;
and selecting a reference writing rule matched with the type of the script file according to the type of the script file.
3. The method of claim 1, wherein identifying the content of the received script file using the reference composition rule to obtain content that does not comply with the rule comprises:
sequentially acquiring the device names of the script files according to the content compiling sequence of the received script files, and judging whether the ith device name in the script file is consistent with the ith field of the first-level cache directory in the cache directory of the script file matched with the type of the script file; wherein i is 1,2,3 … …;
acquiring a jth hardware name corresponding to an ith equipment name in the script file, and judging whether the jth hardware name is consistent with a jth field of a second-level cache directory in a cache directory of the script file matched with the type of the script file;
acquiring a parameter name corresponding to a jth hardware name in the script file, and judging that the parameter name corresponding to the jth hardware name is consistent with a field corresponding to a jth field of a second-level cache directory in a cache directory of the script file matched with the type of the script file; wherein j is 1,2,3 … ….
4. The method of claim 1, wherein the processing the content that does not comply with the rules comprises:
acquiring target information corresponding to the reference writing rule of the content which does not accord with the rule;
and correcting the content which does not conform to the rules by utilizing the target information.
5. An apparatus for managing a script file for a device, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a reference writing rule of an attribute value of a script file of the device, and the reference writing rule is a writing rule set for symbols and/or fields according to a cache directory of the script file;
the identification module is used for identifying the content of the received script file by using the standard compiling rule after receiving the script file of the equipment to obtain the content which does not accord with the rule;
the processing module is used for processing the content which does not accord with the rule;
each type of hardware in the asset script content format can be recorded in the following manner:
hardware name-parameter name 1: parameter value 1, parameter name 2: parameter values 2, … … parameter name m: a parameter value m; wherein m is an integer greater than or equal to 1;
the monitor script content format may be recorded as follows:
hardware name @ parameter name 1: parameter value 1, parameter name 2: parameter values 2, … … parameter name m: a parameter value n; wherein n is an integer greater than or equal to 1;
the reference compiling rule acquired by the first acquiring module comprises an asset compiling rule corresponding to an asset script file and/or a monitor compiling rule corresponding to a monitor script file; wherein:
the asset editing rule comprises an asset symbol writing rule and/or an asset field writing rule; wherein:
the asset symbol writing rule comprises at least one of:
the symbol after the hardware name of a piece of data is a "-" symbol;
except that the symbol combination of the last group of data of one piece of data is colon and semicolon, and the symbol combinations of other groups of data of the data are colon and comma;
the asset field writing rule comprises the following steps: the field name, the fields after the "-" and the comma of one piece of data are consistent with the information recorded in the cache directory of the asset script file;
the monitor editing rule comprises a monitor symbol writing rule and/or a monitor field writing rule; wherein:
the monitor symbol writing rule comprises at least one of the following:
the symbol after the hardware name of one piece of data is a symbol;
dividing the symbol combination of the last group of data of one piece of data into colon and semicolon; the symbol combinations of other groups of data after the symbol "@ are both colon and comma in the data;
wherein the monitor field writing rule comprises: the field name of a piece of data, the fields after "@ _ @ and comma are consistent with the information recorded in the cache directory of the monitor script file.
6. The apparatus of claim 5, further comprising:
the second obtaining module is used for obtaining name information of the received script file before identifying the content of the received script file by using the reference writing rule, wherein the name information comprises the type of the script file, and the type of the script file is asset or monitor;
and the selection module is used for selecting a reference writing rule matched with the type of the script file according to the type of the script file.
7. The apparatus of claim 5, wherein the identification module comprises:
the first matching unit is used for compiling the content of the received script file in sequence, sequentially acquiring the device names of the script file, and judging whether the ith device name in the script file is consistent with the ith field of the first-level cache directory in the cache directory of the script file matched with the type of the script file; wherein i is 1,2,3 … …;
the second matching unit is used for acquiring a jth hardware name corresponding to the ith equipment name in the script file and judging whether the jth hardware name is consistent with a jth field of a second-level cache directory in a cache directory of the script file matched with the type of the script file;
the third matching unit is used for acquiring a parameter name corresponding to the jth hardware name in the script file and judging that the parameter name corresponding to the jth hardware name is consistent with a field corresponding to the jth field of a second-level cache directory in a cache directory of the script file matched with the type of the script file; wherein j is 1,2,3 … ….
8. The apparatus of claim 5, wherein the processing module comprises:
the acquiring unit is used for acquiring target information corresponding to the content which does not accord with the rules in the reference writing rule;
and the correcting unit is used for correcting the content which does not accord with the rule by utilizing the target information.
CN201811336967.1A 2018-11-12 2018-11-12 Method and apparatus for managing script files of devices Active CN109446100B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811336967.1A CN109446100B (en) 2018-11-12 2018-11-12 Method and apparatus for managing script files of devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811336967.1A CN109446100B (en) 2018-11-12 2018-11-12 Method and apparatus for managing script files of devices

Publications (2)

Publication Number Publication Date
CN109446100A CN109446100A (en) 2019-03-08
CN109446100B true CN109446100B (en) 2022-06-07

Family

ID=65551161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811336967.1A Active CN109446100B (en) 2018-11-12 2018-11-12 Method and apparatus for managing script files of devices

Country Status (1)

Country Link
CN (1) CN109446100B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114429114A (en) * 2022-01-25 2022-05-03 上海中通吉网络技术有限公司 A method and device for automatically parsing a jmeter script file to generate a report

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425497A (en) * 2013-08-15 2013-12-04 北京华胜天成科技股份有限公司 Network engineering script across-manufacturer conversion method and device
CN104778412A (en) * 2015-05-05 2015-07-15 中国农业银行股份有限公司 Method and system for checking script
CN107844425A (en) * 2017-11-16 2018-03-27 中国银行股份有限公司 A kind of database statement inspection method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2351990A1 (en) * 2001-06-26 2002-12-26 Ibm Canada Limited-Ibm Canada Limitee Rule based engine for validating financial transactions
WO2014115189A1 (en) * 2013-01-28 2014-07-31 Nec Corporation Method and system for transforming specification scripts to program code
CN103853589A (en) * 2014-02-26 2014-06-11 上海爱数软件有限公司 Cross-platform system compiling and building method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425497A (en) * 2013-08-15 2013-12-04 北京华胜天成科技股份有限公司 Network engineering script across-manufacturer conversion method and device
CN104778412A (en) * 2015-05-05 2015-07-15 中国农业银行股份有限公司 Method and system for checking script
CN107844425A (en) * 2017-11-16 2018-03-27 中国银行股份有限公司 A kind of database statement inspection method and device

Also Published As

Publication number Publication date
CN109446100A (en) 2019-03-08

Similar Documents

Publication Publication Date Title
US9535781B2 (en) System file repair method and apparatus
CN109542708B (en) A method and component for recording the correspondence between physical slots and system drive letters on a backplane
CN105260307A (en) BMC upgrading method and apparatus
CN112733199B (en) Data processing method, device, electronic equipment and readable storage medium
CN106775937A (en) A kind of order line method of calibration and device
CN107479823A (en) Data verification method and device in the test of random read-write file
CN105045721A (en) Method and device for checking data consistency
CN106802898B (en) Data entry method and device
CN117608618B (en) Server firmware upgrading method and device, storage medium and electronic equipment
CN105302924A (en) File management method and device
CN109446100B (en) Method and apparatus for managing script files of devices
WO2016165461A1 (en) Automated testing method and apparatus for network management system software of telecommunications network
CN112671942A (en) Method, device, equipment and storage medium for setting network port name
CN114490169B (en) A data page CRC check system
CN109032873A (en) A kind of server delivery detection method and device
CN106933888A (en) Database configuration management system
CN112784540B (en) Document number checking method and device
CN110807037B (en) Data modification method and device, electronic equipment and storage medium
CN111324581A (en) A file writing method, device, device and storage medium
CN114077545B (en) Method, device, equipment and readable storage medium for obtaining verification data
CN111371818A (en) Data request verification method, device and equipment
US12223690B2 (en) Face clustering method and apparatus, classification storage method, medium and electronic device
CN116401229A (en) Database data verification method, device and equipment
CN115550411A (en) Smart cabinet remote acceptance and activation method, device, computer equipment and storage medium
WO2019056545A1 (en) Test machine automation management method and apparatus, device, and storage medium

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