CN106453686B - The connection method and attachment device of JMX client - Google Patents
The connection method and attachment device of JMX client Download PDFInfo
- Publication number
- CN106453686B CN106453686B CN201611027195.4A CN201611027195A CN106453686B CN 106453686 B CN106453686 B CN 106453686B CN 201611027195 A CN201611027195 A CN 201611027195A CN 106453686 B CN106453686 B CN 106453686B
- Authority
- CN
- China
- Prior art keywords
- jmx
- host
- return value
- value
- client
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
- H04L61/2567—NAT traversal for reachability, e.g. inquiring the address of a correspondent behind a NAT server
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/2517—Translation of Internet protocol [IP] addresses using port numbers
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
The present invention relates to the connection method of JMX client and attachment devices, wherein the connection method of JMX client includes: to modify the mechanism of the generation return value of connectorServer in JMX server according to the modification instruction received, generate modified return value;Using the modified return value, the network node information and port information of host are returned to JMX client, establishes connection with the JMX client.According to the technical solution of the present invention, the JMX monitoring of across a network connection is realized by way of java instrumentation, code is simple, clear logic.
Description
Technical field
The present invention relates to virtual machine monitoring technical fields, in particular to a kind of connection method and one of JMX client
The attachment device of kind JMX client.
Background technique
It is the implantation management such as application program, equipment and system that JMX (Java Management Extensions), which is a kind of,
The frame of function defines architecture, the design mould of application program and network management and monitoring in Java programming language
Formula, application programming interfaces and service, usually using JMX come monitoring system operating status or management system in some terms,
For example empty the cache, reload configuration file etc..But in the prior art, JMX does not support the process monitoring of across a network, this is
Certain applications are made troubles, such as just directly can not carry out JMX monitoring to empty machine on X3 platform.
Therefore, how to realize that the JMX monitoring of across a network is connected to become technical problem urgently to be resolved.
Summary of the invention
The present invention is directed at least solve one of above-mentioned technical problems existing in the prior art or related technologies.
For this purpose, an object of the present invention is to provide the connection methods of JMX client.
It is another object of the present invention to provide a kind of attachment devices of JMX client.
To achieve the above object, according to the embodiment of the first aspect of the invention, a kind of connection of JMX client is proposed
Method, comprising: instructed according to the modification received, modify the machine of the generation return value of connectorServer in JMX server
System, generates modified return value;Using modified return value, the network node information of host is returned to JMX client
And port information, connection is established with JMX client.
The connection method of the JMX client of embodiment according to the present invention, by modification JMX server-side
The mechanism of the generation return value of connectorServer (a kind of connector service, for connecting monitoring client and monitored end) is come
Network limitation is broken through, JMX client and the virtual machine of JMX server-side can be made to establish connection.I.e. in modification JMX server
Before the generation return value of connectorServer, client can only pass through the network node of host and port and virtual machine
It is communicated, but the address connectorServer of JMX server end return is the lan address that client can not access,
Therefore, it is necessary to modify the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer
The IP (network node) and PORT (port) for enough returning to host, using this modified return value, JMX server and JMX visitor
Family end establishes connection, to realize that the virtual machine process for carrying out across a network using JMX client monitors.
In addition, the connection method of JMX client according to the above embodiment of the present invention, can also have following additional skill
Art feature:
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that repaired according to what is received
Change instruction, modify the mechanism of the generation return value of connectorServer in JMX server, generate modified return value it
Before, further includes: it is instructed according to the setting received, modifies DEA code, the network port of addition host to virtual machine maps.
In this embodiment, in order to from the serve port of outside access virtual machine, first have to modify DEA code, add
Outer net (host) is added to arrive the port mapping of Intranet (virtual machine).For example, the Intranet IP of a virtual machine is 10.254.9.174,
Host IP is 172.18.4.240.After adding port mapping, 9999 ports of virtual machine can pass through 34823 ports of host
Access;1099 ports of virtual machine are accessed by 34824 ports of host.If with jconsole connection server, then
Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, pass through network port Mapping implementation
The first step of virtual machine and host connects.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that according to the modification received
Instruction modifies the mechanism of the generation return value of connectorServer in JMX server, generates modified return value, specifically
It include: instrumentation (a kind of broker program independently of except application program, to monitor and assist based on java
The application program of operation on a virtual machine) mechanism, agreement text is checked in the class file of virtual machine JMX server
Part;If arranging file to exist, host value and port value are extracted from agreement file, host value and the write-in of port value are used to give birth to
At the write function of connectorServer return value, to generate modified return value;If agreement file is not present,
The modified return value is generated using the original value of write function;Wherein, agreement file is by calculate node in starting J2EE
It is created before server processes, records the network node information and port information of host.
In this embodiment, java Instrumentation can monitor and assist the application program operated on JVM,
This monitoring and assistance include but is not limited to obtain JVM run time behaviour, substitutions and modifications class definition etc.,
The maximum effect of Instrumentation is exactly the dynamic change and operation that class defines.Return to connectorServer information
Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to modify returning for jmx server
Return value, it is necessary to modify to the code of write (), it is allowed to return to the host and port of host to client.Pass through this
Modified return value can establish connection with server-side and carry out JMX monitoring.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that JMX client includes:
Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client and more than above-mentioned Jconsole, be also possible to JvisualVM and
Jboss carries out across a network process monitoring by JMX to realize Jconsole, JvisualVM and Jboss client, meets
The diversified demand of client.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, 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 a manner of Network Address Translation, are convenient for network
Management, can be realized access of the external network to Intranet equipment (such as server), while help to save IP address resource.
Embodiment according to a second aspect of the present invention, it is also proposed that a kind of attachment device of JMX client, for monitoring void
Quasi- machine, comprising: modification unit instructs according to the modification received, modifies the generation of connectorServer in JMX server
The mechanism of return value generates modified return value;Connection unit returns to place to JMX client using modified return value
The network node information and port information of host establish connection with JMX client.
The attachment device of the JMX client of embodiment according to the present invention, by modification JMX server-side
The mechanism of the generation return value of connectorServer (a kind of connector service, for connecting monitoring client and monitored end) is come
Network limitation is broken through, JMX client and the virtual machine of JMX server-side can be made to establish connection.I.e. in modification JMX server
Before the generation return value of connectorServer, client can only pass through the network node of host and port and virtual machine
It is communicated, but the address connectorServer of JMX server end return is the lan address that client can not access,
Therefore, it is necessary to modify the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer
The IP (network node) and PORT (port) for enough returning to host, using this modified return value, JMX server and JMX visitor
Family end establishes connection, to realize that the virtual machine process for carrying out across a network using JMX client monitors.
In addition, the attachment device of JMX client according to the above embodiment of the present invention, can also have following additional skill
Art feature:
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, further includes: map unit, according to connecing
The setting instruction received, modifies DEA code, and the network port of addition host to the virtual machine maps.
In this embodiment, in order to from the serve port of outside access virtual machine, first have to modify DEA code, add
Outer net (host) is added to arrive the port mapping of Intranet (virtual machine).For example, the Intranet IP of a virtual machine is 10.254.9.174,
Host IP is 172.18.4.240.After adding port mapping, 9999 ports of virtual machine can pass through 34823 ports of host
Access;1099 ports of virtual machine are accessed by 34824 ports of host.If with jconsole connection server, then
Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, pass through network port Mapping implementation
The first step of virtual machine and host connects.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that modification unit, it is specific to use
In: the instrumentation mechanism based on java checks for agreement in the class file of virtual machine JMX server
File;If arranging file to exist, host value and port value are extracted from agreement file, host value and the write-in of port value are used for
The write function for generating connectorServer return value, to generate modified return value;If agreement file is not present,
Then modified return value is generated using the original value of write function;Wherein, agreement file is by calculate node in starting J2EE clothes
It is created before device process of being engaged in, records the network node information and port information of host.
In this embodiment, java Instrumentation can monitor and assist the application program operated on JVM,
This monitoring and assistance include but is not limited to obtain JVM run time behaviour, substitutions and modifications class definition etc.,
The maximum effect of Instrumentation is exactly the dynamic change and operation that class defines.Return to connectorServer information
Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to modify returning for jmx server
Return value, it is necessary to modify to the code of write (), it is allowed to return to the host and port of host to client.Pass through this
Modified return value can establish connection with server-side and carry out JMX monitoring.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that JMX client includes:
Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client is more than above-mentioned Jconsole, is also possible to JvisualVM and Jboss,
Across a network process monitoring is carried out to realize Jconsole, JvisualVM and Jboss client by JMX, meets client
Diversified demand.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, 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 a manner of Network Address Translation, are convenient for network
Management, can be realized access of the external network to Intranet equipment (such as server), while help to save IP address resource.
Detailed description of the invention
Above-mentioned and/or additional aspect of the invention and advantage will become from the description of the embodiment in conjunction with the following figures
Obviously and it is readily appreciated that, in which:
Fig. 1 shows the flow chart of the connection method of the JMX client of embodiment according to the present invention;
Fig. 2 shows the block diagrams of the attachment device of the JMX client of embodiment according to the present invention;
Fig. 3 shows the schematic diagram of the jconsole monitoring interface of embodiment according to the present invention;
Fig. 4 shows the schematic diagram being connected to the network in the virtual machine of embodiment according to the present invention.
Specific embodiment
To better understand the objects, features and advantages of the present invention, with reference to the accompanying drawing and specific real
Applying mode, the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application
Feature in example and embodiment can be combined with each other.
In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, still, the present invention may be used also
To be implemented using other than the one described here other modes, therefore, protection scope of the present invention is not by described below
Specific embodiment limitation.
Fig. 1 shows the flow chart of the connection method of JMX client according to an embodiment of the invention.
As shown in Figure 1, proposing a kind of connection method of JMX client, comprising: step 102, according to the modification received
Instruction modifies the mechanism of the generation return value of connectorServer in JMX server, generates modified return value;Step
104, using modified return value, the network node information and port information of host are returned to JMX client, with JMX visitor
Connection is established at family end.
The connection method of the JMX client of embodiment according to the present invention, by modification JMX server-side
The mechanism of the generation return value of connectorServer (a kind of connector service, for connecting monitoring client and monitored end) is come
Network limitation is broken through, JMX client and the virtual machine of JMX server-side can be made to establish connection.I.e. in modification JMX server
Before the generation return value of connectorServer, client can only pass through the network node of host and port and virtual machine
It is communicated, but the address connectorServer of JMX server end return is the lan address that client can not access,
Therefore, it is necessary to modify the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer
The IP (network node) and PORT (port) for enough returning to host, using this modified return value, JMX server and JMX visitor
Family end establishes connection, to realize that the virtual machine process for carrying out across a network using JMX client monitors.
In addition, the connection method of JMX client according to the above embodiment of the present invention, can also have following additional skill
Art feature:
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that before step 102, also
It include: that DEA code is modified according to the setting instruction received, the network port of addition host to virtual machine maps.
In this embodiment, in order to from the serve port of outside access virtual machine, first have to modify DEA code, add
Outer net (host) is added to arrive the port mapping of Intranet (virtual machine).For example, the Intranet IP of a virtual machine is 10.254.9.174,
Host IP is 172.18.4.240.After adding port mapping, 9999 ports of virtual machine can pass through 34823 ports of host
Access;1099 ports of virtual machine are accessed by 34824 ports of host.If with jconsole connection server, then
Jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, pass through network port Mapping implementation
The connection of virtual machine and host.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that step 102 specifically includes:
Instrumentation mechanism based on java checks for agreement text in the class file of virtual machine JMX server
Part;If arranging file to exist, host value and port value are extracted from agreement file, host value and the write-in of port value are used to give birth to
At the write function of connectorServer return value, to generate modified return value;If agreement file is not present,
The modified return value is generated using the original value of write function;Wherein, agreement file is by calculate node in starting J2EE
It is created before server processes, records the network node information and port information of host.
In this embodiment, java Instrumentation can monitor and assist the application program operated on JVM,
This monitoring and assistance include but is not limited to obtain JVM run time behaviour, substitutions and modifications class definition etc.,
The maximum effect of Instrumentation is exactly the dynamic change and operation that class defines.Return to connectorServer information
Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to modify returning for jmx server
Return value, it is necessary to modify to the code of write (), it is allowed to return to the host and port of host to client.Pass through this
Modified return value can establish connection with server-side and carry out JMX monitoring.
The agreement file creates before starting J2EE server processes, by the network section of calculate node record host
Point information and port information, and agreement file is generated, network node information and port letter in the agreement file including host
Breath;Next, by the instrumentation mechanism based on java, check in the class file of virtual machine JMX server whether
In the presence of agreement file, arrange file if it exists, extracts 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 modified return value;If it does not exist about
Determine file, then generates the modified return value using the original value of write function.Such as: it is original
ConnectorServer return value generting machanism are as follows:
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 modify the return value of JMX server, it is necessary to modify to the code of write (), allow it to host
Return to specified host and port.
Such as if getting the value of host and port is respectively 172.18.4.240 and 34823, then, to above-mentioned code into
Row modification, modifies the code of write () are as follows:
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 with virtual machine establishes the process that JMX is connect: firstly, jconsole sends request
To 172.18.4.240:34824, stub is obtained;The request is forwarded to 10.254.9.174:1099, and virtual machine, which receives, asks
It asks and handles;Then, JMX executes write method, host the and port information of connectorServer is returned to, due to this part
Code is modified, therefore the information returned is 172.18.4.240:34823;When host receives the letter of virtual machine return
After breath, connection is established with 172.18.4.240:34823, to realize being successfully connected for host and virtual machine.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that JMX client includes:
Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client is more than above-mentioned Jconsole, is also possible to JvisualVM and Jboss,
Across a network process monitoring is carried out to realize Jconsole, JvisualVM and Jboss client by JMX, meets client
Demand.
The connection method of the JMX client of embodiment according to a first aspect of the present invention, it is preferable that virtual machine and host with
The mode of network address translation connects.
In this embodiment, the IP and port information that connectorServer is generated in JMX server are modified, and will be empty
The IP and port information that quasi- machine generates return to host by NAT connection type, realize the communication of virtual machine and outer net.
Fig. 2 shows the block diagrams of the attachment device of the JMX client of embodiment according to the present invention.
As shown in Fig. 2, the attachment device 200 of JMX client according to an embodiment of the present invention, comprising: modification unit 202,
According to the modification instruction received, the mechanism of the generation return value of connectorServer in JMX server is modified, generation is repaired
Return value after changing;Connection unit 204 returns to the network node letter of host to JMX client using modified return value
Breath and port information, establish connection with JMX client.
The attachment device of the JMX client of embodiment according to the present invention, by modification JMX server-side
The mechanism of the generation return value of connectorServer (a kind of connector service, for connecting monitoring client and monitored end) is come
Network limitation is broken through, JMX client and the virtual machine of JMX server-side can be made to establish connection.I.e. in modification JMX server
Before the generation return value of connectorServer, client can only pass through the network node of host and port and virtual machine
It is communicated, but the address connectorServer of JMX server end return is the lan address that client can not access,
Therefore, it is necessary to modify the mechanism of the generation return value of connectorServer in JMX server, enable connectorServer
The IP (network node) and PORT (port) for enough returning to host, using this modified return value, JMX server and JMX visitor
Family end establishes connection, to realize that the virtual machine process for carrying out across a network using JMX client monitors.
In addition, the attachment device of JMX client according to the above embodiment of the present invention, can also have following additional skill
Art feature:
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that further include:
Map unit 206 is instructed according to the setting received, modifies DEA code, addition host to the virtual machine
Network port mapping.
In this embodiment, for example, the JMX service of the application server geronimo of X3 platform uses fixation
Remiregistry (1099) and connectorServer (9999) port, respectively 1099 and 9999.Therefore, in order to
From outside access to the two ports, first have to according to the setting instruction received, Lai Xiugai DEA code adds outer net (host
Machine) arrive Intranet (virtual machine) port mapping.For example, the Intranet IP of a virtual machine is 10.254.9.174, host IP is
172.18.4.240.After adding port mapping, 9999 ports of virtual machine can be accessed by 34823 ports of host;Virtually
1099 ports of machine are accessed by 34824 ports of host, corresponding JMX URL are as follows: service:jmx:rmi: //
172.18.4.240:34823/jndi/rmi: // 172.18.4.240:34824/JMXConnect or, if with jconsole
Server is connected, then jconsole can be successfully connected to 172.18.4.240:34824, and obtain stub, therefore, pass through net
Network port mapping realizes virtual machine and the first step of host connects, and just can be carried out the operation of next step in this way: modification
The generation return value of connectorServer.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that modification unit 202, specifically
For: the instrumentation mechanism based on java checks for about in the class file of virtual machine JMX server
Determine file;If arranging file to exist, host value and port value are extracted from agreement file, host value and the write-in of port value are used
In the write function for generating connectorServer return value, to generate modified return value;If agreement file is not deposited
Then modified return value is being generated using the original value of write function;Wherein, agreement file is being started by calculate node
It is created before J2EE server processes, records the network node information and port information of host.
In this embodiment, java Instrumentation can monitor and assist the application program operated on JVM,
This monitoring and assistance include but is not limited to obtain JVM run time behaviour, substitutions and modifications class definition etc.,
The maximum effect of Instrumentation is exactly the dynamic change and operation that class defines.Return to connectorServer information
Code is realized by the write method of sun/rmi/transport/tcp/TCPEndpoint, in order to modify returning for jmx server
Return value, it is necessary to modify to the code of write (), it is allowed to return to the host and port of host to client.Pass through this
Modified return value can establish connection with server-side and carry out JMX monitoring.
The agreement file creates before starting J2EE server processes, by the network section of calculate node record host
Point information and port information, and agreement file is generated, network node information and port letter in the agreement file including host
Breath;Next, by the instrumentation mechanism based on java, check in the class file of virtual machine JMX server whether
In the presence of agreement file, arrange file if it exists, extracts 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 modified return value;If it does not exist about
Determine file, then generates the modified return value using the original value of write function.Such as: it is original
ConnectorServer return value generting machanism are as follows:
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 modify the return value of JMX server, it is necessary to modify to the code of write (), allow it to host
Return to specified host and port.
Such as if getting the value of host and port is respectively 172.18.4.240 and 34823, then, to above-mentioned code into
Row modification, modifies the code of write () are as follows:
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 with virtual machine establishes the process that JMX is connect: firstly, jconsole sends request
To 172.18.4.240:34824, stub is obtained;The request is forwarded to 10.254.9.174:1099, and virtual machine, which receives, asks
It asks and handles;Then, JMX executes write method, host the and port information of connectorServer is returned to, due to this part
Code is modified, therefore the information returned is 172.18.4.240:34823;When host receives the letter of virtual machine return
After breath, connection is established with 172.18.4.240:34823, to realize being successfully connected for host and virtual machine.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that JMX client includes:
Jconsole, JvisualVM and Jboss.
In this embodiment, JMX client is also possible to JvisualVM and Jboss, thus realize Jconsole,
JvisualVM and Jboss carries out across a network process monitoring by JMX, meets the diversified demand of client.
The attachment device of the JMX client of embodiment according to a second aspect of the present invention, it is preferable that virtual machine and host with
The mode of network address translation connects.
In this embodiment, by the connection type of NAT (network address translation), it can be realized external network and Intranet set
The access of standby (such as server), while helping to save IP address resource.
Fig. 3 shows the schematic diagram of the jconsole monitoring interface of embodiment according to the present invention
It is communicated as shown in figure 3, jconsole client establishes JMX with 172.18.4.240 using two interfaces, wherein
34823 be the port for connecting connectorServer and using, and 34824 be the port for connecting remiregistry and using.For place
For host 172.18.4.240,34823 are mapped to 9999 ports of empty machine, the port that connectorServer is used;
34824 are mapped to 1099 ports of empty machine, are the ports that remiregistry is used.It can be seen from the figure that JMX connection work
Normally, and to memory usage amount, thread, class and the CPU usage of virtual machine it is monitored, while also can be to being transported in virtual machine
Capable program is monitored, such as MBean option in Fig. 3.
Fig. 4 shows the schematic diagram being connected to the network in the virtual machine of embodiment according to the present invention.
As shown in figure 4, the relevant connection for 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 connect, and do not have tcp connection on 1099 ports, this is because 1099 ports
It is only used during JMX establishes connection, after client finds true connectorServer, this connection is just released
It puts, to realize the connection of virtual machine and monitoring client.
The technical scheme of the present invention has been explained in detail above with reference to the attached drawings, according to the technical solution of the present invention, passes through java
The mode of instrumentation realizes that client and the across a network of virtual machine in server are connect, and then realizes across a network
JMX monitoring, code is simple, clear logic, makes it possible the long-range monitoring process of ISV;It can be set and whether open debug mould
Formula, so that the safety of virtual machine is unaffected on line;And the program is equally applicable to the virtual machine created by docker.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair
Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.
Claims (6)
1. a kind of connection method of JMX client, for monitoring virtual machine characterized by comprising
According to the modification instruction received, the mechanism of the generation return value of connectorServer in JMX server is modified, it is raw
At modified return value;
Using the modified return value, the network node information and port information of host are returned to JMX client, with institute
It states JMX client and establishes connection;
The modification instruction that the basis receives, modifies the machine of the generation return value of connectorServer in JMX server
System, generates modified return value, specifically includes:
Instrumentation mechanism based on java checks in the class file of the virtual machine JMX server
Arrange file;
If the agreement file exists, host value and port value are extracted from the agreement file, by the host value and institute
It states port value and write function for generating the connectorServer return value is written, it is described modified to generate
Return value;
If the agreement file is not present, the modified return value is generated using the original value of the write function;
Wherein, the agreement file is created before starting J2EE server processes by calculate node, records the host
Network node information and port information;
In the modification instruction that the basis receives, the machine of the generation return value of connectorServer in JMX server is modified
System, before generating modified return value, further includes:
According to the setting instruction received, DEA code is modified, the network port of addition host to the virtual machine maps.
2. connection method according to claim 1, which is characterized in that the JMX client include: Jconsole,
JvisualVM and Jboss.
3. connection method according to claim 1, which is characterized in that the virtual machine and the host are with network address
The mode of conversion connects.
4. a kind of attachment device of JMX client, for monitoring virtual machine characterized by comprising
Unit is modified, is instructed according to the modification received, the generation return value of connectorServer in JMX server is modified
Mechanism, generate modified return value;
Connection unit returns to network node information and the port of host to JMX client using the modified return value
Information establishes connection with the JMX client;
The modification unit, is specifically used for:
Instrumentation mechanism based on java checks in the class file of the virtual machine JMX server
Arrange file;
If the agreement file exists, host value and port value are extracted from the agreement file, by the host value and institute
It states port value and write function for generating the connectorServer return value is written, it is described modified to generate
Return value;
If the agreement file is not present, the modified return value is generated using the original value of the write function;
Wherein, the agreement file is created before starting J2EE server processes by calculate node, records the host
Network node information and port information;
Map unit is instructed according to the setting received, modifies DEA code, the network-side of addition host to the virtual machine
Mouth mapping.
5. attachment device according to claim 4, which is characterized in that the JMX client include: Jconsole,
JvisualVM and Jboss.
6. attachment device according to claim 4, which is characterized in that the virtual machine and the host are with network address
The mode of conversion connects.
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 CN106453686A (en) | 2017-02-22 |
CN106453686B true 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) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Citations (2)
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 |
-
2016
- 2016-11-18 CN CN201611027195.4A patent/CN106453686B/en active Active
Patent Citations (2)
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)
Title |
---|
"jmx rmi 穿越防火墙问题及jmxmp的替代方案";yangyan19870319;《CSDN博客》;20120209;博文第1-8行 |
"解决JMX 采用hessian协议在NAT网络环境下的通信问题 ";yantaoguo;《ITeye博客》;20140214;全文 |
Also Published As
Publication number | Publication date |
---|---|
CN106453686A (en) | 2017-02-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Magee et al. | Regis: A constructive development environment for distributed programs | |
CN102571698B (en) | Access authority control method, system and device for virtual machine | |
CN101188624B (en) | Grid middleware system based on virtual machine | |
CN108304247A (en) | The method and apparatus of access camera, server, readable storage medium storing program for executing | |
CN105704188B (en) | Using the dispositions method and device with service | |
CN109194617A (en) | The automatically parsing of XML message, packaging method and device | |
CN101605056A (en) | A kind of J2EE server monitoring device and adopt the method for supervising of this device | |
CN105281955A (en) | Business and resource orchestration system, method and device | |
CN106453686B (en) | The connection method and attachment device of JMX client | |
US7281236B1 (en) | System and methods for developing and deploying a remote domain system | |
CN106130897B (en) | Performance optimization method based on Router Simulation | |
CN105320503B (en) | Middleware card cage design system and method | |
CN102664952B (en) | Method for managing and monitoring embedded equipment cluster | |
Berson et al. | Introduction to the ABone | |
CN105242910B (en) | Board state control method and client based on middleware card cage | |
KR100370548B1 (en) | Realtime Middleware apparatus providing an integrated software development frameworks of embedded system and its service method | |
Kim | Design pattern based model transformation with tool support | |
CN109194742A (en) | A kind of connection method, device and the storage medium of virtual machine console | |
JP5081888B2 (en) | Method port apparatus and configuration method for robot software components | |
CN105204829B (en) | Plug-in unit socket resource control method and client based on middleware card cage | |
CN100386726C (en) | Method and system for renewing long-distance operation and control of computer platform system programe | |
CN1932760B (en) | System and method for execution of application program | |
KR101757259B1 (en) | Integrated management system for cim based real-time data exchange | |
Blech | Ensuring OSGi Component Based Properties at Runtime with Behavioral Types. | |
Schirgi | Architectural quality attributes for the microservices of care |
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 |