Abstract:
A mechanism is provided for detecting an operating state of a component. A CLI command is transmitted via a command line interface to the component. An output character string is received responsive to the CLI command. A set of significant character substrings is dissected from the output character string, where each significant character substring comprises a label character string indicating a meaning of the output character string and a data character string expressing data of the output character string. A regular expression corresponding to each significant character substring is set thereby forming a set of regular expressions. A difference is calculated between each of the set regular expressions and each significant character substring corresponding to the regular expression as a character string distance. Each calculated character string distance is compared to a corresponding predetermined threshold and the operating state of the component is output based on results of the comparison.

Description:
BACKGROUND 
     The present invention relates to detection of a component operating state by a computer in a computer system, and more specifically to detecting an operating state of a component that used a command line interface command (referred to below as “CLI command”) by the computer. 
     As computer systems increase in size, a plurality of general modules and devices are combined to form systems. In order to evaluate the operating status of the modules and devices in this type of system, a program that invokes a CLI command provided in the modules and devices and analyzes the output character string given by the CLI command (hereinafter referred to as “output analysis program”) can be created and used. 
     In order to properly create the output analysis program, the output format for the CLI command must be known, but normally knowing the detailed and rigorous output format for the CLI command is extremely difficult. Therefore, programming is performed that matches the output format for the actual CLI command at a certain time. Therefore, if the output format of the CLI command has changed, there is a possibility that the output analysis program may not properly operate. For example, the output analysis program might suddenly stop operating because the output format of the CLI command changed during testing (the computer system). 
     The output analysis program is made to monitor the system status, so if the output analysis program stops operating, there will be a major impact on system testing. This is because there may be a need to confirm that the system operates properly on a test before executing a test of the system for example, but if the output analysis program is not operating, this confirmation cannot be made. 
     SUMMARY 
     An object of the present invention is to resolve or reduce problems with the use of a conventional output analysis program, and to enable detection and confirmation of the operating status of a system (components, modules, devices, and the like) for testing, by analyzing and output character string for the CLI command even if the output format for the CLI command has changed. 
     In one illustrative embodiment, a method, in a computing system, is provided for detecting an operating state of a component in the computer system comprising a plurality of components. The illustrative embodiment transmits a command line interface (CLI) command to the component. The illustrative embodiment receives an output character string from the component responsive to the CLI command. The illustrative embodiment dissects a set of significant section character substrings from the output character string, where each significant character substring comprises a label character string indicating a meaning of the output character string and a data character string expressing data of the output character string. The illustrative embodiment sets a regular expression corresponding to each significant character substring of the set of significant character substrings thereby forming a set of regular expressions. The illustrative embodiment calculates the difference between each of the set regular expressions and each significant character substring corresponding to the regular expression as a character string distance. The illustrative embodiment compares each calculated character string distance to a corresponding predetermined threshold. The illustrative embodiment outputs the operating state of the component based on results of the comparison. 
     With the method of the present invention, the output character string for a CLI command from the component is dissected into significant character substrings, each of the significant character substrings are compared to corresponding regular expressions, and the operating state of the component is detected, and therefore even if the output format for the CLI command changes, the operating state of the component can be detected and output. 
     In other illustrative embodiments, a computer program product comprising a computer useable or readable medium having a computer readable program is provided. The computer readable program, when executed on a computing device, causes the computing device to perform various ones of, and combinations of, the operations outlined above with regard to the method illustrative embodiment. 
     In yet another illustrative embodiment, a system/apparatus is provided. The system/apparatus may comprise one or more processors and a memory coupled to the one or more processors. The memory may comprise instructions which, when executed by the one or more processors, cause the one or more processors to perform various ones of, and combinations of, the operations outlined above with regard to the method illustrative embodiment. 
     These and other features and advantages of the present invention will be described in, or will become apparent to those of ordinary skill in the art in view of, the following detailed description of the example embodiments of the present invention. 
    
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS 
         FIG. 1  is a block diagram illustrating an example of the configuration of a computer system where the method of the present invention is implemented; 
         FIG. 2  is a diagram illustrating an example of the configuration of a computer that executes the method of the present invention; 
         FIG. 3  is a diagram depicting an embodiment of an output character string for a CLI command; 
         FIG. 4  is a diagram of an embodiment where the output character string of  FIG. 3  is dissected into significant character substrings; 
         FIG. 5  is a diagram depicting the flow of an embodiment of the method of the present invention; and 
         FIG. 6  is a diagram depicting the flow of an embodiment of the method of the present invention. 
     
    
    
     DETAILED DESCRIPTION 
     An embodiment of the present invention is described while referring to the drawings.  FIG. 1  is a diagram illustrating an example of the configuration of a computer system where the method of the present invention is implemented. A system  100  includes a host (server)  10 , a PC (terminal)  20 , and a network drive  30  that are mutually and communicably connected through an Ethernet (registered trademark) switch (LAN switch)  40 . The network drive  30  includes recording means such as an HDD, a tape drive, or the like. These devices can be one of the “components” used in the present invention, or a module or device associated with each device can also be one of the “components.” In  FIG. 1 , only one each of the host (server)  10 , PC (terminal)  20 , and network drive  30  are depicted, but this is only an example, and naturally an arbitrary number of two or more of each device can be included. 
     The method of the present invention is implemented by the PC  20  accessing and executing software downloaded from the server  10  or network drive  30 , or software stored in recording means (HDD and the like) included in the PC itself for example. Note that naturally the method of the present invention can be implemented by a standalone PC not connected to a network. 
       FIG. 2  is a block diagram illustrating an example of the configuration of a computer executing the method of the present invention.  FIG. 2  illustrates an example of the configuration of the PC  20  of  FIG. 1 . The PC  20  includes an arithmetic processing device (CPU)  200 , recording means  210 , and various interfaces (I/F)  220  that are mutually connected through a bus  230 . Various I/F  220  is used as a general term including input I/F, output I/F, external memory I/F, external communication I/F, and the like, and each I/F is connected to corresponding inputting means  240  such as a keyboard, mouse, and the like, displaying means  250  such as a CRT, LCD, and the like, and external recording means  260  such as a semiconductor memory, HDD, and the like connected by USB. The recording means  210  can include a semiconductor memory such as RAM and ROM, or an HDD, or the like. 
     Herein, each of the terms used in the method of the present invention are described. In the following description, an example is described using df command used in a Linux (registered trademark) system as a CLI command. The df command is a command for outputting information of a file system (remaining disk space and the like) mounted by the system. Note that the CLI commands that can be used in the present invention are not limited to df commands, and can be any other CLI command. 
     (A) Output Character String 
       FIG. 3  depicts an embodiment of an output character string for the df command. “Filesystem” in the first column indicates the file system (device) name. “1K-blocks” in the second column indicates the maximum size (capacity). “Used” in the third column indicates the size that is used. “Available” in the fourth column indicates the available size (remaining capacity). “Use %” in the fifth column indicates the percentage (%) of the size that is used. “Mounted on” in the sixth column indicates the mount point of the device. In each column, actual data is shown from the second row. For example, “Use %” in the fifth column indicates that 91% is used in device: /dev/sda2, 0% is used in device: tmpfs, and 30% is used in device: /dev/gpfs0. 
     (B) Significant Character Substring 
     An embodiment where the output character string for the df command in  FIG. 3  is dissected into significant character substrings is depicted in  FIG. 4 . In  FIG. 4 , each section that is enclosed with [ . . . ] corresponds to a significant character substring. The significant character substring indicates a character substring with meaning in the output character string. The character substring with meaning can be classified as follows for example:
         (i) Character string expressing the meaning of the data (“Filesystem”, “Used”, and the like)   (ii) Character string expressing the data itself (“/dev/sda2”, “115357916”, and the like)   (iii) Character string for making the output easier to view (blank section, delimiter, line break, and the like)
 
