CN106453686A - Connecting method and connecting device for JMX (Java Management Extensions) client - Google Patents

Connecting method and connecting device for JMX (Java Management Extensions) client Download PDF

Info

Publication number
CN106453686A
CN106453686A CN201611027195.4A CN201611027195A CN106453686A CN 106453686 A CN106453686 A CN 106453686A CN 201611027195 A CN201611027195 A CN 201611027195A CN 106453686 A CN106453686 A CN 106453686A
Authority
CN
China
Prior art keywords
jmx
host
return value
client
value
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.)
Granted
Application number
CN201611027195.4A
Other languages
Chinese (zh)
Other versions
CN106453686B (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.)
CHANJET INFORMATION TECHNOLOGY Co Ltd
Original Assignee
CHANJET 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 CHANJET INFORMATION TECHNOLOGY Co Ltd filed Critical CHANJET INFORMATION TECHNOLOGY Co Ltd
Priority to CN201611027195.4A priority Critical patent/CN106453686B/en
Publication of CN106453686A publication Critical patent/CN106453686A/en
Application granted granted Critical
Publication of CN106453686B publication Critical patent/CN106453686B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • H04L61/2567NAT traversal for reachability, e.g. inquiring the address of a correspondent behind a NAT server
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2517Translation of Internet protocol [IP] addresses using port numbers

Abstract

The invention relates to a connecting method and a connecting device for a JMX (Java Management Extensions) client. The connecting method for the JMX client comprises the steps of: according to the received modification instruction, modifying a return value generating mechanism of a connectorServer in a JMX server to generate a modified return value; and returning network node information and port information of a host machine to the JMX client by using the modified return value to establish a connection with the JMX client. By adopting the technical solution, JMX monitoring of cross-network connection is realized in a java instrumentation mode, so that the code is simple and the logic is clear.

Description

