The post Use jmxsh – JMX CLI tool – to troubleshoot remote JMX RMI connection appeared first on ISbyR.
]]>Occasionally when creating SiteScope JMX monitors you might want to verify connectivity or to troubleshoot remote JMX RMi connection. You might also want to be able to provide a tool to the (monitored target) Java application team to try the connectivity locally on the target server.
jmxsh is a command line utility that allows you to connect to (local or remote) JMX and browse the counters.
E:\Temp\Ilya\JMX>java -jar jmxsh-R5.jar -l s02345678901 History file null/.jmxsh_history not writable, command-line history disabled. jmxsh v1.0, Wed Jan 23 03:23:12 EST 2008 Type 'help' for help. Give the option '-?' to any command for usage help. Starting up in shell mode.
% jmx_connect -h s02345678901 -p 29602Connected to service:jmx:rmi:///jndi/rmi://s02345678901:29602/jmxrmi.%
If you wish to explore the JMX a bit more proceed to the next step. For example following the next step will provide you the same information as that SiteScope monitor:
Entering browse mode. ==================================================== Available Domains: 1. JMImplementation 2. com.sun.management 3. Loader 4. Foundations 5. Topaz 6. java.nio 7. java.lang 8. Domain1.s02345678901 9. java.util.logging SERVER: service:jmx:rmi:///jndi/rmi://s02345678901:29602/jmxrmi ==================================================== Select a domain: 7 ==================================================== Available MBeans: 1. java.lang:type=Memory 2. java.lang:type=MemoryPool,name=PS Eden Space 3. java.lang:type=MemoryPool,name=PS Survivor Space 4. java.lang:type=MemoryPool,name=Code Cache 5. java.lang:type=GarbageCollector,name=PS MarkSweep 6. java.lang:type=Runtime 7. java.lang:type=ClassLoading 8. java.lang:type=Threading 9. java.lang:type=Compilation 10. java.lang:type=MemoryPool,name=PS Perm Gen 11. java.lang:type=GarbageCollector,name=PS Scavenge 12. java.lang:type=OperatingSystem 13. java.lang:type=MemoryPool,name=PS Old Gen 14. java.lang:type=MemoryManager,name=CodeCacheManager SERVER: service:jmx:rmi:///jndi/rmi://s02345678901:29602/jmxrmi DOMAIN: java.lang ==================================================== Select an mbean: 1 ==================================================== Attribute List: 1. irw boolean Verbose 2. -r- javax.management.openmbean.CompositeData HeapMemoryUsage 3. -r- javax.management.openmbean.CompositeData NonHeapMemoryUsage 4. -r- int ObjectPendingFinalizationCount 5. -r- javax.management.ObjectName ObjectName Operation List: 6. void gc() SERVER: service:jmx:rmi:///jndi/rmi://s02345678901:29602/jmxrmi DOMAIN: java.lang MBEAN: java.lang:type=Memory ==================================================== Select an attribute or operation: 2 ===================================================== Accessing Attribute HeapMemoryUsage HeapMemoryUsage = javax.management.openmbean.CompositeDataSupport(compositeType=javax.management.openmbean.CompositeType(name=java.lang.management.MoryUsage,items=((itemName=committed,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=init,itemType=javax.management.opmbean.SimpleType(name=java.lang.Long)),(itemName=max,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=used,itemType=jax.management.openmbean.SimpleType(name=java.lang.Long)))),contents={committed=268173312, init=268435456, max=268173312, used=94103128})
The post Use jmxsh – JMX CLI tool – to troubleshoot remote JMX RMI connection appeared first on ISbyR.
]]>The post How to copy PuTTY SSH Hosts Keys between different users/machines on Windows appeared first on ISbyR.
]]>Sometimes you would want to copy PuTTY hosts SSH keys between different users or machines. Having the keys stored will prevent the pop-up message in PuTTY (or Plink/PSCP) when you try to connect to the remote host for the first time.
Some of the cases you would want to do that is:
This article is about copying PuTTY SSH hosts keys focused on doing so on Windows machines.
The Putty SSH hosts keys are saved in registry in
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
for the current user.
So if you are copying keys for the current user you are logged in with (but between different machines) its easy. Just export the relevant registry path and import it on the destination machine.
The problem raises when you want to copy keys to profile of a user other then the user you are currently logged in with.
C:\REG QUERY HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist | findstr ilya_adm \Registry\User\S-1-5-21-1229272821-1123561945-839522115-123456 REG_SZ \Device\HarddiskVolume1\Users\ilya_adm\NTUSER.DAT \Registry\User\S-1-5-21-1229272821-1123561945-839522115-123456_Classes REG_SZ \Device\HarddiskVolume1\Users\ilya_adm\AppData\Local\Microsoft\Windows\UsrClass.dat
You can manually duplicate a single host key entry by creating a new STRING value in the destination registry location ( [HKU\S-1-5-21-….-123456\Software\SimonTatham\PuTTY\SshHostKeys]) and copy the Name and Value from the source location (HKCU\Software\SimonTatham\PuTTY\SshHostKeys)
Perform with caution and preferably back up the destination registry location
From command line run
REG EXPORT HKCU\Software\SimonTatham\PuTTY\SshHostKeys c:\temp\source.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys] "rsa2@22:123.xx.1237"="0x10001,0xaeda610d2dea35d252c8410cb6c7 "rsa2@22:123.xx.12319"="0x10001,0xd9f47896e1aaebb85d801ac5d75 "rsa2@22:123.xx.1238"="0x10001,0xf3ce0d57f72f09b4f48d23c763fe "rsa2@22:123.xx.123213"="0x10001,0xd9f47896e1aaebb85d801ac5d7
update
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
to be
[HKEY_USERS\S-1-5-21-1229272821-1123561945-839522115-123456\Software\SimonTatham\PuTTY\SshHostKeys]
Windows Registry Editor Version 5.00 [HKEY_USERS\S-1-5-21-1229272821-1123561945-839522115-123456\Software\SimonTatham\PuTTY\SshHostKeys] "rsa2@22:123.xx.1237"="0x10001,0xaeda610d2dea35d252c8410cb6c7 "rsa2@22:123.xx.12319"="0x10001,0xd9f47896e1aaebb85d801ac5d75 "rsa2@22:123.xx.1238"="0x10001,0xf3ce0d57f72f09b4f48d23c763fe "rsa2@22:123.xx.123213"="0x10001,0xd9f47896e1aaebb85d801ac5d7
From command line run
REG IMPORT c:\temp\source.reg
That’s it. Now you have the all the PuTTY SSH hosts keys from the source (user/machine) registry in the destination (user/machine) registry.
Image by Brenda Clarke
The post How to copy PuTTY SSH Hosts Keys between different users/machines on Windows appeared first on ISbyR.
]]>