Herein, for the (i) character string expressing the meaning of the data, the same output can always be expected to appear regardless of the environment and timing for executing a command, so as a matter of convenience, the character string can be referred to as a label character string. Furthermore, for the (ii) character string expressing the data itself and the (iii) character string for making the output easier to view, the output can be altered based on the environment and timing for executing a command, so as a matter of convenience, these can be referred to as data character strings.
       

     (C) Regular Expression 
     Concerning each significant character substring, “the type of data that can be output” can be inferred by actually executing the CLI command and looking at that output. Based on this information, a regular expression that matches the actual output can be defined for each significant character substring of the CLI command. For example, consider the “Used %” column from the output of the aforementioned df command. Without knowing a detailed definition of the df command output, from the character string “Use %” and the like, it can be inferred that the column indicates the amount used in the corresponding file system, by percentage. Therefore, the value of the “Use %” column can be presumed to be “an integer percentage value within a range of 0% to 100%.” 
     Furthermore, by executing the df command a plurality of times, the fact that the end of the value always ends in % can also be confirmed. Therefore, the expected value is “(0|[0-9] [0-9]|100)%” when a regular expression generally used by a Unix (registered trademark) system appears in this column, for example. Herein, 0 and 100 indicate the range of 0 to 100%, and [0-9] and [0-9] indicate an integer where the first digit is from 0 to 9, and similarly where the second digit is from 0 to 9. 
     Thereby, all significant character substrings can be defined as a regular expression that matches a substring that corresponds to the actual output as long as the format of the command output does not change. Herein, it should be noted that in the present invention, the specification of the output format is presumably unknown, so the regular expression is uniquely undetermined. For example, in the case of the aforementioned “Use %” column, output of a real number value such as “99.5%” is not permitted, but may actually be possible. Therefore, in the case that a regular expression is determined, preferably the regular expression should not match with “data in need of warning or suspension.” 
     (D) Character String Distance 
     The following words are defined first in order to calculate the character string distance. An actual output of a certain CLI command C at a certain point is O(C), and the list of the significant character substring in O(C) is O=(o 1 , o 2 , . . . , oN). Expected output P is defined as an output that can be expected when the CLI command C is executed (invoked). Note that P is a ternary containing (E, A, B) as defined below:
 
 E =( e 1, e 2, . . . , eN ):  ei  is a regular expression for the  i th significant character substring.
 
 A={i|i th significant character substring is a label character string}
 
 B={i|i th significant character substring is a data character string}
 