The method of attachment of JMX client and attachment means
Technical field
The present invention relates to virtual machine monitoring technical field, in particular to a kind of method of attachment and of JMX client Plant the attachment means of JMX client.
Background technology
JMX (Java Management Extensions) is a kind of for the implantation management such as application program, equipment and system The framework of function, the architecture of application program defined in the Java programming language and network management and monitoring, design mould Formula, application programming interfaces and service, are usually used JMX and come the running status of monitoring system or some aspects of management system, Such as empty caching, reload configuration file etc..But in prior art, JMX does not support the process monitoring of across a network, and this is Some applications are made troubles, such as just directly cannot carry out JMX monitoring to empty machine on X3 platform.
Therefore, the JMX monitoring how realizing across a network is connected to become technical problem urgently to be resolved hurrily.
Content of the invention
It is contemplated that at least solving one of technical problem present in above-mentioned prior art or correlation technique.
For this reason, it is an object of the present invention to proposing the method for attachment of JMX client.
Further object is that providing a kind of attachment means of JMX client.
For achieving the above object, embodiment according to the first aspect of the invention is it is proposed that a kind of connection of JMX client Method, including:According to the modification instruction receiving, the machine of the generation return value of connectorServer in modification JMX server System, generates amended return value;Using amended return value, return the network node information of host to JMX client And port information, set up with JMX client and be connected.
The method of attachment of JMX client according to an embodiment of the invention, by changing in JMX service end The mechanism of the generation return value of connectorServer (a kind of adapter service, for connecting monitoring client and monitored end) is come Break through network to limit, JMX client can be made to set up with the virtual machine of JMX service end and be connected.I.e. in modification JMX server Before the generation return value of connectorServer, client can only pass through network node and port and the virtual machine of host Communicated, but the connectorServer address that JMX server end returns be the lan address that client cannot access, Accordingly, it would be desirable to change the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer Enough return the IP (network node) and PORT (port) of host, using this amended return value, JMX server and JMX visitor Family end establishes connection, in order to realize carrying out the virtual machine process monitoring of across a network using JMX client.
In addition, the method for attachment of JMX client according to the above embodiment of the present invention, can also have the skill added as follows Art feature:
The method of attachment of the JMX client of embodiment is it is preferable that according to repairing of receiving according to a first aspect of the present invention Change instruction, the mechanism of the generations return value of connectorServer in modification JMX server, the amended return value of generation it Before, also include:According to the setting instruction receiving, change DEA code, add host to the network port mapping of virtual machine.
In this embodiment, in order to the serve port from outside access virtual machine, first have to change DEA code, add Plus outer net (host) arrives the port mapping of Intranet (virtual machine).For example, Intranet IP of a virtual machine is 10.254.9.174, Host IP is 172.18.4.240.After adding port mapping, 34823 ports of host can be passed through in 9999 ports of virtual machine Access;34824 ports that host is passed through in 1099 ports of virtual machine access.If with jconsole connection server, then Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, by network port Mapping implementation Virtual machine is connected with the first step of host.
The method of attachment of the JMX client of embodiment is it is preferable that according to the modification receiving according to a first aspect of the present invention Instruction, in modification JMX server, the mechanism of the generation return value of connectorServer, generates amended return value, specifically Including:Instrumentation based on java (a kind of independent of the Agent outside application program, to monitor and to assist Run application program on a virtual machine) mechanism, the class file of virtual machine JMX server checks for agreement literary composition Part;If agreement file exists, extract host value and port value from agreement file, host value and port value write are used for giving birth to Become the write function of connectorServer return value, in order to generate amended return value;If agreement file does not exist, Generate described amended return value using the original value of write function;Wherein, agreement file is starting J2EE by calculate node Create before server processes, record network node information and the port information of host.
In this embodiment, java Instrumentation can monitor and assist to operate in the application program on JVM, This monitoring and assistance include but is not limited to obtain JVM run time behaviour, and substitutions and modifications class defines etc., The maximum effect of Instrumentation is exactly dynamic change and the operation of class definition.Return connectorServer information Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to change returning of jmx server Return value it is necessary to modify to the code of write (), allow it return host and port of host to client.By this Amended return value can be set up with service end to be connected and carry out JMX monitoring.
The method of attachment of the JMX client of embodiment is it is preferable that JMX client includes according to a first aspect of the present invention: Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client and more than above-mentioned Jconsole or JvisualVM and Jboss, it is achieved thereby that Jconsole, JvisualVM and Jboss client carries out across a network process monitoring by JMX, meets The diversified demand of client.
According to a first aspect of the present invention the JMX client of embodiment method of attachment it is preferable that virtual machine and host with The mode of network address translation connects.
In this embodiment, virtual machine and host are attached in the way of Network Address Translation, are convenient for network Management, is capable of the access to Intranet equipment (as server) for the external network, concurrently facilitates saving IP address resource.
Embodiment according to a second aspect of the present invention it is also proposed that a kind of attachment means of JMX client, for monitoring void Plan machine, including:Modification unit, according to the modification instruction receiving, the generation of connectorServer in modification JMX server The mechanism of return value, generates amended return value;Connection unit, using amended return value, returns to place to JMX client The network node information of main frame and port information, are set up with JMX client and are connected.
The attachment means of JMX client according to an embodiment of the invention, by changing in JMX service end The mechanism of the generation return value of connectorServer (a kind of adapter service, for connecting monitoring client and monitored end) is come Break through network to limit, JMX client can be made to set up with the virtual machine of JMX service end and be connected.I.e. in modification JMX server Before the generation return value of connectorServer, client can only pass through network node and port and the virtual machine of host Communicated, but the connectorServer address that JMX server end returns be the lan address that client cannot access, Accordingly, it would be desirable to change the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer Enough return the IP (network node) and PORT (port) of host, using this amended return value, JMX server and JMX visitor Family end establishes connection, in order to realize carrying out the virtual machine process monitoring of across a network using JMX client.
In addition, the attachment means of JMX client according to the above embodiment of the present invention, can also have the skill added as follows Art feature:
The attachment means of the JMX client of embodiment, also include according to a second aspect of the present invention:Map unit, according to connecing The setting instruction receiving, changes DEA code, adds host to the network port mapping of described virtual machine.
In this embodiment, in order to the serve port from outside access virtual machine, first have to change DEA code, add Plus outer net (host) arrives the port mapping of Intranet (virtual machine).For example, Intranet IP of a virtual machine is 10.254.9.174, Host IP is 172.18.4.240.After adding port mapping, 34823 ports of host can be passed through in 9999 ports of virtual machine Access;34824 ports that host is passed through in 1099 ports of virtual machine access.If with jconsole connection server, then Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, by network port Mapping implementation Virtual machine is connected with the first step of host.
The attachment means of the JMX client of embodiment, it is preferable that modification unit, are specifically used according to a second aspect of the present invention In:Based on the instrumentation mechanism of java, check for arranging in the class file of virtual machine JMX server File;If agreement file exists, extract host value and port value from agreement file, host value and port value write are used for Generate the write function of connectorServer return value, in order to generate amended return value;If agreement file does not exist, Then generate amended return value using the original value of write function;Wherein, agreement file is starting J2EE clothes by calculate node Create before business device process, record network node information and the port information of host.
In this embodiment, java Instrumentation can monitor and assist to operate in the application program on JVM, This monitoring and assistance include but is not limited to obtain JVM run time behaviour, and substitutions and modifications class defines etc., The maximum effect of Instrumentation is exactly dynamic change and the operation of class definition.Return connectorServer information Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to change returning of jmx server Return value it is necessary to modify to the code of write (), allow it return host and port of host to client.By this Amended return value can be set up with service end to be connected and carry out JMX monitoring.
The attachment means of the JMX client of embodiment are it is preferable that JMX client includes according to a second aspect of the present invention: Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client is more than above-mentioned Jconsole or JvisualVM and Jboss, It is achieved thereby that Jconsole, JvisualVM and Jboss client carries out across a network process monitoring by JMX, meet client Diversified demand.
According to a second aspect of the present invention the JMX client of embodiment attachment means it is preferable that virtual machine and host with The mode of network address translation connects.
In this embodiment, virtual machine and host are attached in the way of Network Address Translation, are convenient for network Management, is capable of the access to Intranet equipment (as server) for the external network, concurrently facilitates saving IP address resource.
Brief description
The above-mentioned and/or additional aspect of the present invention and advantage will become from reference to the description to embodiment for the accompanying drawings below Substantially and easy to understand, wherein:
The flow chart that Fig. 1 shows the method for attachment of JMX client according to an embodiment of the invention;
Fig. 2 shows the block diagram of the attachment means of JMX client according to an embodiment of the invention;
Fig. 3 shows the schematic diagram of jconsole monitoring interface according to an embodiment of the invention;
Fig. 4 shows the schematic diagram of network connection in virtual machine according to an embodiment of the invention.
Specific embodiment
In order to be more clearly understood that the above objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specifically real Mode of applying is further described in detail to the present invention.It should be noted that in the case of not conflicting, the enforcement of the application Feature in example and embodiment can be mutually combined.
Elaborate a lot of details in the following description in order to fully understand the present invention, but, the present invention also may be used To be implemented different from other modes described here using other, therefore, protection scope of the present invention is not described below Specific embodiment restriction.
The flow chart that Fig. 1 shows the method for attachment of JMX client according to an embodiment of the invention.
As shown in Figure 1 it is proposed that a kind of method of attachment of JMX client, including:Step 102, according to the modification receiving Instruction, in modification JMX server, the mechanism of the generation return value of connectorServer, generates amended return value;Step 104, using amended return value, return network node information and the port information of host to JMX client, with JMX visitor Family end is set up and is connected.
The method of attachment of JMX client according to an embodiment of the invention, by changing in JMX service end The mechanism of the generation return value of connectorServer (a kind of adapter service, for connecting monitoring client and monitored end) is come Break through network to limit, JMX client can be made to set up with the virtual machine of JMX service end and be connected.I.e. in modification JMX server Before the generation return value of connectorServer, client can only pass through network node and port and the virtual machine of host Communicated, but the connectorServer address that JMX server end returns be the lan address that client cannot access, Accordingly, it would be desirable to change the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer Enough return the IP (network node) and PORT (port) of host, using this amended return value, JMX server and JMX visitor Family end establishes connection, in order to realize carrying out the virtual machine process monitoring of across a network using JMX client.
In addition, the method for attachment of JMX client according to the above embodiment of the present invention, can also have the skill added as follows Art feature:
The method of attachment of the JMX client of embodiment is it is preferable that before step 102, go back according to a first aspect of the present invention Including:According to the setting instruction receiving, change DEA code, add host to the network port mapping of virtual machine.
In this embodiment, in order to the serve port from outside access virtual machine, first have to change DEA code, add Plus outer net (host) arrives the port mapping of Intranet (virtual machine).For example, Intranet IP of a virtual machine is 10.254.9.174, Host IP is 172.18.4.240.After adding port mapping, 34823 ports of host can be passed through in 9999 ports of virtual machine Access;34824 ports that host is passed through in 1099 ports of virtual machine access.If with jconsole connection server, then Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, by network port Mapping implementation The connection of virtual machine and host.
The method of attachment of the JMX client of embodiment is it is preferable that step 102 specifically includes according to a first aspect of the present invention: Based on the instrumentation mechanism of java, the class file of virtual machine JMX server checks for agreement literary composition Part;If agreement file exists, extract host value and port value from agreement file, host value and port value write are used for giving birth to Become the write function of connectorServer return value, in order to generate amended return value;If agreement file does not exist, Generate described amended return value using the original value of write function;Wherein, agreement file is starting J2EE by calculate node Create before server processes, record network node information and the port information of host.
In this embodiment, java Instrumentation can monitor and assist to operate in the application program on JVM, This monitoring and assistance include but is not limited to obtain JVM run time behaviour, and substitutions and modifications class defines etc., The maximum effect of Instrumentation is exactly dynamic change and the operation of class definition.Return connectorServer information Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to change returning of jmx server Return value it is necessary to modify to the code of write (), allow it return host and port of host to client.By this Amended return value can be set up with service end to be connected and carry out JMX monitoring.
Described agreement file created, by the network section of calculate node record host before starting J2EE server processes Point information and port information, and generate agreement file, this agreement file includes network node information and the port letter of host Breath;Next, by the instrumentation mechanism based on java, whether check in the class file of virtual machine JMX server There is agreement file, if there is agreement file, extracting host value and port value from agreement file, host value and port value are write Enter the write function for generating connectorServer return value, for generating amended return value;If not existing about Determine file, then generate described amended return value using the original value of write function.For example:Original ConnectorServer return value generting machanism is:
Wherein host and port is the private variable of TCPEndpoint class, is defined as follows:
/*IP address or host name*/
private String host;
/*port number*/
private int port;
In order to change the return value of JMX server it is necessary to modify to the code of write (), allow it to host Return host and port specifying.
If the value for example getting host and port is respectively 172.18.4.240 and 34823, then, above-mentioned code is entered Row is changed, and the code of modification write () is:
public void write(ObjectOutput out)throws IOException{
Host=" 172.18.4.240 ";
Port=34823;
If (csf==null)
out.writeByte(FORMAT_HOST_PORT);
out.writeUTF(host);
out.writeInt(port);
}else{
out.writeByte(FORMAT_HOST_PORT_FACTORY);
out.writeUTF(host);
out.writeInt(port);
out.writeObject(csf);
}
}
It is as follows that JMX client jconsole and virtual machine set up the process that JMX is connected:First, jconsole sends request To 172.18.4.240:34824, obtain stub;This request is forwarded to 10.254.9.174:1099, virtual machine receives please Ask and process;Then, JMX execution write method, returns host the and port information of connectorServer, due to this part Code has been modified, and the information of therefore return is 172.18.4.240:34823;When host receives the letter of virtual machine return After breath, with 172.18.4.240:34823 set up and connect, it is achieved thereby that being successfully connected of host and virtual machine.
The method of attachment of the JMX client of embodiment is it is preferable that JMX client includes according to a first aspect of the present invention: Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client is more than above-mentioned Jconsole or JvisualVM and Jboss, It is achieved thereby that Jconsole, JvisualVM and Jboss client carries out across a network process monitoring by JMX, meet client Demand.
According to a first aspect of the present invention the JMX client of embodiment method of attachment it is preferable that virtual machine and host with The mode of network address translation connects.
In this embodiment, in modification JMX server, connectorServer generates IP and port information, and by void The IP that plan machine generates and port information return to host by NAT connected mode, realize the communication of virtual machine and outer net.
Fig. 2 shows the block diagram of the attachment means of JMX client according to an embodiment of the invention.
As shown in Fig. 2 the attachment means 200 of JMX client according to embodiments of the present invention, including:Modification unit 202, According to the modification instruction receiving, the mechanism of the generation return value of connectorServer in modification JMX server, generation is repaiied Return value after changing;Connection unit 204, using amended return value, returns the network node letter of host to JMX client Breath and port information, are set up with JMX client and are connected.
The attachment means of JMX client according to an embodiment of the invention, by changing in JMX service end The mechanism of the generation return value of connectorServer (a kind of adapter service, for connecting monitoring client and monitored end) is come Break through network to limit, JMX client can be made to set up with the virtual machine of JMX service end and be connected.I.e. in modification JMX server Before the generation return value of connectorServer, client can only pass through network node and port and the virtual machine of host Communicated, but the connectorServer address that JMX server end returns be the lan address that client cannot access, Accordingly, it would be desirable to change the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer Enough return the IP (network node) and PORT (port) of host, using this amended return value, JMX server and JMX visitor Family end establishes connection, in order to realize carrying out the virtual machine process monitoring of across a network using JMX client.
In addition, the attachment means of JMX client according to the above embodiment of the present invention, can also have the skill added as follows Art feature:
The attachment means of the JMX client of embodiment are it is preferable that also include according to a second aspect of the present invention:
Map unit 206, according to the setting instruction receiving, changes DEA code, adds host to described virtual machine The network port maps.
In this embodiment, for example, the JMX service of the application server geronimo of X3 platform is using fixation Remiregistry (1099) and connectorServer (9999) port, respectively 1099 and 9999.Therefore, in order to From outside access to this two ports, first have to, according to the setting instruction receiving, to change DEA code, to add outer net (host Machine) to Intranet (virtual machine) port mapping.For example, Intranet IP of a virtual machine is 10.254.9.174, and host IP is 172.18.4.240.After adding port mapping, 34823 ports access of host can be passed through in 9999 ports of virtual machine;Virtual 34824 ports that host is passed through in 1099 ports of machine access, and corresponding JMX URL is:service:jmx:rmi:// 172.18.4.240:34823/jndi/rmi://172.18.4.240:34824/JMXConnect or, if with jconsole Connection server, then jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, by net Network port mapping is achieved virtual machine and is connected with the first step of host, so just can carry out the operation of next step:Modification The generation return value of connectorServer.
The attachment means of the JMX client of embodiment are it is preferable that change unit 202, specifically according to a second aspect of the present invention For:Based on the instrumentation mechanism of java, check for about in the class file of virtual machine JMX server Determine file;If agreement file exists, from agreement file, extract host value and port value, host value and the write of port value are used In the write function generating connectorServer return value, in order to generate amended return value;If agreement file is not deposited Then generating amended return value using the original value of write function;Wherein, agreement file is being started by calculate node Create before J2EE server processes, record network node information and the port information of host.
In this embodiment, java Instrumentation can monitor and assist to operate in the application program on JVM, This monitoring and assistance include but is not limited to obtain JVM run time behaviour, and substitutions and modifications class defines etc., The maximum effect of Instrumentation is exactly dynamic change and the operation of class definition.Return connectorServer information Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to change returning of jmx server Return value it is necessary to modify to the code of write (), allow it return host and port of host to client.By this Amended return value can be set up with service end to be connected and carry out JMX monitoring.
Described agreement file created, by the network section of calculate node record host before starting J2EE server processes Point information and port information, and generate agreement file, this agreement file includes network node information and the port letter of host Breath;Next, by the instrumentation mechanism based on java, whether check in the class file of virtual machine JMX server There is agreement file, if there is agreement file, extracting host value and port value from agreement file, host value and port value are write Enter the write function for generating connectorServer return value, for generating amended return value;If not existing about Determine file, then generate described amended return value using the original value of write function.For example:Original ConnectorServer return value generting machanism is:
Wherein host and port is the private variable of TCPEndpoint class, is defined as follows:
/*IP address or host name*/
private String host;
/*port number*/
private int port;
In order to change the return value of JMX server it is necessary to modify to the code of write (), allow it to host Return host and port specifying.
If the value for example getting host and port is respectively 172.18.4.240 and 34823, then, above-mentioned code is entered Row is changed, and the code of modification write () is:
public void write(ObjectOutput out)throws IOException{
Host=" 172.18.4.240 ";
Port=34823;
If (csf==null)
out.writeByte(FORMAT_HOST_PORT);
out.writeUTF(host);
out.writeInt(port);
}else{
out.writeByte(FORMAT_HOST_PORT_FACTORY);
out.writeUTF(host);
out.writeInt(port);
out.writeObject(csf);
}
}
It is as follows that JMX client jconsole and virtual machine set up the process that JMX is connected:First, jconsole sends request To 172.18.4.240:34824, obtain stub;This request is forwarded to 10.254.9.174:1099, virtual machine receives please Ask and process;Then, JMX execution write method, returns host the and port information of connectorServer, due to this part Code has been modified, and the information of therefore return is 172.18.4.240:34823;When host receives the letter of virtual machine return After breath, with 172.18.4.240:34823 set up and connect, it is achieved thereby that being successfully connected of host and virtual machine.
The attachment means of the JMX client of embodiment are it is preferable that JMX client includes according to a second aspect of the present invention: Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client can also be JvisualVM and Jboss, it is achieved thereby that Jconsole, JvisualVM and Jboss carries out across a network process monitoring by JMX, meets the diversified demand of client.
According to a second aspect of the present invention the JMX client of embodiment attachment means it is preferable that virtual machine and host with The mode of network address translation connects.
In this embodiment, by the connected mode of NAT (network address translation), it is capable of external network and Intranet is set The access of standby (as server), concurrently facilitates saving IP address resource.
Fig. 3 shows the schematic diagram of jconsole monitoring interface according to an embodiment of the invention
As shown in figure 3, jconsole client sets up JMX using two interfaces with 172.18.4.240 communicating, wherein 34823 is to connect the port that connectorServer uses, and 34824 is to connect the port that remiregistry uses.For place For main frame 172.18.4.240,34823 are mapped to 9999 ports of empty machine, the port that connectorServer uses; 34824 1099 ports being mapped to empty machine, are the ports that remiregistry uses.It can be seen that JMX connects work Normally, and to the internal memory usage amount of virtual machine, thread, class and CPU usage it is monitored, also can transport in virtual machine simultaneously The program of row is monitored, MBean option in such as Fig. 3.
Fig. 4 shows the schematic diagram of network connection in virtual machine according to an embodiment of the invention.
As shown in figure 4, the relevant connection of the geronimo process seen in virtual machine internal.From the figure, it can be seen that 9999 ports establish tcp with 10.1.146.217 and are connected, and do not have tcp to connect on 1099 ports, this is because 1099 ports Only use during JMX sets up and connects, after client finds real connectorServer, this connection is just released Put, thus realizing the connection of virtual machine and monitoring client.
Technical scheme is described in detail above in association with accompanying drawing, by technical scheme, by java The mode of instrumentation is realized client and is connected with the across a network of virtual machine in server, and then realizes across a network JMX monitors, and code is simple, and clear logic makes ISV remote monitoring process be possibly realized;Can arrange and whether open debug mould Formula, thus the safety of virtual machine is unaffected on line;And the program is equally applicable to the virtual machine that creates by docker.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for the skill of this area For art personnel, the present invention can have various modifications and variations.All within the spirit and principles in the present invention, made any repair Change, equivalent, improvement etc., should be included within the scope of the present invention.

