SiteScope Archives - ISbyR https://isbyr.com/tag/sitescope/ Infrequent Smarts by Reshetnikov Sat, 26 Feb 2022 12:15:37 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 Use jmxsh – JMX CLI tool – to troubleshoot remote JMX RMI connection https://isbyr.com/use-jmxsh-jmx-cli-tool-to-troubleshoot-remote-jmx-connection/ https://isbyr.com/use-jmxsh-jmx-cli-tool-to-troubleshoot-remote-jmx-connection/#respond Fri, 20 Nov 2015 02:02:49 +0000 http://isbyr.com/?p=159 Overview 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 … Continue reading Use jmxsh – JMX CLI tool – to troubleshoot remote JMX RMI connection

The post Use jmxsh – JMX CLI tool – to troubleshoot remote JMX RMI connection appeared first on ISbyR.

]]>
Overview

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.

Basic Tool Usage – troubleshoot remote JMX RMI connection

  • You must have a java installed on the server that will be intiating the tool – the source server
  • Download the jar from here http://code.google.com/p/jmxsh/downloads/detail?name=jmxsh-R5.jar&can=2&q=
  • Copy the jar to the source server to a temporary folder (for ex: to E:\Temp\Ilya\JMX)
  • Start the tool with ‘-l’ option which enables logging and provide a log file name
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.
  • Connect to the JMX server. Must provide host (-h) and port (-p) and optionally user (-U) and password (-P).parameters
% jmx_connect -h s02345678901 -p 29602Connected to service:jmx:rmi:///jndi/rmi://s02345678901:29602/jmxrmi.%
  • If you can see the “Connected to service…….” then the connectivity test is complete. If not then look into the logfile that was created to get some insights.

Extra

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:

SiteScope JMX Monitor
SiteScope JMX Monitor
  • Hit Enter and you will see the list of all the available domains
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.

]]>
https://isbyr.com/use-jmxsh-jmx-cli-tool-to-troubleshoot-remote-jmx-connection/feed/ 0
How to copy PuTTY SSH Hosts Keys between different users/machines on Windows https://isbyr.com/copy-putty-ssh-hosts-keys-different-usersmachines-windows/ https://isbyr.com/copy-putty-ssh-hosts-keys-different-usersmachines-windows/#respond Fri, 20 Nov 2015 01:09:52 +0000 http://isbyr.com/?p=141 Intro 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: Solution was … Continue reading How to copy PuTTY SSH Hosts Keys between different users/machines on Windows

The post How to copy PuTTY SSH Hosts Keys between different users/machines on Windows appeared first on ISbyR.

]]>
Intro

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:

  • Solution was developed and tested on one machine but will need to run on an other
  • You want to carry you host keys from one machine to another

This article is about copying PuTTY SSH hosts keys focused on doing so on Windows machines.

Method

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.

Identify your destination in registry

  • Open command line (on the target server) and run
    REG QUERY HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist | findstr TARGETUSER
  • For example I want to copy my keys to user ilya_adm
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
  • Note the GUID S-1-5-21-1229272821-1123561945-839522115-123456
  • Due to the above the destination location in registry will be [HKEY_USERS\S-1-5-21-1229272821-1123561945-839522115-123456\Software\SimonTatham\PuTTY\SshHostKeys]

Manually update the registry

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)

Export/Import PuTTY SSH Hosts keys

Perform with caution and preferably back up the destination registry location

  • Export the they host keys from source location to a file.

From command line run

REG EXPORT HKCU\Software\SimonTatham\PuTTY\SshHostKeys c:\temp\source.reg

  • Open the c:\temp\source.reg file
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
  • In the file the change the location to be the destination. for example

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
  • Save the file and import

From command line run

    REG IMPORT c:\temp\source.reg

Done

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.

]]>
https://isbyr.com/copy-putty-ssh-hosts-keys-different-usersmachines-windows/feed/ 0
SiteScope to Slack Alerts Integration https://isbyr.com/sitescope-to-slack-alerts-integration/ https://isbyr.com/sitescope-to-slack-alerts-integration/#respond Mon, 23 Mar 2015 10:07:28 +0000 http://isbyr.com/?p=112 Intro I was recently introduced to Slack by a friend of mine and found it to be quite awesome (especially if the organization that you are working in doesn’t block their site). It allows you to have all of the communication in the organization to be in one place. So I thought: “If that’s the … Continue reading SiteScope to Slack Alerts Integration

The post SiteScope to Slack Alerts Integration appeared first on ISbyR.

]]>
Intro

I was recently introduced to Slack by a friend of mine and found it to be quite awesome (especially if the organization that you are working in doesn’t block their site). It allows you to have all of the communication in the organization to be in one place. So I thought: “If that’s the place where all the communication goes, SiteScope should send it’s alerts there as well”. That’s how this SiteScope to Slack Alerts Integration idea was born.

The Integration is based on slack-webhook by gpedro. At the current version this Slack to SiteScope Alerts Integration is pretty basic: It uses standard SiteScope script alerts parameters to get the name of the monitor and its status, as well as the location of alerts file that is been created and drops the content as the Slack message attachment.

