This application claims the priority of the Chinese patent application No. 200910028102.3 filed on Sep. 1, 2009, which application is incorporated herein by reference.
This invention is a polling method of switch status which involved in the application monitoring system.
In an application monitoring system, there exists a timely monitoring measure which monitors the work status of all hosts, processes and flow switches distributed in various areas. So it is necessary to adopt a method which will query all switches' working status every few intervals as set. This method is called polling method of switch statues.
At present, there are three kinds of polling methods for monitoring switch statue. One is query application unified managed by monitoring system. Another is query application managed by every function modules of monitoring system. The last one is query application managed by the users of monitoring system after log in.
The first method is a unified scheduling by the monitoring system which should run in the application server. The shortage of this method is that it will take up the application server's memory and CPU resources.
The second method is running through the functional modules in the monitoring system. The shortage of this method is that the functional modules would repeatedly use the same application to query switch status. For example, the switch status of host module needs to query the process status firstly, while the switch status of process module also needs to query the process status firstly to determine status of the flow. So it will cause additional query operation workload of switch status which costs additional application system server resources.
The third method is to schedule by each user. During each enquiry interval, a great number of users will be rushed with a considerable number of query operations for switch status. If the user numbers of logging on the system is 100 or more, polling intervals of a specific period of time can be 100 times or more. The shortage of this method will cause additional workload of switch status query operations and also waste system resources.
For these three methods, query procedures of switch status finished being compiled need to be published in the application server which will occupy the system resources. What's more, when the query rule or process of switch status changes, the inquiry procedures need to be amended, and to be re-compiled and to be republished to the application server. However, in order to make the modified query procedure effective immediately, application server needs to be restarted which is not conducive to the maintenance and expansion of the system.
The main objective of this invention is to invent an advanced polling method of switch status based on the stored procedure scheduling which solves the problems of inefficiency, maintenance and extension difficulties the new invention develops a new network state polling method without occupying system resources in application servers and avoids the duplication of switch status query operation. When the query rules change, it can be effective immediately without re-release into the system and also it makes full use of database server resources.
Polling method of switch status based on the stored procedure scheduling is to create in the database the switches relevant switch interface table including object tables, the type of switch information table and the alarm table for storing information and switch state value, then create the stored procedure for various types of switches to obtain the corresponding switch status, filter out the data and determine the status of switches by the stored procedure and then input status value into switch status interface table. Finally, it needs to establish regular scheduling tasks for regular polling enquiry of each stored procedure.
The complete technical solution has three sections: create interface table related to switch status, access switch status and set the stored procedure for the state value and timer-triggered scheduling stored procedure regularly by the tasks:
Create Interface Table Related to Switch Status
Interface table for switch status is a set of tables in the database to establish the state of switches and storage-related data tables for storing switch status information, including switch object table, switch type table and alarm information table.
Create switch object table, switch type table and alert network information table in the database. And basic information and related alarm information can be indexed by switch ID field, and the switch type can be indexed by switch type/number to distinguish whether switch belongs to host process or process type.
Access Switch Status and Set the Stored Procedure of the State Value
The function is to be realized through a group of SQL statements programmed to access switch status and finish the storage function of its state value and through controlling the implementation of these SQL statements and then making judgment logically. These stored procedures can be stored in the database after being compiled. Users can specify the name of stored procedure and then once parameters are given, the procedure is to be implemented, compiling only needed while creating a stored procedures, after the creation, no need any more for the compiling and commonly used method to access to switch status is to go to run the enquiry process in the server through implementing each SQL statement, every execution of a SQL statement needs to be compiled every time, so the use of stored procedures can improve efficiently in the implementation of SQL statements. What's more, stored procedure can be re-used which can help to reduce the development workload.
For the present invention method, switch status' (including the process of switch status and the host switch state) access and value setting needs complex data operations such as data query, logical judgments, data records amendment and so on.
So it will improve the implementation speed of the process if those operations are encapsulated. The main stored procedure is to access to the process of stored procedure's switch status and host's switch status.
1) Access to the Stored Process of Switch Status
To obtain the status of switch type, the main steps are as below:
2) Access to Stored Procedure of the Host Switch Status
Use to obtain of the switch status of the host, main steps are as follow:
Create stored procedures to access to the process's switch status and the host's switch status in the database to access or set state values of the switch status of process and host. Main steps of the processing for these two stored procedures are: firstly, data indexing and data filtering treatment from the switch interface tables. After filtering out the data, making judgments logically to obtain the status of switch, and then update the status value to the state field in the relevant records from the switch object table.
Stored Procedure Timer-Triggered Scheduled by Regular Tasks
With this regular tasks implementing functions, create a time-set mission in the database, set the tasks that have already been set before in the stored procedures and also set the time interval between the tasks implementation and then the targeted tasks will be implemented as expected and then the switch status polling enquiry is available.
Manually edit the switch type in the switch status interface table. It is used to define types of switch type ID, switch type name, the switch CLASS_ID field means switch type ID. The value is 1 means the host type. Except ALARM_STATE field which is set by the stored procedure in the switch object table, the other fields are automatically reported by the application procedure, in the switch object table, field ALARM_STATE says the alarm state, when its value is 1, it means it has alarm. If it is 0, that means no alarm of the switch, WORK_STATE field in the switch object table says the work status of switch, and reported directly by the application procedure, when the value is 1, it means the switch is running, if 0, it indicates that the switch has ceased running. All fields are automatically reported by network target in alarm information tables except the field CANCEL_BY that means recovery and field CANCEL_TIME means recovery time. Switch ID number field NE_ID in the alarm information table is linked to the switch NE_ID in the switch object table, through field the switch number, it can indexed out that what switch ID is a alarm record belonging to.
The steps of obtaining the switch status stored procedure are as shown below.
Firstly, create database cursor named “CR” from the Switch object table, filter out the records that class_id field value is not equal to 1 and ENABLE field value equal to 1 and then name the record with “C1”, then begin the cycle of the data record. Initialize the variable “recnum” 0, and variable “v_neid” current cursor number that is “C1.NE_ID”, Stat alarm records of which field cancel_by value is −9, and at the same time field NE_ID value is the equal to “v_neid” value and then to give the total number of “recnum”, to judge whether “recnum” is zero, If zero, set NE_ID and “v_neid” the same switch alarm_state; if “recnum” is non-zero, set the switch alarm_state field value with 1. Finally to judge whether the current cursor record is the last, if not continue to cycle, if the current cursor record is the last record, then the terminate the cycle and submit modifications of all records.
The steps to obtain the host switch status stored procedure are as follows.
Create database cursor named “CR” from the Switch object table firstly. Filter out the records that class_id field value is not equal to 1 and ENABLE field value equal to 1 and then name the record with “C1”, then begin the cycle of the data record. Initialize the variable “recnum” 0, and variable “v_neid” current cursor number that is “C1.NE_ID”, Stat alarm records of which field cancel_by value is −9, and at the same time field NE_ID value is the equal to “v_neid” value and then to give the total number of “recnum”, to judge whether “recnum” is zero, If zero, set NE_ID and “v_neid” the same switch alarm state; if “recnum” is non-zero, set the switch alarm_state field value with 1. Finally to judge whether the current cursor record is the last, if not continue to cycle, if the current cursor record is the last record, then terminate the cycle and submit modifications of all records.
Advantages and Characteristics
The traditional polling method of switch status is running on application servers. The system resources of the application servers are occupied. When the number of switch and alarms are more than 3000 and also the number of user requests are more than 30, in a polling cycle, more than 30% of system resources are occupied by the application server, the newly invented method runs on the database server, which has made full use of the database server data processing efficiency and the ability to balance system resources, so for this new method, the application server's occupancy rate of system resources is 0, so that application servers system resources can be used more for other key tasks.
For traditional switch status polling method, each module or each user's session when scheduling easily lead to duplication of switch status query operation, while the newly invented method is to unify the various switch scheduling process stored in the database, in one enquiry cycle, only1 time implementation is done without any additional repetitive operations. What's more, when the switch status query rule or process changes, the polling process needs to be amended or re-compiled, and then to be published to the application server by traditional switch status polling method. In order to make amendments of switch status query procedure be effective immediately, the application server also needs to be restarted which will result in the interruptions of user applications. For this newly invented method when rules or processes change, only need to do modifications to the stored procedure or regularly schedule the implementation of tasks while being recompiled but no need to restart the server.
In a word, the application of this invention is very useful to improve the implementation efficiency of state polling and also beneficial for the maintenance and extension of the switch enquiry procedure.
The following is the detailed explanation of the invention illustrated with the attached figures and examples.
Refer to
Access to the Process of Stored Procedure's Switch Status
As shown in
Refer to
Access to Stored Procedure of the Host's Switch Status
As shown in
Relevant Interface Table of Switch Status
Create switch object table, switch type table and alarm information table in the database, the field is structured as follows
All fields can be automatically and directly reported or manually edited by using the application procedure except ALARM_STATE that is set by the stored procedure. ALARM_STATE field stands for alarm status of switch, it status is set by switch from the stored procedure. When its value is 1, means switch alarm, otherwise the switch does not alarm. WORK_STATE field stands for switch working status, the status will be automatically reported by the application procedure progress. When its value is 1, means switch is working, or else switch does not work. CLASS_ID field corresponds to class number in switch type table which can be indexed through this field to index out the types of switch.
Switch type table is manually edited and used to define the specific parameters of the type of information, such as the switch type ID, name and etc.
All fields are automatically reported by switch object except CANCEL_BY and CANCEL_TIME in the alarm information table. NE_ID corresponds to the switch NO. (NE_ID) in switch object table and it can be indexed through this to find out which switch that the alarming message is belonging to. CLASS_ID corresponds to the switch number in switch type table and it can be indexed through this to find out which switch that the alarming message is belonging to. Acquire switch status and set the state value of the stored procedure.
1. By Scheduling Regular Tasks of Stored Procedure
First of all, create a script from a regular schedule to carry out its mandate, its structure is as follows
X is automatically generated by the database system ID of the task, get_neobj_status ( ) get_host_status ( ) is the stored procedure which needs o be executed and is used to acquire and set switch status. next_date set the next execution time, that is, the success of this mission script compiler will set the time in the beginning of the implementation of automatic timing, this is at 10:33 on Nov. 8, 2008: 28, interval set the time interval, that is, how often a stored procedure will be executed, this is once every 10 seconds; later on, execute the above-mentioned script, the database system will automatically start from the Nov. 8, 2008 10:33:28, and periodically execute two stored processes which is used for acquiring and setting process and host switch statue—i.e., get_neobj_status ( ) and get_host_status ( ) every 10 seconds in order to achieve the polling of switch status.
The switch type form in the relevant switch status interface table is manually edited and used to define switch type ID, switch type name. And in the switch type table, CLASS_ID field means the type ID of the switch, when its value is 1, that means the host type. In the Switch object table ALARM_STATE fields in addition to setting up by the stored procedure, the remaining field is automatically reported by the application procedure, in the switch object table, ALARM_STATE field shows the alarm status. It is the state of switch from the stored procedure that decides the status value. When its value is 1, it shows the alarm. If it is 0, that means no alarm of the switch. Switch WORK_STATE field shows the working status of switch, and reported directly by the application procedure. When its value is 1, it means that switch is running. If 0, it indicates that the switch has ceased running.
In the Alarm message table, except for the fields recovery CANCEL_BY and recovery time CANCEL_TIME field, the remaining fields are automatically reported by switch target. And also field switch NE_ID in the alarm message table is related with switch (NE_ID) field in the switch object table. Through indexing the field switch ID, an alarm message can be indexed out, indicating which switch it belongs to
Number | Date | Country | Kind |
---|---|---|---|
200910028102.3 | Jan 2009 | CN | national |