Claims (10)

1. a kind of method of attachment of JMX client, for monitoring virtual machine it is characterised in that including:
According to the modification instruction receiving, in modification JMX server, the mechanism of the generation return value of connectorServer, raw Become amended return value;
Using described amended return value, return network node information and the port information of host to JMX client, with institute State JMX client and set up and connect.
2. method of attachment according to claim 1, it is characterised in that the modification receiving in described basis instructs, is changed The mechanism of the generation return value of connectorServer in JMX server, before generating amended return value, also includes:
According to the setting instruction receiving, change DEA code, add host to the network port mapping of described virtual machine.
3. method of attachment according to claim 2, it is characterised in that the modification that described basis receives instructs, changes JMX The mechanism of the generation return value of connectorServer in server, generates amended return value, specifically includes:
Based on the instrumentation mechanism of java, check in the class file of described virtual machine JMX server Agreement file;
If described agreement file exists, extract host value and port value from described agreement file, by described host value and institute State the write of port value for generating the write function of described connectorServer return value, described amended in order to generate Return value;
If described agreement file does not exist, generate described amended return value using the original value of described write function;
Wherein, described agreement file was created before starting J2EE server processes by calculate node, recorded described host Network node information and port information.
4. method of attachment according to claim 1 is it is characterised in that described JMX client includes:Jconsole、 JvisualVM and Jboss.
5. method of attachment according to claim 1 is it is characterised in that described virtual machine and described host are with the network address The mode of conversion connects.
6. a kind of attachment means of JMX client, for monitoring virtual machine it is characterised in that including:
Modification unit, according to the modification instruction receiving, the generation return value of connectorServer in modification JMX server Mechanism, generate amended return value;
Connection unit, using described amended return value, returns to network node information and the port of host to JMX client Information, is set up with described JMX client and is connected.
7. attachment means according to claim 6 are it is characterised in that also include:
Map unit, according to the setting instruction receiving, changes DEA code, adds host to the network-side of described virtual machine Mouth mapping.
8. attachment means according to claim 7 are it is characterised in that described modification unit, specifically for:
Based on the instrumentation mechanism of java, check in the class file of described virtual machine JMX server Agreement file;
If described agreement file exists, extract host value and port value from described agreement file, by described host value and institute State the write of port value for generating the write function of described connectorServer return value, described amended in order to generate Return value;
If described agreement file does not exist, generate described amended return value using the original value of described write function;
Wherein, described agreement file was created before starting J2EE server processes by calculate node, recorded described host Network node information and port information.
9. attachment means according to claim 6 are it is characterised in that described JMX client includes:Jconsole、 JvisualVM and Jboss.
10. attachment means according to claim 6 are it is characterised in that described virtual machine and described host are with network ground The mode of location conversion connects.
CN201611027195.4A 2016-11-18 2016-11-18 The connection method and attachment device of JMX client Active CN106453686B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611027195.4A CN106453686B (en) 2016-11-18 2016-11-18 The connection method and attachment device of JMX client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611027195.4A CN106453686B (en) 2016-11-18 2016-11-18 The connection method and attachment device of JMX client

