A kind of method of the judgement that realizes reporting to the police
Technical field
The present invention relates to the method for reporting to the police in the computer system, specially refer to a kind of method of the judgement that realizes reporting to the police.
Background technology
The threshold value management system is the key submodule of performance ADMINISTRATION SUBSYSTEM in the network management system (NMS is called for short network management system).Generally, the Monitoring Data that described threshold value management system reports according to network management system, the report to the police expression formula of judgement of being used to user input is carried out analytical Calculation, and then judge whether that according to described result of calculation needs open or close warning system, thereby realize the performance management in the network management system.From above-mentioned threshold value management process as can be seen, the analytic method to expression formula that the user imports is that network management system is carried out one of comparatively crucial technology of performance management.
The method of existing threshold value management system analytical expression mainly may further comprise the steps:
The legitimacy of A, expression formula that inspection user is imported.
Generally, comprise predefined operator and operand in the expression formula of user's input, expression formula for the parsing of threshold value management system, the operand that wherein comprises is the title of the network management system measuring unit of monitoring just, employed parameter value when on behalf of current network management system, these measuring unit titles carry out performance test.
In the checkout procedure of expression formula legitimacy, at first need from expression formula to be tested, to identify operand and the operator that is comprised respectively, and then check this expression formula whether up to specification.
In the prior art, for common expression formula, the all operations that wherein may comprise symbol all is predefined operators, and these operators are easy to be discerned by the threshold value management system, and the operand that comprises in the expression formula is then varied, be not easy to discern.Therefore, in the resolving of expression formula, the separator that the threshold value management system is used as the operator in the expression formula between the operand is usually discerned the different operating number that this expression formula comprises.
For example, the expression formula of user's input is ((Traffic>10) ﹠amp; ﹠amp; (Load<2)), its included operator has: (),>, ﹠amp; ﹠amp; ,<; The operand that is comprised has Traffic, 10, Load and 2, and wherein, Traffic, Load are the measuring unit title that two network management systems need be monitored.
Because operator (),>, ﹠amp; ﹠amp; The predefined operator of,<be can easier be discerned by the threshold value management system, therefore, before the check of legitimacy, the threshold value management system can with the operator in this expression formula (),>, ﹠amp; ﹠amp; ,<carry out the parsing of expression formula as separator between its operand Traffic, 10, the Load and 2.For example, in resolving, when the threshold value management system retrieve operator (with>time, the Traffic that just can judge between these two operators is an operand; Equally, when the operator that continues to detect the back) time, just can judge operator>and) between 10 are another operands.By that analogy, all operations that the threshold value management system just can be distinguished this expression formula successively and be comprised accords with and operand, and then carries out the legitimacy check of expression formula.
B, will check legal expression formula to be converted to consequent expression formula from the preceding paragraph expression formula.
Generally, in the computational process of expression formula, all be to use storehouse to store described operand and operator, therefore, the speed that the storage of storehouse for convenience, quickening expression formula are calculated, after the check of the legitimacy of expression formula, also need checking legal expression formula to carry out conversion from the preceding paragraph expression formula to consequent expression formula.This preceding paragraph expression formula employed preceding paragraph expression formula in the conversion method of consequent expression formula and the computer compiling is basic identical to the conversion method of consequent expression formula, here just has been not described in detail.
For example, use the conversion method of existing preceding paragraph expression formula, to above-mentioned expression formula ((Traffic>10) ﹠amp to consequent expression formula; ﹠amp; (Load<2)) change after, the consequent expression formula that obtains is Traffic 10>Load 2<﹠amp; ﹠amp; Though the consequent expression formula after this conversion is different on the form of expression with foregoing preceding paragraph expression formula, the two is of equal value in the computational process of expression formula.
After arriving the conversion of consequent expression formula through above-mentioned preceding paragraph expression formula, the threshold value management system will with above-mentioned consequent expression formula according to the conversion after sequential storage in storehouse, like this, the threshold value management system is after receiving the data report that network management system reports, just can immediately the operand that is stored in the storehouse be replaced with the data that report, and finish the calculating of expression formula fast.
For example: above-mentioned consequent expression formula Traffic 10>Load 2<﹠amp; ﹠amp; The order of storing in storehouse is as shown in table 1:
Table 1
C, calculate the value of described expression formula, according to the result of calculation judgement of reporting to the police.
The operand ratio that writes down in storehouse is easier to identification and also replaces with corresponding numerical value easily, therefore, when the threshold value management system receives the measurement data that network management system reports, the threshold value management system can replace with the data that network management system reports with the operand that is stored in the storehouse immediately, and the quick value that goes out this expression formula according to operand that writes down in the storehouse and operator order computation, thereby judging whether needs to open or close warning system, finishes the performance management of system.
Above-mentioned existing expression parsing method can be carried out analytical Calculation to the general threshold value management expression formula of user's input, and finally finishes the judgement of reporting to the police, and realizes the performance management of system.But, because said method is to discern the different operating number that comprises in this expression formula as the separator between the operand with operator in the transfer process of consequent expression formula in the check of the legitimacy of expression formula and forward direction expression formula, therefore, when said method is applied to operand itself when comprising the expression parsing of operator and computational process, will produce mistake.
For example, above-mentioned expression formula to be calculated is replaced with ((Traffic-Per-Hour>10) ﹠amp; ﹠amp; (Load<2)), wherein, Traffic-Per-Hour is the title of a measuring unit of network management system monitoring, just above-mentioned expression formula operand.If method according to prior art, above-mentioned expression formula is carried out legitimacy check or when above-mentioned expression formula being carried out the preceding paragraph expression formula to the conversion of consequent expression formula, the threshold value management system can with the bound symbol among the operand Traffic-Per-Hour-be identified as operator-, thereby can be wrong Traffic-Per-Hour is identified as three operand Traffic, Per and Hour subtracts each other.Obviously, it is incorrect resolving above-mentioned expression formula by this method.
Summary of the invention
In order to solve the problems of the technologies described above, the invention provides a kind of method of the judgement that realizes reporting to the police, can correctly resolve the expression formula that in operand, comprises operator, realize conversion and expression formula computational process that complete expression formula legitimacy check, preceding paragraph expression formula arrive consequent expression formula, finally finish the correct judgement of threshold value management system.
The method of the invention comprises the steps:
A, network management system receive the expression formula that comprises operand;
B, network management system detect the operand in the expression formula according to the operand tabulation that generates in advance, and the operand that occurs in the described expression formula is replaced with the replacement name of this operand successively, and wherein, described replacements do not comprise operator and corresponding one by one with operand;
C, network management system are carried out the conversion that legitimacy is checked and the preceding paragraph expression formula arrives consequent expression formula to replacing the expression formula that obtains through step B;
D, according to operand and the one-to-one relationship of replacing name, the replacement name that is comprised in the consequent expression formula that step B is obtained is replaced successively and is become original operand;
E, when the network management system reported data is reported, calculate through step D and replace the expression formula that obtains, judge whether that according to described result of calculation needs open or close warning system.
The process of the described generating run in advance of step B ordered series of numbers table is: all operations number that network management system is provided, according to how many rearrangements from big to small of number of characters in the operand, generating run ordered series of numbers table;
The process of the operand in the described detection expression formula is: according to the described operand tabulation of setting up through ordering, the operand in the sequence detection expression formula.
Step B is described to be replaced with: the order that occurs in described expression formula according to described operand generates corresponding with it replacement name.
Described step B further comprises: set up the operand replacement tabulation that operand and corresponding with it replacement name contrast, operand of every replacement is the replacement name of correspondence with it of described operand of record and generation in this operand tabulation just.
The described operand of step D is the operand and the corresponding with it contrast relationship of replacing between the name of replacing record in the tabulation at the operand that step B sets up with the one-to-one relationship of replacing name.
This shows, the method that realization of the present invention is reported to the police and adjudicated, before the legitimacy check of expression formula, the operand replacement that comprises operator in this expression formula is become the replacement name that the pre-set threshold management system can be discerned, effectively avoided in realizing the warning judging process, the operator that comprises in the operand has been identified as the expression parsing mistake that separator brought between the operand by mistake.
Use method of the present invention and can realize that the complete check of expression formula legitimacy, preceding paragraph expression formula arrive the conversion of consequent expression formula and the computational process of expression formula, correctly finish the warning judgement of threshold value management system, realize the performance management of system.
Description of drawings
Fig. 1 is an expression parsing flow chart of the present invention.
Embodiment
For the purpose, technical scheme and the advantage that make invention is clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further detail.
Occur in existing expression parsing process in order to solve, the problem that can't correctly resolve the expression formula that in operand, has operator, the invention provides a kind of method of the judgement that realizes reporting to the police, before the legitimacy check of expression formula, use threshold value management system replacement name that can discern, that do not comprise operator to replace the operand that comprises operator in this expression formula.Like this, in the check of follow-up legitimacy and forward direction expression formula in the transfer process of consequent expression formula, the threshold value management system is the operand through replacing in the recognition expression formula correctly, thereby finish the legitimacy check of expression formula and the conversion that the preceding paragraph expression formula arrives consequent expression formula, realize the correct calculation of expression formula and the judgement of reporting to the police, effectively avoided the problems of the prior art.
As shown in Figure 1, this method mainly may further comprise the steps:
Step 101: with all operations number that network management system provides, also be of how many from big to small rearrangements of the title of all measuring units that may occur in the expression formula according to number of characters, generating run ordered series of numbers table.
Need to prove all operations number average that in this step, sorts and equipment and the relevant parameter of measuring unit user-selected, that wish monitoring.When the user reports the network management system server with its selected equipment that will monitor, measuring unit and expression formula information, network management system will be created on all operations ordered series of numbers table that may occur in the expression formula of user's input automatically according to equipment and the measuring unit that the user selects, and is handed down to the threshold value management system.Therefore, the described ordering of this step is exactly the rearrangement that the operand that these network management systems provide is carried out.
The purpose of ordering is in order to prevent that with the operand in the expression formula promptly the measuring unit title replaces in the process of replacing name and mistake occurs.Illustrate the error situation that may occur below.
Suppose that predetermined operand comprises the title of following measuring unit: Transfer-Rate, Transfer-Rate-per-Port and Number-Of-Port.Therefrom as can be seen, measuring unit title Transfer-Rate is the part of Transfer-Rate-per-Port.Suppose that in addition expression formula to be calculated is (Transfer-Rate-per-Port+5)/Number-Of-Port.
Because above-mentioned measuring unit title is not through ordering, and Transfer-Rate is the part of Transfer-Rate-per-Port, therefore, operation is counted in its replacement process of replacing name in expression formula, at first this expression formula is comprised the replacement name that Transfer-Rate among the operand Transfer-Rate-per-Port replaces with Transfer-Rate probably, clearly, must cause the parse error of this expression formula like this.
Effective ways that address the above problem are exactly with the aforesaid operations number, and promptly the title of measuring unit is got up according to sequence arrangement from big to small according to its length.For example,, can rearrange in the following order, form a new operand tabulation, comprise for above-mentioned measuring unit title:
1.Transfer-Rate-per-Port
2.Number-Of-Port
3.Transfer-Rate
Like this, in using the replacement process of replacing name, at first the longest operand of coupling at the short operand of coupling, just can be avoided above-mentioned mistake then.For example, example in the reference, if in the replacement process of above-mentioned expression formula, use the operand tabulation of rearrangement to mate, just can match the longest operand Transfer-Rate-per-Port at first, and can at first not match Transfer-Rate, thereby can not produce above-mentioned replacement mistake.
Step 102: all operations number that occurs in the expression formula replaced to become successively replace name, described replacements is corresponding one by one with described operand.
In this step, according to the operand tabulation that step 101 is set up through ordering, the operand in the sequence detection expression formula, and all operations number that occurs in the expression formula replaced with preassigned replacements successively.
The described strategy below the preferential employing of choosing of replacing name: at first, replacing name can not be identical or similar with any measuring unit title, preferably certain special form; Secondly, replacing name should be discerned by the threshold value management system in resolving easily.
In a preferred embodiment of the invention, described uniform format of replacing name is set at xxNxx, wherein, N is illustrated in the order that operand occurs in this expression formula.In the described operand replacement process of present embodiment, corresponding each detected operand, the order that occurs in expression formula according to this operand generates corresponding with it replacement name.For example, first detected operand is replaced with xx1xx; And second detected operand replaced with xx2xx, by that analogy, finish until last operand replacement.
In order to realize subsequent operation, in the process that the aforesaid operations number is replaced, the threshold value management system also needs to set up an operand and replaces tabulation, is used to store the measuring unit title and the corresponding with it replacement name that are replaced.
For example, in the replacement process of expression formula (Transfer-Rate-per-Port+5)/Number-Of-Port, wherein, Transfer-Rate-per-Port and Number-Of-Port are respectively the title of two measuring units, just two of this expression formula operands.Since in these two operands, comprise operator-, according to existing expression parsing method, can't correctly resolve.Therefore, in this step, the operand tabulation that provides according to network management system, the operand Transfer-Rate-per-Port with first appearance replaces with xx1xx respectively, and the operand Number-Of-Port of second appearance is replaced with xx2xx.Like this, above-mentioned original expression (Transfer-Rate-per-Port+5)/Number-Of-Port just will be replaced by (xx1xx+5)/xx2xx.Simultaneously, in the process that the aforesaid operations number is replaced, also need to set up operand as shown in table 2 and replace tabulation.
Operand |
Replace name |
Transfer-Rate-per-Port |
xx1xx |
Number-Of-Port |
xx2xx |
Table 2
From the replacement process of above-mentioned steps 102 as can be seen, owing to do not comprise operator through replacing the operand that is generated in the expression formula, thereby be easy to be resolved by the threshold value management system.
Certainly, it will be appreciated by those skilled in the art that, an employed form that is not limited to xxNxx of replacing in this step, can also be any other true-to-shapes that satisfy above-mentioned preference policy, as long as can be discerned, and guarantee that the operand that is comprised in the expression formula is exactly passable with replacing name corresponding one by one by the threshold value management system.
In addition, replace tabulation for operand described in the foregoing description, this table record the one-to-one relationship between the replacement name of the operand that is replaced and generation, therefore, if operand and the one-to-one relationship of replacing between the name are predetermined, also just need not in replacement process, to have set up this operand substitution table.
Step 103: the expression formula after replacing is carried out the legitimacy check, and finish of the conversion of preceding paragraph expression formula to consequent expression formula.
In this step, described expression formula legitimacy check and preceding paragraph expression formula are all same as the prior art to the conversion method of consequent expression formula, here just have not been described in detail.
Example in the reference is carried out the legitimacy check to expression formula (the xx1xx+5)/xx2xx after replacing, and is xx1xx 5+xx2xx/ through the consequent expression formula that obtains after the conversion again.This consequent expression formula and the preceding expression formula equivalence of replacement.
Step 104: according to operand and the one-to-one relationship of replacing name, with the replacement name that consequent expression formula comprised after the conversion, order is replaced once more becomes original operand, and according to the order of consequent expression formula its operand and operator is stored in the storehouse.
Same with reference to top example, in this step, after the replacement name that comprises among the consequent expression formula xx1xx 5+xx2xx/ that obtains after the conversion replaced with original operand once more, the consequent expression formula that obtains was Transfer-Rate-per-Port 5+Number-Of-Port/.
The order that operand that this expression formula comprises and operator are stored in storehouse is as shown in table 3:
Transfer-Rate-per-Port |
5 |
+ |
Number-Of-Port |
/ |
Table 3
Step 105: calculate through step 104 when the network management system reported data is reported and replace the expression formula that obtains, warning system is opened or closed to judgement whether according to result of calculation then, realizes the performance management of system.
The described computational methods of this step are also identical with expression formula computational methods of the prior art.
From above-mentioned realization warning judging process as can be seen, method of the present invention can solve the problems of the prior art, realizes the correct judgement of reporting to the police.
In addition, those skilled in the art will appreciate that method of the present invention not only is applicable to the warning judging process of above-mentioned threshold value management system, can also be applied to any system, in any warning judging process that in operand, comprises operator.