# A+B=E  and  A∩B =empty set so  B  is not needed, but as a matter of convenience for the description, both  A  and  B  are introduced.
 
For example, when taking a significant character substring (91%) located in the 20th row of “Use %” of the significant character substring of the df command illustrated in  FIG. 4  as an example, the o 20  and e 20  from O=(o 1 , o 2 , . . . , oN) and E=(e 1 , e 2 , . . . eN) can be expressed as:
 
 o 20=91%
 
 e 20=(0|[0-9][0-9]|100)%
 
A significant character substring (oi) in a different order (i) can be expressed similarly,
 
     Next, D (ei, oi), the character string distance of ei and oi, where i is 1≦i≦N, is defined as a function with the following properties.
         (i) D (ei, oi)=0 when the actual output oi matches the defined regular expression ei.   (ii) D (ei, oi) is larger as the actual output oi is more different from the defined regular expression.   (iii) D (ei, oi) is a real number of 0 or higher
 
For example, the character string distance D (ei, oi can be calculated by using Edit Distance. For example, using the case where o 20 =91% and e 20 =(0|[0-9] [0-9]|100)% in the aforementioned “Use %” column as an example, if the actual output does not have “%”, or if the number is 3 digit numeral other than 100 such as “105%”, then D(e 20 , o 20 )=1, but if both of these happen together (no % and a 3 digit number of over 100), then D(e 20 , o 20 )=2; and thus the character string distance D(ei, oi) is calculated such that the numerical value becomes larger as these points of difference increase.
       

     Next, while referring to  FIG. 5  and  FIG. 6 , the flow is described for an embodiment of the method of the present invention that uses the aforementioned (A) output character string, (B) significant character substring, (C) regular expression, and (D) character string distance. Note that the flow of the method in both diagrams is performed by the computer (PC  20 ) illustrated in  FIG. 2 , by executing corresponding software. 
     First,  FIG. 5  is referenced. In step S 11 , the computer transmits the CLI command to the component. The CLI command is the aforementioned df command or the like for example. In step S 12 , the computer receives an output character string for the CLI command from the component. The output character string is an output character string or the like for the aforementioned df command depicted in  FIG. 3  for example. In step S 13 , the received output character string is dissected into significant character substrings that include a label character string indicating the meaning of the data, and a data character string that expresses the data itself. The significant character substring can further include a character string for an easy read of data string as described above while referring to  FIG. 4 . 
     In step S 14 , a regular expression is set corresponding to each acquired significant character substring. The contents of the regular expression are as described above, and the defined regular expressions can be stored in recording means (memory) in advance for each significant character substring, and these can be accessed and used. In step S 15 , the difference between each set regular expression and the corresponding significant character substring is calculated as the character string distance. The calculation of the character string distance is as described for the aforementioned (D) character string distance D(ei, oi), and each significant character substring is calculated. 
     In step S 16 , the calculated character string distance is compared with a corresponding predetermined threshold value. The predetermined threshold is set individually for the corresponding significant character substring (label character string). The three following thresholds values are defined as thresholds for example:
         T 1 : Loose threshold   T 2 : Strict threshold (for example, T 2 =T 1 *2)   T 3 : Overall threshold (for example, T 3 =T 1 *N, N is the total number of significant character substrings)
 
These threshold values are statically defined based on the characteristics of the system (components). The comparison between the three threshold values T 1  through T 3  and the character string distance D (ei, oi) is described below while referring to  FIG. 6 .
       

     In step S 17  the operating state of the component is output based on the comparison results of S 16 . Specifically, based on the results of the comparison, at least one of, the results are left in a log of the recording device, or a warning is displayed by the display device, (is performed). In step S 18 , a determination is made as to whether or not all of the comparisons between the character string distance and the corresponding threshold value are completed. If the determination result is No, the process returns to step S 16 , and then steps S 16  and S 17  are repeated. If the determination result is Yes, the series of processes terminates. The user can later confirm the operating status of the component by looking at the information (results) recorded in the log. Furthermore the user can immediately halt operation of the component when a warning is displayed by the display device. 
     Next, comparison of the aforementioned three threshold values T 1  through T 3  and the character string distance D(ei, oi) is described while referring to  FIG. 6 . In step S 20 , the character string distance D(ei, oi) is initialized. In other words, i is set to 1 and S is set to 0. The meaning of S is described below. In step S 21 , a determination is made as to if i≦N. If the result is Yes, in step S 22 , a determination is made as to if D(ei, oi)*W(i)≧T 2 . Here, T 2  is the strict threshold value described above. 
     On the other hand, W(i) represent a weighting coefficient for the i th  significant character substring. W(i) expresses the importance of the problem with regards to ei and oi being different. For example, for the i th  significant character substring, if a wanting is desired if the previously prepared regular expressions ei and oi are even slightly different, W(i) will be set to a larger value. Conversely, if there is no big problem even though the regular expression ei differs somewhat from output oi W(i) is set to a small value. 
     If the determination of step S 22  is Yes, either the result is logged in step S 27 , and/or a warning is displayed. If the result in step S 22  is No, in step S 23 , a determination is made as to if D(ei, oi)*W(i)≧T 1 . Here, T 1  is the loose threshold value described above. If the determination is Yes, either the result is logged in step S 24 , and/or a warning is displayed. If the result in step S 23  is No, in step S 25 , S is set to S+D (ei, oi)*W(i), i=i+1, the process returns to step S 21 , and the series of steps is repeated. Herein, S is the sum of D(ei, oi)*W(i), or in other words, Σ(D(ei, oi)*W(i), i=1 to N). 
     If the result in step S 21  is No, in step S 26 , a determination is made as to if S≧T 3 . In other words, the sum S of D(ei, oi)*W(i), (ΣD(ei, oi), i=1 to N) is compared to the aforementioned overall threshold value. If the determination is Yes, either the result is logged in step S 27 , and/or a warning is displayed. If the result in step S 26  is No, the series of processors is terminated. 
     The series flow (steps) depicted in  FIG. 6  can be comprehensively expressed as described below.
         (a) When CLI command C is executed, the output string is dissected into significant character substrings O(C)={o 1 , . . . , oN}.   (b) The product of the character string distance D(ei, oi) and the weighting W(i) is determined as D(ei, oi)*W(i) for each i, using the expected output P prepared beforehand.   (c) The product D(ei, oi)*W(i) and the threshold values T 1 , T 2  are compared.   (d) If the product D(ei, oi)*W(i) is T 2  or larger, a log output or warning display is performed, and the process is terminated.   (e) If the product D(ei, oi)*W(i) is T 1  or larger, a tog output or warning display is performed, but component operation is continued.   (f) Furthermore, when considering the sum of the products D(ei, oi)*W(i) for all outputs oi, the value of D(ei, oi)*W(i) total S (ΣD(ei, oi)*W(i), i=1 to N) is compared to T 3  as a last step, and if the sum is T 3  or higher, a log output or warning display is performed and the process is terminated.       

     The method of the present invention described in detail by the aforementioned embodiment enables detection and confirmation of the operating status of a system (components, modules, devices, and the like) for testing, by analyzing an output character string for the CLI command, even if the output format for the CLI command has changed, and this operation can make an appropriate response such as terminating the operation, or the like. 
     Embodiments of the present invention were described while referring to the drawings. However, the present invention is not restricted to these embodiments. The present invention can be embodied by various improvements, corrections, and variations, based on the knowledge of one skilled in the art, within a scope that does not violate the gist thereof.