Publications (2)

Publication Number Publication Date
CN106453686A true CN106453686A (en) 2017-02-22
CN106453686B CN106453686B (en) 2019-09-03

Family

ID=58220778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611027195.4A Active CN106453686B (en) 2016-11-18 2016-11-18 The connection method and attachment device of JMX client

Country Status (1)

Country Link
CN (1) CN106453686B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366108A (en) * 2018-01-31 2018-08-03 广东亿迅科技有限公司 WebLogic cluster users management method and device based on JMX technologies
CN112579310A (en) * 2019-09-30 2021-03-30 北京车和家信息技术有限公司 Service calling method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072129A (en) * 2007-06-25 2007-11-14 北京邮电大学 JMX based network service management method and its application system
CN103248531A (en) * 2012-11-16 2013-08-14 佳都新太科技股份有限公司 Server network monitoring mode

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072129A (en) * 2007-06-25 2007-11-14 北京邮电大学 JMX based network service management method and its application system
CN103248531A (en) * 2012-11-16 2013-08-14 佳都新太科技股份有限公司 Server network monitoring mode

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YANGYAN19870319: ""jmx rmi 穿越防火墙问题及jmxmp的替代方案"", 《CSDN博客》 *
YANTAOGUO: ""解决JMX 采用hessian协议在NAT网络环境下的通信问题 "", 《ITEYE博客》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366108A (en) * 2018-01-31 2018-08-03 广东亿迅科技有限公司 WebLogic cluster users management method and device based on JMX technologies
CN108366108B (en) * 2018-01-31 2021-03-02 广东亿迅科技有限公司 WebLogic cluster user management method and device based on JMX technology
CN112579310A (en) * 2019-09-30 2021-03-30 北京车和家信息技术有限公司 Service calling method and device

