A kind of method and apparatus of continuous monitoring VMWare event
Technical field
The present invention relates to network technology, specifically a kind of method and apparatus of continuous monitoring VMWare event.
Background technology
An important technology of cloud computing realizes being virtual, namely virtual to computational resource, storage resources and Internet resources.Computational resource is virtual, refers to that service that cloud computing provides is not fixing based on certain concrete physical server, but the service provided based on one or more server dynamically; Storage resources is virtual, refers to that memory space that cloud computing uses is based on arbitrary memory device; Internet resources are virtual, refer to that network configuration is dynamic, the service dynamic-configuration provided with cloud computing.
In Internet resources are virtual, the service that cloud computing provides all is completed by virtual machine (virtualmachine).The network insertion switch (network insertion position) of the necessary real-time tracking virtual machine of dynamic-configuration of Internet resources, and send out network configuration up and down at network insertion switch, such as Bandwidth guaranteed, safety restriction etc., guarantee that the service that cloud computing provides to outside can run continuously, be not interrupted.
As shown in Figure 1, when fictitious host computer 2 moves to physical server 2 by physical server 1, the network configuration of its correspondence also must move to physical switches 2 from physical switches 1.For the network environment not supporting IEEE802.1qbg standard, realize migration situation and increase, the deletion situation etc. of the necessary real-time tracking virtual machine of above-mentioned network configuration migration, this just requires that application program must the dependent event of continuous continual reception virtual network, thus determines whether virtual machine creates, deletes or migration etc.For VMWare virtual network, the VMWare event that vCenter/ESX sends will be monitored exactly, wherein, VMWare event specifically refers to the software that the vCenter(VMWare company of VMWare company manages concentratedly virtual machine product), ESX(VMWare company is responsible for virtualized for physical server software systems, be responsible for the Realization of Simulation virtual switch and virtual machine) event that product produces, comprise user's logins/logoffs event, virtual machine creating/amendment/deletion event, virtual switch establishment/amendment/deletion event etc.; The principle of VMWare action listener as shown in Figure 2.
In fig. 2, NMS(NetworkManagementSystem, network management system software) interface that calls VMWare corporate external and provide sets up TCP/IP with vCenter/ESX and is connected, when there being new VMWare event to produce, vCenter/ESX is connected by TCP/IP, VMWare event is sent to NMS, in each VMWare event, has field to represent the variable that event type and event comprise.The above-mentioned TCP/IP connection provided due to VMWare is actually a https(HypertextTransferProtocoloverSecureSocketLayer) connect.The mechanism that https processes at present is, if connect the long period do not have packet sending and receiving, will automatically disconnect long-range connection.Disconnect once https connects, VMWare event will be caused to monitor, certainly, if virtual machine creates during this period, delete or move, NMS be perception less than, thus network configuration also cannot synchronously be performed.
For any application, need to avoid the TCP/IP between self and VMWarevCenter/ESX to connect because the situation of a variety of causes interruption as far as possible; Meanwhile, once there is abnormal interruption, application program must be able to perceive in time, and takes measures to make up.Application program is except monitoring except VMWare event by setting up the normal mode connected of TCP/IP connection, also can obtain VMWare event by active poll vCenter/ESX, and polling interval enough little (such as 1 minute), when TCP/IP connection is interrupted because of a variety of causes, application program (receives only and processes the program of VMWare event, such as network management system software) TCP/IP disconnecting can be perceived by above-mentioned polling procedure, and re-establish a TCP/IP connection monitoring VMWare event.
Said process under normal circumstances can real-time listening VMWare event; When network occurs abnormal, can sensing network anomalous event, and re-establish VMWare action listener passage, guarantee that all VMWare events all can not be lost.
But the defect of the program is, application program polling interval is too low, the processing load of application program and vCenter/ESX being strengthened, when the virtual network of vCenter/ESX composition is very large, being in very busy state by causing application program and vCenter/ESX.
Even if application program polling interval is enough little, when network occurs abnormal, application program cannot perception VMWare event.Application program for once poll ability perception later, likely causes the time delay of a polling cycle.
Summary of the invention
The object of the present invention is to provide a kind of method and apparatus of continuous monitoring VMWare event, by the present invention, the continuous real-time listening to VMWare event can be realized, reduce the poll burden of application program and vCenter.
Accompanying drawing explanation
Figure 1 shows that virtual machine (vm) migration schematic diagram;
Figure 2 shows that prior art monitors VMWare event schematic diagram.
Figure 3 shows that the present invention monitors the method flow schematic diagram of VMWare event continuously;
The apparatus structure schematic diagram of continuous monitoring VMWare event provided by the invention shown in shown in Fig. 4.
Embodiment
The present invention utilizes VMWare log-in events to realize the continuous monitoring of VMWare event.When logging in vCenter/ESX, vCenter/ESX can produce user's log-in events.If this event can frequently occur, by monitoring users log-in events, there is overtime interrupt to avoid the TCP/IP monitoring VMWare event to connect.
In the present invention, application program and vCenter/ESX set up TCP/IP and are connected monitoring VMWare event, and record the time that TCP/IP connection receives VMWare event for the last time.Application program connects the cycle very first time (such as, 20 seconds) of digestion period according to being less than HTTPs, log in vCenter/ESX, with activated user log-in events.Application program, according to the second time cycle, calculates TCP/IP and connects the time difference receiving VMWare event time and current time for the last time, if the time difference is less than or equal to the cycle very first time, then TCP/IP connects normal; If the time difference is greater than the cycle very first time, then think that TCP/IP connects abnormal.Application program interrupting TCP/IP connects, and sets up new TCP/IP with vCenter/ESX and be connected to monitor VMWare event.Set up TCP/IP connection procedure to be realized by the third Protocol stack (as gSOAP protocol stack), by the return value of protocol stack, application program determines that whether TCP/IP connection establishment is successful.If the failure of TCP/IP connection establishment, in next cycle, continue trial set up TCP/IP connection; If the success of TCP/IP connection establishment, connect all VMWare events in the time and current time receiving VMWare event for the last time from the TCP/IP of vCenter/ESX reading record, avoid VMWare event to lose.
The beneficial effect of the present embodiment is, produces user's log-in events, and user's log-in events is sent to application program by TCP/IP connection by periodically logging in vCenter/ESX.The user's log-in events sent to application program due to vCenter/ESX is relatively more frequent, and the TCP/IP therefore monitoring VMWare event connects and there will not be https overtime interrupt.
Beneficial effect of the present invention is also, application program place server belonging network breaks down and TCP/IP disconnecting, this situation of the application can at once perception, and carry out repair process namely: reset TCP/IP and connect to monitor VMWare event, if arrange successfully, read TCP/IP connection from vCenter/ESX and receive the time of VMWare event for the last time to all VMWare events in current time frame, avoid VMWare event to lose.As shown in Figure 4, present invention also offers a kind of VMWare action listener device, this device comprises:
Monitoring unit 401, sets up TCP/IP by application program with vCenter/ESX and is connected, and monitors VMWare event, records described TCP/IP and connects the time receiving VMWare event for the last time.
Computing unit 402, by application program, according to the cycle very first time being less than HTTPs connection digestion period, periodically logs in vCenter/ESX, activated user log-in events; According to the second time cycle being less than the cycle very first time, periodically calculate described TCP/IP connection and receive the time of VMWare event and the time difference of current time for the last time.
By application program, control unit 402, determines that the described time difference is less than the described cycle very first time, then described TCP/IP connects normal, connects without the need to disconnecting described TCP/IP; Determine that the described time difference is greater than the described cycle very first time by application program, then interrupt described TCP/IP and connect.
Control unit 403, sets up new TCP/IP by application program and described vCenter/ESX and is connected and monitors VMWare event; Determine described new TCP/IP successful connection by application program, read described TCP/IP from described vCenter/ESX and connect the time all VMWare events in current time receiving VMWare event for the last time.
With the example under certain embody rule scene, implementation process of the present invention is described, suppose that the polling cycle of the task A of application program launching is 20 seconds, it is 2012/2/2710:49:00 that TCP/IP connects the time receiving VMWare event for the last time, current time is 2012/2/2710:49:15, time difference equals 15 seconds and is less than 20 seconds, and therefore application program determines that TCP/IP connects normally; After task B runs a period of time, current time is 2012/2/2710:49:22 second, be 22 seconds because current time to be connected the time difference of the up-to-date time receiving VMWare event with TCP/IP and to be greater than 20 seconds, application program interrupting TCP/IP connects and sets up new TCP/IP and connects, then [2012/2/2710:49:00 is read from vCenter/ESX, 2012/2/2710:49:22] period all VMWare events, prevent VMWare event from losing.
The above, be only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention, and all any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.