Enough theory let’s get to work!

Configuration

Slack Configuration

  • Go to https://your_team.slack.com/services/new
  • Search for Incoming WebHook and click on Add
  • Choose Channel to Post and press Add Incoming WebHooks Integration
  • In the Setup Instructions section, you will find a WebHook URL.Copy the part after .…services/ (for example if your URL is  https://hooks.slack.com/services/A1A1A1A1A/B2B2B2B2B/c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3 then copy aside the A1A1A1A1A/B2B2B2B2B/c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3 part)



SiteScope Configuration

└───SisToSlackAlert
    │   SisToSlackAlert.bat
    │   
    ├───conf
    │       log4j.properties
    │       slack.properties
    │       
    ├───lib
    │       gson-2.3.1.jar
    │       log4j.jar
    │       PropUtils.jar
    │       SisToSlackAlert.jar
    │       
    └───logs
            SisToSlackAlert.bat.err.log
            SisToSlackAlert.bat.log
  •  You might have a warning about the zip file being dangerous, still proceed

SisToSlackAlert Zip file Browser Warning

SisToSlackAlert Zip file Browser Warning

  • Extract its content under <SiteScope_Dir>\_custom folder (from now on it will be referenced as <SisToSlackAlert_Dir>)

SisToSlackAlert folders structure
SisToSlackAlert folders structure

  • Copy the  <SisToSlackAlert_Dir>\SisToSlackAlert.bat  to  <SiteScope_Dir>\scripts folder

SiteScope to Slack Alerts Integration Configuration

Update the <SiteScope_Dir>\scripta\SisToSlackAlert.bat file with your properties of your SiteScope deployment

Property Name Description Mandatory? Default Value
SIS_DIR Location of SiteScope Root folder Yes C:\Apps\SiteScope
BASE_DIR Location of SisToSlackAlert  folder Yes %SIS_DIR%\_custom\SisToSlackAlert:




Update the  <SisToSlackAlert_Dir>\conf\slack.properties  configuration file with your details:

Property Name Description Mandatory? Default Value
slackWebHook The id of your Webhook Yes A1A1A1A1A/B2B2B2B2B/c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3
slackChannel Slack Channel the alerts will be posted to. (if empty then the default channel that was used during Slack WebHook Integration will be used) No #sitescope
slackUsername Username that this integration will post as (if empty then the default username that was used during Slack WebHook Integration will be used) No dev_sitescope
slackMessageIcon That’s icon that is used for messages from this SiteScope to Slack Alerts Integration. For more icons check http://www.emoji-cheat-sheet.com/ No :vertical_traffic_light:
I’ve made the bar on the left side of the message colour-dependant on the status. If you would like to tweak these colours update the following properties
slackAttachmentColorError Attachment’s colour for Error messages No danger
slackAttachmentColorWarning Attachment’s colour for Warning messages No warning
slackAttachmentColorGood Attachment’s colour for Good messages No good

If you you’ve extracted the SisToSlackAlert.zip to a location other than <SiteScope_Dir>\_custom update the  <SisToSlackAlert_Dir>\conf\log4j.properties (the value you configure should be relative to the <SiteScope_Dir> folder).

SiteScope Alerts Configuration

Now, the only thing that needs to be done is:

  • Create the alerts in SiteScope, the same regular way you are used to do it

SisToSlackAlert Alerts Configuration
SisToSlackAlert Alerts Configuration

  • Add a new Script action. In the Script Action – select the SisToSlackAlert.bat script and as the first parameter pass the Status (Error/Warning/Normal)

SisToSlackAlert Alert Action Configuration
SisToSlackAlert Alert Action Configuration

By the way, if you already have an Alert set-up just add the required SisToSlackAlert actions


Results and Troubleshooting

So after you’ve finished your configuration you want to see some results!

The following SiteScope monitor

SisToSlackAlert SiteScope monitor status
SisToSlackAlert SiteScope monitor status

Should produce a Slack message similar to that one (the content of it depends on your script’s template)

SisToSlackAlert Slack message
SisToSlackAlert Slack message

If for some reason you don’t get the messages in Slack or the message seems different from what you expect try to look into the following logs:

  • <SisToSlackAlert_Dir>\logs\SisToSlackAlert.bat.log – Logs parameters that the Java code was called with, Refreshed each time the Alert’s action is triggered.
  • <SisToSlackAlert_Dir>\logs\SisToSlackAlert.bat.err.log – Logs Errors that occurred during the execution of the Java code was called with, Refreshed each time the Alert’s action is triggered
  • <SisToSlackAlert_Dir>\logs\SisToSlackAlert.log – You will mostly find here logs related to the way that SiteScope data is converted to the Slack message and the message is designed. Logging severity can be changed in the <SisToSlackAlert_Dir>\conf\log4j.properties. That’s a daily log

P.S.

I have a few thoughts about making this Slack to SiteScope Alerts Integration more robust and will be happy to hear your ideas about that. and any other thoughts you might have about the current version.


The post SiteScope to Slack Alerts Integration appeared first on ISbyR.

]]>
https://isbyr.com/sitescope-to-slack-alerts-integration/feed/ 0