Also Published As

Publication number Publication date
CN106453686B (en) 2019-09-03

Similar Documents

Publication Publication Date Title
CN102571698B (en) Access authority control method, system and device for virtual machine
CN110362009A (en) Configuration logic generation method, device and the building system of building system
Hughes et al. Looci: The loosely-coupled component infrastructure
CN108304247A (en) The method and apparatus of access camera, server, readable storage medium storing program for executing
US8010973B2 (en) Class loader for managing a network
CN106797349A (en) For the dynamic cascading cluster of dynamic VNF
CN105138398B (en) SOCKET communication and management of process general-purpose platform and method under synchronous communication mode
CN109361550A (en) The method, device and equipment of network equipments configuration management
CN104160376A (en) Offline provisioning of virtual machines
CN103336705A (en) Automatic transcoding and semantic adaptation between scripting and workflow systems
CN109194617A (en) The automatically parsing of XML message, packaging method and device
US7424525B2 (en) Managing headless computer systems
CN103685608A (en) Method and device for automatically configuring IP (Internet Protocol) address of security virtual machine
CN111385147B (en) Fault simulation method, device and computer readable storage medium
CN105320503B (en) Middleware card cage design system and method
CN106453686B (en) The connection method and attachment device of JMX client
CN105242910B (en) Board state control method and client based on middleware card cage
Berson et al. Introduction to the ABone
CN102571474B (en) Virtualized Radius test macro and method
CN102184120A (en) Management method, monitoring system and monitoring agent module for Java virtual machine
CN103677842A (en) Software tool configuration type integrated expansion calling method and system
CN105204829B (en) Plug-in unit socket resource control method and client based on middleware card cage
Buisson et al. Coqcots & Pycots: non-stopping components for safe dynamic reconfiguration
CN103684904A (en) Tri-networks integration network monitoring system based on IP
CN106775682A (en) A kind of SOA frameworks send a notice service middleware

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant