JCC userguide 1.10
Transcription
JCC userguide 1.10
JCC Userguide donkeydevelopment.com This document describes how you can configure and use JCheckCenter (based on version 3.30) Version 1.10 19-3-2014 Inhoud Introduction............................................................................................................................................. 5 System Requirements............................................................................................................................. 7 Installing Java................................................................................................................................... 7 Usage ....................................................................................................................................................... 8 Quickstart ........................................................................................................................................ 8 Develop your own checks. .............................................................................................................. 8 User Interface .......................................................................................................................................... 9 1 Top screen ........................................................................................................................................ 9 2 Toolbar ............................................................................................................................................. 9 Graph submenu ............................................................................................................................. 10 Personal settings ........................................................................................................................... 11 Version information and Registration ........................................................................................... 13 3 check list table ................................................................................................................................ 15 column ............................................................................................................................................... 15 description ......................................................................................................................................... 15 4 Timer panel..................................................................................................................................... 15 5 Status bar........................................................................................................................................ 16 Configuration ......................................................................................................................................... 17 General Structure .............................................................................................................................. 17 Element <configuration > ............................................................................................................. 19 Element <statistics > ..................................................................................................................... 20 Element <notificationMail> .......................................................................................................... 22 Example ......................................................................................................................................... 25 Element <graph> .......................................................................................................................... 26 Element <checker> ....................................................................................................................... 26 Element <check> .......................................................................................................................... 27 Element <actionList> .................................................................................................................... 27 Passwords and Variables ................................................................................................................... 29 Standard Graphs ................................................................................................................................ 31 Custom graphs................................................................................................................................... 31 Embedded Graph .............................................................................................................................. 35 Dynamically embed a graph .......................................................................................................... 35 Statically embed a graph .............................................................................................................. 36 JCC Userguide 1.10 1 HTTPChecker ......................................................................................................................................... 38 Purpose.............................................................................................................................................. 38 Configuration ..................................................................................................................................... 38 Result ................................................................................................................................................. 39 Detailed statistics .............................................................................................................................. 39 HTTPSessionChecker ............................................................................................................................. 41 Purpose.............................................................................................................................................. 41 Record a web session ........................................................................................................................ 41 Convert the recorded session to a valid configuration ..................................................................... 49 Test your session script .................................................................................................................... 53 Refine your script .............................................................................................................................. 58 Replace static data ........................................................................................................................ 58 Using Fiddler to test your script .................................................................................................... 60 Advanced Configuration settings .................................................................................................. 65 Result ................................................................................................................................................. 65 Detailed statistics .............................................................................................................................. 65 QueryChecker ........................................................................................................................................ 67 Purpose.............................................................................................................................................. 67 Configuration ..................................................................................................................................... 67 Database connection ..................................................................................................................... 67 Pattern ........................................................................................................................................... 68 Row count...................................................................................................................................... 68 SQL ................................................................................................................................................. 68 Result ................................................................................................................................................. 69 Example with a SQL pattern Test ...................................................................................................... 70 Detailed statistics .............................................................................................................................. 71 SSH PatternChecker............................................................................................................................... 72 Purpose.............................................................................................................................................. 72 Configuration ..................................................................................................................................... 72 Result ................................................................................................................................................. 72 SSH ScriptExecuter ................................................................................................................................ 74 Purpose.............................................................................................................................................. 74 Configuration ..................................................................................................................................... 74 Connection .................................................................................................................................... 74 JCC Userguide 1.10 2 Command script ............................................................................................................................ 74 Pattern ........................................................................................................................................... 79 Result ................................................................................................................................................. 79 PEChecker .............................................................................................................................................. 80 Purpose.............................................................................................................................................. 80 Configuration ..................................................................................................................................... 80 Result ................................................................................................................................................. 81 LDAPChecker ......................................................................................................................................... 82 Purpose.............................................................................................................................................. 82 Configuration ..................................................................................................................................... 82 Result ................................................................................................................................................. 83 BOLoginChecker .................................................................................................................................... 84 Purpose.............................................................................................................................................. 84 Configuration ..................................................................................................................................... 84 Result ................................................................................................................................................. 85 Required libraries .............................................................................................................................. 86 SSHSizeChecker ..................................................................................................................................... 88 Purpose.............................................................................................................................................. 88 Configuration ..................................................................................................................................... 88 Result ................................................................................................................................................. 89 DBChecker ............................................................................................................................................. 90 Purpose.............................................................................................................................................. 90 Configuration ..................................................................................................................................... 90 Result ................................................................................................................................................. 90 DQLChecker ........................................................................................................................................... 91 Purpose.............................................................................................................................................. 91 Configuration ..................................................................................................................................... 91 Result ................................................................................................................................................. 92 Detailed statistics .............................................................................................................................. 92 Required libraries .............................................................................................................................. 93 HelloWorldChecker ............................................................................................................................... 94 Purpose.............................................................................................................................................. 94 Configuration ..................................................................................................................................... 94 Result ................................................................................................................................................. 95 JCC Userguide 1.10 3 Developer information ...................................................................................................................... 95 SSH CommandConfiguredAction ........................................................................................................... 96 Purpose.............................................................................................................................................. 96 Configuration ..................................................................................................................................... 96 Result ................................................................................................................................................. 96 SSH ScriptConfiguredAction .................................................................................................................. 97 Purpose.............................................................................................................................................. 97 Configuration ..................................................................................................................................... 97 Result ................................................................................................................................................. 98 FAQ and Problem solving ..................................................................................................................... 99 When I press on the graph button, my graph does not show any data............................................ 99 I made a change in the configuration, but it is not reflected in JCC gui............................................ 99 My configuration is not loaded in the GUI ........................................................................................ 99 I have an error in the app.log : java.lang.UnsatisfiedLinkError: no EnJavaJni in java.library.path ... 99 JCC Userguide 1.10 4 Introduction JCC is the abbreviation of JCheckCenter and is a tool that automates checks. It is a great companion for technical application management to monitor the health of their applications. JCC was born during my job within technical application support of CA Clarity, which is a Project and Portfolio management tool. The software has many different software components, running on several different machines. In case of problems we had to check the status of all that components to determine the root cause of the problem. These are some of the checks we perform: the availability of the database the number of running queries the password authentication on the directory server the response of our web and application server the disc space on several servers the status of some server processes the CPU load on the server the availability of our Business Object Report Server JCC Userguide 1.10 5 the availability of our Crystal Report Server several integrity checks on the database using SQL queries. the performance of a standard web session that does a login to the application, an action and a logout Every day we spent a lot of time looking up the appropriate server names, logging in and perform all kind of actions on the server. JCC was built to save this time. It does all the checking and gives you the result of all the checks in a single screen. But JCC offers a lot more: Check on regular intervals. So you will be alerted that there is a problem, even before you got a call from your client. Prevent incidents by taking actions if a threshold is reached. Define actions that can be done with a check, so that a single click of your mouse will initiate the action. For instance starting a process that was stopped. Monitor response times. Create statistics of the performance, status and result of your checks Create real-time, dynamic graphs Automate (simulate) a web session. This can be used to check availability and performance. But it can also be used to do an automated conversion of some application data! JCC Userguide 1.10 6 System Requirements The program is packaged as a Windows program. You will need java 1.6+ to run JCC. Because the program is written in java, you can also try it on another platform. It will also run on Mac OS X or Linux. But on these platforms, you have to start it from the command line. JCC was developed in first place to test our CA Clarity application on Unix (Linux, AIX ) with an Oracle database. That is why this platform is most supported and tested. Installing Java JCC needs java 1.6+ . The software is tested with java 1.6 and java 1.7. If you do not have java installed and did not download a JCC distribution with java , then you have to download it apart. A java runtime environment (JRE) can be downloaded from http://java.com/nl/download/ In Unix, Linux or Mac OS you use a shell script to start JCC. An example script can be found in the JCC directory. It is called jcc.sh. This script should have execute permissions. If you want to use a dedicated JRE then you can change the path to the java JRE in the script. In Windows you can use jcc.bat file, but most convenient is to start JCC from the executable JCheckCenter.exe. This executable uses the WinRun4J java launcher. The launcher settings are in a plain text file JCheckCenter.ini. The launcher will look for the standard JRE, but you can change this by editing the file with a plain text editor (notepad, XMLSpear). Personally I always use a dedicated, embedded, JRE which I have copied into the JCC directory. Then I point the launcher to this JRE by adding the property vm.location to the JCheckCenter.ini file. This property must point to the jvm.dll. Example: classpath.1=. classpath.2=lib\jccplugins\*.jar classpath.3=lib\*.jar classpath.4=lib\apache-commons\*.jar classpath.5=lib\apache-xerces\*.jar classpath.6=lib\substance\*.jar classpath.7=lib\freechart\*.jar classpath.8=lib\bo\*.jar working.directory=. log=logs\app.log log.roll.size=5 JCC Userguide 1.10 7 log.level=info #splash.image=splash_jcc.gif main.class=com.donkeydevelopment.checkcenter.main.Loader vm.location=jre7\bin\client\jvm.dll The launcher is only tested with a 32 bit java JRE. Usage It is up to you to create one or more checklists. In most cases you will make a checklist for each environment: development, test, acceptance and production. But in fact it is totally up to you, how you define or organize your checklists. A checklist is represented by an xml configuration file which must be placed in the configuration directory of JCC. How you can configure a checklist will be described in the next chapter. Quickstart You can take look at a simple checklist like the SQLQuery test. This test can be found in configurations/02_TestQuery.xml . Change the connection parameters for your database. If you got variables in the configuration then do not forget to bind real values to them. This can be done in the JCC app. This example connects to an Oracle database. If you want to connect to another type of database, then drop an appropriate jdbc driver in the JCC lib directory. Develop your own checks. This applies to java developers only. JCC comes with a lot of build-in checks, but you can extend JCC by developing your own kind of checks and drop them in as plug-in. Maybe you have the need for a total new check, something that is not available in JCC yet. You can think of every kind of check: the number of messages in your mailbox, the temperature in your town or the price of your share . It is easy to develop your own checks, even if you are starting java developer! Download the eclipse project from the website and start developing now! JCC Userguide 1.10 8 User Interface 1 2 3 4 5 The GUI has 5 main parts: 1 Top screen Here you have an Environment pick list which lets you choose a configured check list. The right part of this screen, can be used to display a graph which is configured in the check list. This graph will real-time be updated, if there is new data available from running checks. Between the top screen and the toolbar is a divider bar. You can drag this divider to adjust the size of the top screen. 2 Toolbar Immediately starts executing selected checks. Select all checks in this list Deselect all checks in this list Clears result column of all checks Shows a submenu for displaying graphs See “Graph submenu” for more information. Toggle sound off/on. If you do not see the red cross , then sound is on and you will hear a beep if one or more of the checks failed. Shows a popup screen where you can give values to all variables found in any configuration check list See the paragraph “Passwords and Variables” in the Configuration chapter for more information. JCC Userguide 1.10 9 Personal settings for GUI and behavior See “Personal settings” for more information. Show version history (including registration) and available checkers See “Version information and registration” for more information. Graph submenu If you click on the graph button then JCC shows a submenu with the next choices: Show Embedded Graph Shows a list of configured graphs ; see the paragraph “Statically embed a graph” Overview Performance Shows a performance graphs of the selected checks in this checklist. Overview Status Shows a status graphs of the selected checks in this checklist. Overview Results Shows a result graphs of the selected checks in this checklist. If you click on one of the overview submenus, then you will get a chronological list (youngest first) of all available statistical data. Now you can choose one of the available files. You can also select a block of continuous files. Press ok and the graphs are showed with the data of the selected files. It will show only the graphs of the checks that are actual selected in JCC at this moment. JCC Userguide 1.10 10 Personal settings If you click on the personal settings button then JCC.will show a panel. Most of the settings are self-explaining. You can try them out. Some users do prefer not flashing the application icon, because this can be distracting or force JCC to get focus while busy in another application. JCC Userguide 1.10 11 You can choose different skins. The Nimbus Look and Feel is the standard look and feel. Example of Raven JCC Userguide 1.10 12 Version information and Registration If you click on the info button then JCC.will give you a popup with two choices: Version info & Registration Available checkers The version info will show a panel with information about changes and fixes. The top of the panel gives you information about the registration of the software. If your software is registered, then the information contained in the license key will be displayed. If your copy is not registered then the software will have some limitations: JCC Userguide 1.10 13 - Personal settings will not be stored You may have a maximum of 5 selected checks in the check list You cannot display history graphs Please visit the website http://www.donkeydevelopment.com/jcc/jcc.htm to find more information about the registration of the software. JCC Userguide 1.10 14 3 check list table There are 4 columns. column description Selected a check button. If selected then this check will be executed. Also imported for the overview graphs, because only graphs of selected checks will be showed. Shows the result of a check. Exactly this value will also written to the statistic file, if you set logResult to true in the configuration of the check. There is also a magnifier glass which will shows you more information about the excecution of this check. Some checks have extra buttons in this column to perform specific actions. The description of the check shows a graph with response times of the check shows a graph with status results of the check shows a custom graph for this check shows a standard result graph for this check See the graphs section in the Configuration chapter for more information. Result Description Graphs 4 Timer panel The timer panel lets you schedule the checks after a time interval. The time till the next execution is showed on the left side in the black-green digital clock. It is also showed in the progress bar. To start the timer, press the green ball, which will turn into green when the timer is active. To stop the timer, press the red ball. There is also a button to reset the timer and a button to set timer options. JCC Userguide 1.10 15 If “Initial Start” is on, then the checklist will be executed right after you press the green button. If it is off, then the checklist will start after the interval has passed. On the left of the timer panel, you see the 5 Status bar In the bottom of the screen, there is a status bar that shows information about the action that is executing. JCC Userguide 1.10 16 Configuration General Structure Configuration files are xml files that are stored in the configurations directory of JCC. Each configuration file contains a series of tests (checklist) . In JCC you will pick and execute the checklist of your choice. The best way to create a new configuration file is, by opening an existing configuration and save it with a new name in the configuration directory. The structure of a configuration file looks like this <configuration> <statistics><notificationMail>notificationMail <graph>graph <checkList> <checker> <check> <check> </checker> <checker> <check> <check> </checker> </checkList> </configuration> In this document we will use my xml editor XMLSpear for editing xml files. JCC Userguide 1.10 17 JCC Userguide 1.10 18 Element <configuration > <configuration environment="HelloWorld" color="green" description="Test HelloWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/jcc.xsd"> The values of environment, color and description are reflected in JCC The path in xsi:noNamespaceSchemaLocation should point to the JCC schema file which will be used to check the syntax of the configuration. This path is relative to the path of the configuration file: that is why you should first save the configuration file into the configuration directory. Now you can test the syntax in XMLSpear by first selecting xsd as the schematype. And then pressing the green validation button. JCC Userguide 1.10 19 Now your content will be checked while you are typing. In the table editor of XMLSpear you will have some extra support: for certain elements it will display a list of allowed values. Note: The schema checking is willl give a good indication that your configuration file is valid. But not all things are checked. Element <statistics > <statistics> <outdir>H:\My Documents\JCheckCenter\Statistics\HW</outdir> <datePattern>_yyyy-MM-dd</datePattern> </statistics> The statistics element describes the file location for the statistical data. element <outdir> description This should be an existing directory where the statistical data is stored <datePattern> This will be used as the suffix for the statistical files. The statistical data is written in as a csv file to the directory. The filename for the statistics file is constructed by concatenating : “globalstats_”+ value of the attribute configuration/@environment + value of element statistics/datePattern. In our example , we see the following files in the directory H:\My Documents\JCheckCenter\Statistics\HW: When we display the content of a file JCC Userguide 1.10 20 The first line is a headerline. The next lines contain the detail data. JCC wil standard log the status and elapse time of each check in the configuration. Note 1: If you make changes in the checklist configuration that cause structural changes in the statistical file, you should delete the current one. For example when you add another test with id HW2, then some extra columns need to be written to the globalstats file: "HW2 Status";"HW2 Time". This columns will not be written to an existing globalstat file that has not yet this new columns. So in this case you have to delete the current used globalstat file. Note 2: The next checkers use the statistical directory to write extra detailed performance data: DQLChecker HTTPChecker HTTPSessionChecker QueryChecker These detailed performance data files are named like: stats_<check/id> _yyyy-mm-dd.csv JCC Userguide 1.10 21 Element <notificationMail> Example: <notificationMail enable="true"> <ewsConnection debug="true"> <serviceUri>https://spxxx. mydomain.net/EWS/exchange.asmx</serviceUri> <user>${CEDS_KEY}</user> <password>${CORPORATE_KEY_PW}</password> <domain>mydomain</domain> <proxy enable="false"> <host>127.0.0.1</host> <port>8888</port> <domain>mydomain</domain> <user>${CORPORATE_KEY}</user> <password>${CORPORATE_KEY_PW}</password> </proxy> </ewsConnection> <recipients> <onSucces> </onSucces> <onError> <to freq="300">[email protected]</to> <cc freq="300">[email protected]</cc>--> </onError> </recipients> <from>xxxx </from> <subject>Subject</subject> </notificationMail> JCC Userguide 1.10 22 NotificationMail is an optional element that can be used to instruct JCC to send email messages on completion of a check list. Within this element you specify the connection to the mail server and the recipients of the message. The mail will show the results of the active checklist and the embedded graph. So it will look like the output you see on the screen. JCC supports two types of mail server protocols. You can either specify a connection to a microsoft exchange server using the webservice api or you can use a smpt mail server. <notificationMail> Element /@attribute @enable required description element./attr yes boolean value to indicate if the mail notification is active. <ewsConnection> or <smtpConnection> yes <recipients> <from> <subject> yes no no type of connection to the mailserver <ewsConnection> to use an exchange web service. <smtpConnection> to use a smtp mail server receivers of the message sender of the mail. Only used in the smtp protocol to prefix the subject that is filled in by JCC <notificationMail/ewsConnection> Element /@attribute description @debug required element./attr no <serviceUri> <user> <password> <domain> <proxy> yes yes yes yes no Uri of the exchange web service Username Password Domain Web proxy boolean value to activate tracing The serviceUri can be found in your Microsoft OutLook. Go to File->Info -> Account Settings. Here you will see the URL for internet access to your mail account. Click the URL and you will enter Office Outlook Web Access. The url will looks something like https://xxxxxx/owa. Change the url by replacing /owa by /ews/exchange.asmx and press enter. You will be redirected to an URL: https://xxxxxx/ews/Services.wsdl and see all available web services. Use the https://xxxxxx/ews/exchange.asmx as the serviceUri in the configuration. <notificationMail/ewsConnection/proxy> Element /@attribute @enable JCC Userguide 1.10 required element./attr no description boolean to indicate if the configured proxy should be used 23 <host> <port> <user> <password> <domain> yes yes no no no Proxy host address Proxy portnumber Proxy user Proxy password Proxy domain <notifcationMail/smtpConnection> 1 Element /@attribute description @debug required element./attr no <host> <port> <tls> <user> <password> yes yes no no no Smtp mail host Smpt mail port Booleand : Use Transport Layer Security (TLS) Username password boolean value to activate tracing <notifcationMail/recipients> 2 Element /@attribute <onSucces> <onError> required element./attr no no description List of recipients notified in case of success List of recipients notified in case of failuree <notifcationMail/recipients/onSuccess |onError> 3 Element /@attribute <to> <cc> JCC Userguide 1.10 required element./attr no no description Email address of To recipient Email address of Cc recipient 24 <to> | <cc> 4 Element /@attribute @freq required element./attr yes @autoReset @delay no no description Integer value representing the minimum time in seconds between sending a message to this recipient Boolean : reset the last send time Boolean: start sending messages after delay Example <recipients> <onSucces> <to autoReset="true" delay="true" freq="36000">[email protected]</to> </onSucces> <onError> <to autoReset="true" delay="true" freq="36000">[email protected]</to> </onError> </recipients> In case of success a message will be send to email [email protected]. The frequency is set to 36000 seconds, which means that only 1 per 10 hours a message is sent. Because “autoReset” is on, the last message time is reset when the checklist fails because one of the checks failed. So the next success status after an error status, will result in a new message. Because delay is on, the last message sent time will be set to the current time. So you will not get a message when the first execution of the check list is a success. In case of error a message will be send to email [email protected]. The frequency is set to 36000 seconds, which means that only 1 per 10 hours a message is sent. Because “autoReset” is on, the last message time is reset when the checklist succeeds. So the next error status after a success status, will result in a new message. Because delay is on, the last message sent time will be set to the current time. So you will not get a message when the first execution of the check list is a failure. So above configuration only sends messages after a change of the checklist status. If you set your own email address in the onError/to and onSucces/to in the way above, it is a perfect configuration to only (once) be notified if something has changed. JCC Userguide 1.10 25 Element <graph> The <graph> element inside the <configuration> element is used to configure an embedded graph. See the chapter about graphs and more specific about static embedded graphs for more information. Element <checker> Describes a java module that can perform a check. Each checker has its own functionality and can ownly perform his own specific checks . Element /@attribute @className description The java class that performs the checks <check> One or more checks can be configured. See next paragraph JCC Userguide 1.10 26 Element <check> Describes the check that will be performed. All checks have some common elements, that we be present in all checks. Element /@attribute @className Required yes description The java class that incorporates this checks <id> yes <name> <selected> yes yes <logResult> no Identifcation of the check; must be unique across this configuration. which will be displayed in JCC Boolean which specifies if the check will be executed. This is the checkbox before each check in JCC Boolean which specifies if the result will be written to the statistics file. See the graph chapter for more info Boolean which specifies it this check is significant. If the check fails and the ignoreInTotalResult is set to true, then this error is not counted in the final result. Boolean which specifies it all following checks must be skipped when this check fails. Defines a custom graph. See the custom graph chapter. Within the data element you must specify the elements specific for this check . It is possible to configure one or more action buttons for a check. <ignoreInTotalResult> No <exitOnError> no <graph> <data> no yes <actionList> No Element <actionList> Describes the actions that can be executed for this check. JCC will make the actions available by placing icon buttons in the check row. At this moment there are two known implementations of actions that can be configured on a check: SSH CommandConfiguredAction and SSH ScriptConfiguredAction. These actions can be configured on any check. Beneath an example of checks that have configured actions with start and stop buttons. JCC Userguide 1.10 27 Note: If you execute an action and the associated check is marked active executed automatically after the action is completed. then the check will be re- Element /@attribute @className Required description yes The java class that incorporates this action <name> yes <description> yes <icon> no <data> yes Name of the check. Will be displayed as title of the wait dialog while this action is running which will be displayed in JCC as tooltip text when cursor moves on icon. Note: table cell must have the focus (click in the cell) to display the tooltip text The filename of the icon. JCC will search for this file in the icons directory of JCC Within the data element you must specify the elements specific for this action . JCC Userguide 1.10 28 Passwords and Variables It is possible to replace static xml values with variables. Suppose you need to configure a username and password in a check: <data> <patternCheck> <connection> <hostname>myhost.net</hostname> <username>joe</username> <password>pass123</password> </connection> <command>echo 'Unix password ok'</command> <pattern>ok</pattern> </patternCheck> </data> You can create variables for the username and password. <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> JCC will treat each value or part of a value, that begins with ${ and ends with } as a variable. You should give a value to a variable in JCC. To give a value press the manage variables icon in the toolbar of JCC. You will get a table with the variables found in all configuration files. JCC Userguide 1.10 29 You can see that the variables ending with _PW are treated as confidential information. If you press Ok, the JCC will be restarted. Note: JCC will only load the configuration files (checklists) during its start. That means that modifications in existing checklists or new checklists are not seen by JCC while it is running. To reload the complete configuration you must exit and start JCC again. But a faster way to accomplish the same, is pressing Ok in the variables popup screen. JCC Userguide 1.10 30 Standard Graphs Each check has two standard graphs: a time and a status graph. In the graphs column, you will always see the buttons to display these graphs. When you press he clock icon, you will get a graph with response times of past executions. When you press the flag icon, you will see a graph of the successes or failures of past executions. Sometimes you will see a third icon: This will only show up for checks configured with <logResult> set to true and with a type attribute within the <logResult> element that has a value “integer”or “float”. Example: <logResult type="integer">true</logResult> In fact you are telling with the above line that you want to log the results of the check to the statistics file and you are also specifying that the output of the check (= result) is an integer number. Now JCC can automatically draw a standard graph for you with , with the results in the Y-axis (range. Note: you need at last two executions get a meaningfull graphs. Custom graphs In some situations, the standard graph is not good enough, e.g. You want draw more than 1 series of values. You want to change the title or descriptions in the graph You have to parse the output of a test for the result value You want to combine the results from several checks into one graph. In these cases, you need to configure a special <graph> element. Example <check className="com.donkeydevelopment.checkcenter.check.ssh.pattern.PatternCheck"> JCC Userguide 1.10 31 <id>SSH_CPU_VLS111</id> <name># CPU's used by Database server</name> <selected>true</selected> <logResult>true</logResult> <graph> <title>VLS111 CPU usage</title> <labelX>Time</labelX> <labelY>used cpu's</labelY> <showLegend>true</showLegend> <rollOverInterval>0</rollOverInterval> <rangeMarker> <color> <red>0</red> <green>128</green> <blue>0</blue> </color> <from>0</from> <to>2</to> </rangeMarker> <serie> <name>last minute</name> <colname>SSH_CPU_VLS111 Result</colname> <coltype>float</coltype> <colvalue>[0-9,\.]+(?=\s+\(1-min)</colvalue> <decimalPointIsComma>false</decimalPointIsComma> </serie> <serie> <name>last 5 minutes</name> <colname>SSH_CPU_VLS111 Result</colname> <coltype>float</coltype> <colvalue>[0-9,\.]+(?=\s+\(5-min)</colvalue> <decimalPointIsComma>false</decimalPointIsComma> </serie> <serie> <name>last 15 minutes</name> <colname>SSH_CPU_VLS111 Result</colname> <coltype>float</coltype> <colvalue>[0-9,\.]+(?=\s+\(15-min)</colvalue> <decimalPointIsComma>false</decimalPointIsComma> </serie> </graph> <data> <patternCheck> <connection> <hostname>vls111.xx.net </hostname> <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> </connection> <command>top -b -n 1 | grep 'load average' | awk '{print $(NF-2), " (1-min) ", $(NF-1)," (5-min) ", $(NF), " (15-min) "}'|sed 's/\,//g'</command> <pattern/> </patternCheck> </data> </check> JCC Userguide 1.10 32 Take a look at the configuration and the graph which was produced by it. Most configured elements are obious. <showLegend>: use “true” to show a legend just beneath the X-axis.The legend decribes each serie in the graph. In the example above : use “false” to suppress a legend just beneath the X-axis. This will save some space when displaying the graph in the JCC main screen. <rollOverInterval>: You have specify a positive integer value as the number of seconds. This is the time interval which will be displayed on the X-axis. If you specify <rollOverInterval>0</rollOverInterval> or omit the <rollOverInterval> element, then the total available period will be displayed. Note: You cannot adjust the interval in JCC itself. So most graph configuration will not specify the rolloverInterval element at all, and just display all available data. The <serie> element needs some extra explanation. You can declare 1 or more series. In each serie you have to define which values must be displayed. JCC Userguide 1.10 33 Let’s take a look at 1 of the series. <serie> <name>last minute</name> <colname>SSH_CPU_VLS111 Result</colname> <coltype>float</coltype> <colvalue>[0-9,\.]+(?=\s+\(1-min)</colvalue> <decimalPointIsComma>false</decimalPointIsComma> </serie> element <name> description will be displayed as part of the legend <colname> this refers to the output of check, which can be either the time , status or result. You must specify the id of the check, followed by a space , followed by “Time“ or “Status” or “Result”. Type of the value that is displayed in the graph (integer,float,timeMs,status) <coltype> <colvalue> Optional regular expression to extract the graph value from the result. <decimalPointIsComma> True if the comma is used as decimal point If you take a look at the globalstats csv file which is written in the statistics out directory, you will find all colum names and the values that were written for this column. So you can actually check if the <colname> is present in the file and take a look at the results values. In this case the <colname> is referring to the result value of a check with id “SSH_CPU_VLS111”. In this check we are referring to the result of the command: top -b -n 1 | grep 'load average' | $(NF), " (15-min) "}'|sed 's/\,//g' awk '{print $(NF-2), " (1-min) ", $(NF-1)," (5-min) ", The result will look like : 0.00 (1-min) 0.00 (5-min) 0.00 (15-min) Out of this result we want to extract the value for the 1-minute column. This is accomplished by a regular expression in the <colvalue> element. You do not need the <colvalue> element if the value is already of the type you specified in the <coltype> element. For instance : if you had the command top -b -n 1 | grep 'load average' | awk '{print $(NF-2)}'|sed 's/\,//g' The result will look like : 0.00 The output of this command is already a float . In this case you should omit the <colvalue> element. Another simple example which uses the time result of a check with id “loginSession”: <serie> JCC Userguide 1.10 34 <name>elapse</name> <colname>loginSession Time</colname> <coltype>integer</coltype> <decimalPointIsComma>false</decimalPointIsComma> </serie> Note: For custom graphs you still need to configure a <logResult> element with a value true . <logResult>true</logResult> Embedded Graph It is possible to have one graph always on top in the JCC screen. Dynamically embed a graph You can right click a graph icon (either time, status or custom graph icon) A popup will be showed. You can click the action “Show graph in frame” . This will embed the graph in the main JCC screen. You can only embed one graph. If you choose another one, then the existing graph will be replaved by the new one. After a restart of JCC , the dynamically embedded graphs will be lost. JCC Userguide 1.10 35 Statically embed a graph You can configure an embedded graph in the configuration, so that it will always be showed in the JCC top screen. This is different from a dynamically added graph which is only available in the current session and will be lost when you restart JCC . To configure an embedded grapgh, add the <graph> element as a child element of the <configuration> element , just behind the <statistics> element. You can add more than 1 <graph> element. The first one will be loaded by default. You can choose another one in JCC by pressing the graph taskbar icon, and choose another graph. Example configuration <?xml version="1.0" encoding="UTF-8"?> <!-- created with XMLSpear --> <configuration color="green" description="Clarity Test" environment="Clarity_Test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/jcc.xsd"> <statistics> <outdir>H:\My Documents\JCheckCenter\Statistics\Clarity_Test</outdir> <datePattern>_yyyy-MM-dd</datePattern> </statistics> <graph> <title>Clarity login</title> <labelX>Time</labelX> <labelY>Time</labelY> <showLegend>false</showLegend> <rangeMarker> <color> <red>0</red> <green>128</green> <blue>0</blue> </color> JCC Userguide 1.10 36 <from>1000</from> <to>2500</to> </rangeMarker> <serie> <name>elapse</name> <colname>loginSession Time</colname> <coltype>integer</coltype> <decimalPointIsComma>false</decimalPointIsComma> </serie> </graph> <checkList> …………. <rollOverInterval>: It has no use to specify a rollOverInterval for an embedded graph. It will always default to 2 minutes interval. You can adjust the rollOverInterval in the JCC gui. On the left of the embedded graph you have a pick list with some intervals. JCC Userguide 1.10 37 HTTPChecker Purpose HTTPChecker can be used to test a single URL. It is a very simple test with a minimum of configuration options : url, timeout and verifyHostname. You cannot configure anything else: no timeout setting , proxy , etcetera, response. For more options you should use the HTTPSessionChecker . Configuration There are three elements : <url> : connect to the URL specified <timeout>: value that specifies milliseconds to wait for a response <verifyHostname>: only applicable for secure connections. Check if the CN (common name) in the certificate matches the domain in the URL. JCC Userguide 1.10 38 Result The response body of the request will be showed in the JCC result column. Detailed statistics The HTTPChecker writes detailed performance data to the directory configured in the <statistics> element. The data will be written to a csv file, named: stats_<check/id> _yyyy-mm-dd.csv . In the screenshot below you see the file stats_HTTP_1_2013-11-07.csv, whis is written for a HTTP check with an id equal to “HTTP_1”. The file contains the following information for each check: Fieldname JCC Userguide 1.10 description 39 DateTime Start time of check Status Result status of the check Total Genuine Time Summed time of actions to perform this request Connection Time Time to establish connection Total Fetch Time Time to fetch all bytes Number of bytes Number of bytes in the response JCC Userguide 1.10 40 HTTPSessionChecker Purpose HTTPSessionChecker can be used to (re-)play a web session. The easiest way to create a valid xml configuration is to record a web session with the freeware application Fiddler. Fiddler is web debugger tool which sits between the http client (in most cases your web browser) and the web application. In fact it acts as a proxy and it can intercept web requests and responses. Record a web session I have used Fiddler to record web sessions with CA Clarity v12 and CA Clarity v13. Most experience is oden with version 12; but recent tests with V13 are giving positive results as well. No testing has been done with other web applications. In this example we will create a playback session which does a login to Clarity V13, shows the project list and does a logout. Start your web browser Start Fiddler (I have used Fiddler version 2.3.6.4) JCC Userguide 1.10 41 Type the URL of the application and enter Check in the Fiddler screen that your calls are captured JCC Userguide 1.10 42 Type your userid and password in the Clarity Login screen and enter JCC Userguide 1.10 43 Go to projects JCC Userguide 1.10 44 Logout again by clicking Logout in the right upper corner. You have now recorded a complete web session. Go to Fiddler and check if there all captured requests belong to your session. JCC Userguide 1.10 45 Now you have only the request that start /niku JCC Userguide 1.10 46 Export the session JCC Userguide 1.10 47 Choose Visio Studio Web Test as the format Click next Save your script Select all filters to skip all calls that are not relevant. You now have a file, in my case, called ProjectList.webtest. JCC Userguide 1.10 48 Convert the recorded session to a valid configuration We have to convert this file to a valid configuration file which can be used by JCheckCenter. Project.webtest is an xml file. We can transform this file using xslt to a valid configuration file. Start XMLSpear And open the stylesheet convertFiddler_to_JCC.xslt. You have to change the value of some variables in the top of the stylesheet. <xsl:variable name="v_config_description">your description</xsl:variable> <!-- give a short name for this configuration--> <!-- This name will be listed in the JCC selectlist to choose your configuartion--> <xsl:variable name="v_config_environment">your_environment_or_name</xsl:variable> <!-- give a unique name for this check--> <xsl:variable name="v_check_id">check_id</xsl:variable> <!-- give a short description for this check--> <xsl:variable name="v_check_name">check name</xsl:variable> Important You also have to change the output directory for statistical data to a directory that is existing on your computer. You can find the statistics element as first child of the configuration element. <statistics> <outdir>H:\My Documents\JCheckCenter\Statistics\Example</outdir> <datePattern>_yyyy-MM-dd</datePattern> </statistics> JCC Userguide 1.10 49 After the changes Press the play button in the toolbar to start the conversion JCC Userguide 1.10 50 Choose the just recorded fiddler web session export file as input. And choose XML Editor as output option Press OK A new tab will occur with the output of the conversion JCC Userguide 1.10 51 Save the configuration by clicking on the Save As floppy icon As you see in the screenshot above, the file is saved in the configuration directory of JCC. Save the file with extension .xml. You can validate the script for error against a schema. JCC Userguide 1.10 52 Choose the xsd bullet and press the green validation button. No errors were found Now we are ready to test our session script in JCC. Test your session script Start JCC Choose the configuration you have just created from the popup list. JCC Userguide 1.10 53 I have called it Clarity13_FAT_ProjectList (see attribute environment=” Clarity13_FAT_ProjectList” in configuration file). Now you will presented the configuration you made. JCC Userguide 1.10 54 It has only one check in it; this is the web session which we recorded. You can see that the descriptions origin from the values in the configuration. Press the green play button to start the session test. If the test runs successful a green check icon will be displayed. You can press the magnifier glass for details. JCC Userguide 1.10 55 The time graph will still show an empty graph. To get a graph, the test must have run at least two times. So press the green play button again. If the test has finished for the second time, then press the time icon for a the performance graph. JCC Userguide 1.10 56 Close the graph. Now right click on the time icon. And click the show graph in frame option. The graph is now showed in the main window. You can press the green schedule button in the bottom of the screen to run the test every time interval. And your graph will be updated automatically. Note: With you mouse you can select a part of the graph to zoom in. You can also right click for several other options. JCC Userguide 1.10 57 Refine your script We have a working script, but we can do several things to make it more robust. Replace static data First thing we do is to change some static data into variables. We will replace the username and password with variables. Open your configuration file with XMLSpear and do a find for “userName”. In the value element change the username value, which the user you entered in the login screen, to a variable: ${PRJ_LOGIN_KEY} and change the password value to ${ PRJ_LOGIN_KEY _PW}. So the snippet in the xml file looks like this: <namevalue> <name>userName</name> <value>${PRJ_LOGIN_KEY}</value> </namevalue> <namevalue> <name>passWord</name> <value>${PRJ_LOGIN_KEY_PW}</value> </namevalue> Notice that the notation of variables differs from the variable syntax in xslt : ${name} instead of {$name} JCC Userguide 1.10 58 Press Save. If JCC is still open, then quit the JCC application because the changed configuration will only loaded during a new start of the program. Start JCC. Press the manage variables button in the toolbar You will all variables that are found in any configuration file. Look for the variables you just created. And do fill in the right values. Press OK. The application will restart (this is also a workaround to reload configuration files without quitting and starting manually). After JCC is restarted, then choose your configuration again and re-test your script in JCC. But how can we check that it is actually doing what we think it is doing. JCC Userguide 1.10 59 There are several ways to do this. Using Fiddler to test your script You can use Fiddler again to intercept the calls. I personally only do this sometimes after I have created a new script. I have configured Fiddler to listen on 8888 Now we must add this proxy to the test in our projectlist configuration file. Add the proxy snippet to your config: <check className="com.donkeydevelopment.checkcenter.check.httpsession.HTTPSessionCheck"> <id>PRJ_SESS_01</id> <name>ProjectList Session</name> <selected>true</selected> <data> <httpSessionCheck> <session trustAll="true" verifyHostname="false" ignoreErrors="true"> <proxy> <host>127.0.0.1</host> <user></user> <password></password> <port>8888</port> </proxy> <request autoredirect="true" method="GET" name="1"> Save the configuration and restart JCC (tip: use the manage variables popup and press OK to restart ). JCC Userguide 1.10 60 Play your script again and you will see all requests and responses coming by in Fiddler Now you can inspect the responses and see that it is really acting the same as in the “real” original session that you recorded. Please comment or remove the proxy snippet to continue without Fiddler Using status and patterns to check your script The way you normally check the results of the requests is by predicting the results in your configuration script. In the response element you can predict the status code. I changed the response status in the request to url http://vls12012.europe.intranet:9000/niku/services/uif/GlobalNavigationService/GetNavigatorMenu Bean to 300: <stringBody>{GetNavigatorMenuBean: {}}</stringBody> <response> <status>300</status> <checkPattern/> <showPattern/> </response> JCC Userguide 1.10 61 Save the file and restart JCC If you still see a green icon, then check your configuration. <session trustAll="true" verifyHostname="false" ignoreErrors="false"> It is important that ignoreErrors is set to false. To do a valid test : Change the status from 300 to 200. You may choose to set the 200 return value for every request in the xslt stylesheet. In the response element you can also check for the presence of a specific pattern. In our example we will check the response from the login action. If you first recorded the session with Fiddler and examined the response it looked like this: JCC Userguide 1.10 62 If you view it in notepad you will find somewhere “Overview: General”. We can check for this pattern. We can also show the value after "fullname": in the response as a result of our test. To do this paste the following snippet in your configuration: <request autoredirect="true" method="POST" name="9"> <description>description of 9</description> <url>http://vls12012.europe.intranet:9000/niku/nu?uitk.vxml.form=1&action=security.loginAc tion&uitk.navigation.location=Workspace&uitk.navigation.parent.location=Workspace& uitk.navigation.last.workspace.action=homeActionId</url> <timeout>300000</timeout> <headers> <namevalue> <name>Proxy-Authorization</name> <value>Basic cHc3OGRzOkltb3ZpZTk4</value> </namevalue> <namevalue> <name>Origin</name> <value>http://vls12012.europe.intranet:9000</value> </namevalue> <namevalue> <name>Content-Type</name> <value>application/x-www-form-urlencoded</value> </namevalue> </headers> JCC Userguide 1.10 63 <parms> <namevalue> <name>userName</name> <value>${PRJ_LOGIN_KEY}</value> </namevalue> <namevalue> <name>passWord</name> <value>${PRJ_LOGIN_KEY_PW}</value> </namevalue> <namevalue> <name>redirectAction</name> <value>homeActionId</value> </namevalue> </parms> <response> <status>200</status> <checkPattern>Overview: General</checkPattern> <showPattern>(?<="fullname":").*(?=","userId")</showPattern> </response> You have the specify the patterns as “regular expressions”. Regular expressions are very powerfull but also difficult in syntax. The expression in the <checkPattern> element is simple. The expression in <showPattern> takes all characters between “fullname”:” and “,userId”. Ok let’s test our new configuration (save , restart JCC). This is the result: JCC Userguide 1.10 64 Advanced Configuration settings In our configuration we used trustAll =”true” and verifyHostname=”false”. These settings are only relevant in a secure url (https). With these settings we can bypass the certification checks for secure connections. It makes the configuration for this kind of connections a lot easier. The timeout setting may be important for very slow response calls. In our example we used a timeout setting of 300000, which is equivalent to 5 minutes. Result The result of the last executed <showPattern>will be displayed in the JCC result column. Detailed statistics The HTTPSessionChecker writes detailed performance data to the directory configured in the <statistics> element. The data will be written to a csv file, named: stats_<check/id> _yyyy-mm-dd.csv . In the screenshot below you see the file stats_PRJ_SESS_01_2013-10-02.csv, whis is written for a HTTPSession check with an id equal to “PRJ_SESS_01”. The file contains the following information for each check: Fieldname DateTime description Start time of check Status Result status of the check Total Genuine Time Summed time of actions to perform this request xx Time Time for request with name xx within this session. JCC Userguide 1.10 65 Xpath: //check[id=’PRJ_SESS_01’]//request[@name='xx'] xx Status JCC Userguide 1.10 Status for request with name xx within this session 66 QueryChecker Purpose QueryChecker can be used to execute a query against the database and test the results. QueryChecker is the most used tester in most configurations. You can check availability, performance , but also check the integrity of your data. In our CA Clarity monitoring configuration we have configured several queries against oracle system tables to monitor the active queries and detect long-running queries which may slow down the database performance. Configuration There are 4 important parts which are involved in the querycheck. The following screenshot is taken from a configuration xml, showing the structure of the data part of the querycheck. Database connection In the connection element you specifiy the settings for the database connection: <database> <connection> <!-- the database url --> <url>jdbc:oracle:thin:@localhost:1521:CLARITYDB</url> <!-- the database username --> <username>NIKU</username> <!-- * the database password --> <password>${CLARITYDB_NIKU_PW}</password> </connection> </database> The password is defined as a JCC variable, and a value for this variable will be assigned in the JCC variable popup screen. To get a connection to the database, JCC needs an appropriate JDBC database driver. An oracle driver is already bundled in the distribution. But other drivers need to added by yourself to the lib directory of JCC. For example: If you make a connection to a mysql database, you need to specify a proper url: <url>jdbc:mysql://localhost:3306/RAPPIDO</url> and you need to download the driver from http://dev.mysql.com/usingmysql/java/ JCC Userguide 1.10 67 Pattern In the <checkPattern> element you can specify a pattern test. <checkPattern> <active>true</active> <pattern>Deneer</pattern> </checkPattern> <active>: this is either true or false and specifies if this pattern test should be performed. <pattern>: This element will contain the regex (regular expression) pattern. The pattern will be searched in every result row of the sql query. The test will be positive if it there is a match found in at least one of the result rows. Row count In the <checkRowCount> element you can specify a test on the number of result rows. <checkRowCount> <active>false</active> <count>0</count> <operator>=</operator> </checkRowCount> <active>: this is either true or false and specifies if this row count test should be performed. <count>: predicted number of result rows. <operator> : used in the test on <count> SQL In the <sql> element you can specify the query. <sql> /* deze query checkt of er users zijn waarbij de sql trace aan staat */ /* dit geeft een performance penalty en vergroot de kans op het vollopen */ /* van de log directory */ select usr.USER_NAME, usr.LAST_NAME||', '||usr.FIRST_NAME, usr.SQLTRACE_ACTIVE from cmn_sec_users usr where usr.SQLTRACE_ACTIVE > 0</sql> Best way to configure a query is to test the query is an SQL database tool and then copy and paste it into the configuration. You should use the table editor of XMLSpear which will automatically replace xml reserved characters by xml entities. To do this: select the sql element in the table view of XMLSpear and press the red “return” arrow. See the screenshot below. JCC Userguide 1.10 68 Now you will get an editor popup, where you can paste the query. Result There is an “AND” relationship between the pattern and row count test. Both should pass to get a positive result. If you specified an active row count test, then the result column in JCC will always contain the number of rows returned. In all other cases, the result column is depends on the number of returned rows. If the result of the query gives exactly one row - Then JCC will show this result row - JCC will show “Test passed” or “Test not passed” else JCC Userguide 1.10 69 Example with a SQL pattern Test Eaxmple that explicitly returns the status from the SQL and using a pattern check to show the result. Configuration: <check className="com.donkeydevelopment.checkcenter.check.query.QueryCheck"> <id>Q5</id> <name>SQL Query explicitly returning pattern</name> <selected>true</selected> <data> <queryCheck> <database> <connection> <url>jdbc:oracle:thin:@localhost:1521:DBNAME</url> <username>user</username> <password>pass</password> </connection> </database> <checkPattern> <active>true</active> <pattern>ok</pattern> </checkPattern> <checkRowCount> <active>false</active> <count>1</count> <operator>=</operator> </checkRowCount> <sql> /* Deze query checkt of in een kort tijdsbestek een query heel vaak wordt uitgevoerd /* Aan hand van aantal rijen wordt de status bepaald die daarna in het pattern wordt afgevraagd */ select status || ' / ' || aantal_current from ( /* status */ select case when count(*) > 50 then 'error' else 'ok' end status FROM v$ACTIVE_SESSION_HISTORY WHERE sample_time > sysdate - 10/1440 AND sql_exec_start IS NOT NULL and sql_id in ('1sjt0cn13nbw7','gzruthkn2m8vd','7zcgr98wxfd6a') ) , ( /* aantal_current */ select count(*) aantal_current FROM v$ACTIVE_SESSION_HISTORY WHERE sample_time > sysdate - 10/1440 and sql_id in ('1sjt0cn13nbw7','gzruthkn2m8vd','7zcgr98wxfd6a') )</sql> </queryCheck> </data> </check> */ Result in JCC JCC Userguide 1.10 70 Detailed statistics The QueryChecker writes detailed performance data to the directory configured in the <statistics> element. The data will be written to a csv file, named: stats_<check/id> _yyyy-mm-dd.csv . In the screenshot below you see the file stats_Q14_2013-11-07.csv, whis is written for a query check with an id equal to “Q14”. The file contains the following information for each check: Fieldname DateTime description Start time of check Status Result status of the check Total Genuine Time Summed time of all database actions Connection Time Time to connect to the database Execute Query Time Execution time of the query Total Fetch Time Time needed to fetch results Number of rows Number of return rows JCC Userguide 1.10 71 SSH PatternChecker Purpose The SSH patternChecker is used to execute shell commands on a remote unix machine. The output of the command is tested against a configured pattern. SSH PatternChecker is a popular checker in environments with Unix servers. For example : you can test your services or CPU load with it. Configuration Below is a complete example of a SSH patterncheck. <checker className="com.donkeydevelopment.checkcenter.check.ssh.pattern.PatternChecker"> <check className="com.donkeydevelopment.checkcenter.check.ssh.pattern.PatternCheck"> <id>PW_UNIX</id> <name>Connect to unix for testing password</name> <selected>false</selected> <!—- if this check fails then stop and skip all following tests --> <exitOnError>true</exitOnError> <data> <patternCheck> <connection> <hostname>linux.mydomain.mynet</hostname> <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> <!—- optionally configure a private key file --> <!—- <privateKeyFile>path_to_keyfile</privateKeyFile> --> </connection> <command>echo 'Unix password ok'</command> <pattern>ok</pattern> </patternCheck> </data> </check> </checker> You have three important elements. <connection>: element where you specify the remote unix machine and the credentials. If needed in your environment , you can add on extra element <privateKeyFile > with the path to an existing keyfile. <command> : this is shell command. <pattern> : the output of the command will be searched for the specified pattern. The pattern must be regular expression. Result The result column in JCC will be filled with the output of the command. If there pattern is found in the output then the test is passed. JCC Userguide 1.10 72 JCC Userguide 1.10 73 SSH ScriptExecuter Purpose The SSH script executor is similar to the SSH PatternChecker. In some circumstances you can not use the patternchecker because you have to give some interactive response in your shell session. For example: you have to change to another user and must supply a password. This cannot be achieved with the SSH patternChecker. Configuration Connection You can configure a connection in the same way as you do using the SSH Patternchecker. <scriptCheck> <connection> <hostname> </hostname> <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> <!—- optionally configure a private key file --> <!—- <privateKeyFile>path_to_keyfile</privateKeyFile> --> </connection> . . . . . . . . </ scriptCheck > You can also make the connection a part of your command script. In that case you should leave out the complete <connection> part. Command script Below is a sample script. This script connects to a linux server. Switches to another user : niku Supplies the password Ask the status of the CA Clarity app service using : service Exits and disconnect. status app <command># Autogenerated script on Wed Jun 13 12:24:46 CEST 2012 ssh.connect("linux.mydomain.mynet", 22, "${CORPORATE_KEY_UNIX}", "${CORPORATE_KEY_PW}"); ssh.waitFor("> "); ssh.sendLine("sx su - niku"); ssh.waitFor("Password: "); ssh.sendLine("${CORPORATE_KEY_PW}"); ssh.waitFor("> "); ssh.sendLine("service status app"); print ssh.getLine(); ssh.waitFor("> "); JCC Userguide 1.10 74 ssh.sendLine("exit"); ssh.waitFor("> "); ssh.sendLine("exit"); ssh.disconnect();</command> Recording a SSH session Start a command shell ( Windows key + r , type cmd and enter) Change to the directory where JCC is installed Type the following command java -cp lib/* org.twdata.enchanter.Main -l -h <hostname> -u <username> -P <password> scriptfile.txt replace <hostname> by your unix server replace <username> by your unix login name replace <password> by your unix login password You will get logged in to your server. JCC Userguide 1.10 75 Do the actions you want to record. If you are ready then exit your session : type exit (as many times as needed) to return to the windows shell prompt and close the window. Edit the record actions Now open the scriptfile.txt with notepad or with XMLSpear. To make your script usable for other users: Replace the username with a JCC variable eg : Replace the password with a JCC variable eg : JCC Userguide 1.10 ${CORPORATE_KEY_UNIX} ${CORPORATE_KEY_UNIX_PW} 76 For more readability you can also simplify the ssh.waitFor statements that wait for an empty prompt. ssh.waitFor(“> “) is sufficient specific. There is one thing left. You want to capture the output from the command service status app because we want check it against our configured pattern. The output from the command is either: Niku Server [app] is running: PID:10333, Wrapper:STARTED, Java:STARTED Or Niku Server [app] is not running Because we have exactly one line of output we can easily put a getLine statement after the ssh.sendline(“service status app”); JCC Userguide 1.10 77 Capture output print ssh.getLine() : waits for a response and prints the line to the output. If you have two lines of output and you want them both in the output , you have to code : print ssh.getLine(); print ssh.getLine(); # print first line of ouptut # print second line of ouptut If you are only interested in the second line of output, you can code: ssh.getLine(); print ssh.getLine(); # swallow first line of output # print second line of ouptut Warning: If you have only one line of output and have coded two “getlines”, your script will stop at the second ssh.getLine() and wait forever. Another way to capture output is using the ssh.capture statement. Instead of: ssh.sendLine("service status app"); print ssh.getLine(); ssh.waitFor("> "); you can code: ssh.sendLine("service status app"); ssh.capture(1) ; #start capturing ssh.waitFor("> "); ssh.capture(0); #stop capturing JCC Userguide 1.10 78 Notice that capturing is stopped (ssh.capture(0);) after getting the empty prompt. The ssh.capture will send all captured lines, except the last captured line (which is the empty prompt) to the result. Pattern <pattern> : the output of the command will be searched for the specified pattern. The pattern must be regular expression. Result The result column in JCC will be filled with the captured output of the command. If there pattern is found in the output then the test is passed. JCC Userguide 1.10 79 PEChecker Purpose PEChecker checks the health of your Clarity process engines by checking the time of the last heartbeat in the table niku_mgr.bpm_run_process_engines. This check is much like a QueryCheck, which was developed afterwards and is a general purpose checker. PEChecker offers a convenient way to specify the maximum age of the last heartbeat. Configuration <checker className="com.donkeydevelopment.checkcenter.check.processengine.PEChecker"> <check className="com.donkeydevelopment.checkcenter.check.processengine.PECheck"> <id>PE-1</id> <name>Process engine vls12302</name> <selected>true</selected> <data> <peCheck> <database> <connection> <!-- the database url --> <url>jdbc:oracle:thin:@localhost:1521:CLARITY</url> <!-- the database username --> <username>NIKU</username> <!-- * the database password --> <password>${CLARITY_NIKU_PW}</password> </connection> </database> <process> <!-- this is the instance name found in table bpm_run_process_engines --> <name>bg-vls12302</name> <!-- maximum age last heartbeat --> <sql>SELECT CASE WHEN b.heart_beat is null THEN 1000 ELSE (SYSDATE - b.heart_beat) * 1440 --24 hours in a day * 60 minutes in an hour END AS elapse FROM niku_mgr.bpm_run_process_engines b WHERE b.instance_name = '@instance'</sql> <maxAge>5</maxAge> JCC Userguide 1.10 80 </process> </peCheck> </data> </check> </checker> Element /@attribute Required <database/connection> yes <process/name> yes <process/sql> yes <process/maxAge> yes description Contains <url>,<username> and <password> for the database connection instance name of the process engine you want to check; can be found in table bpm_run_process_engines Sql to get time of last heart beat of the process engine. This sql does not need to be changed Maximum interval in minutes after last heart beat. When the interval is greater the test will fail. Result The interval after the last heart beat will showed in the test result. When the interval is greater than the specified maxAge, the test will fail. JCC Userguide 1.10 81 LDAPChecker Purpose LDAPChecker checks the availability of your directory server by logging in to the specified LDAP server . Optionally you can configure a simple query to retrieve the attributes of a LDAP entry. Configuration <checker className="com.donkeydevelopment.checkcenter.check.ldap.LdapChecker"> <check className="com.donkeydevelopment.checkcenter.check.ldap.LdapCheck"> <id>CHK_1</id> <name>LDAP connection test.cds.mynet</name> <selected>true</selected> <data> <ldapCheck> <LDAP> <connection> <host>test.cds.mynet</host> <port>636</port> <anonymous>false</anonymous> <user>cn=ClarityAdmin,ou=clarity,ou=Services,o=DonkeyDevelopment</user> <password>${LDAP_CLAR_PW}</password> <!-- * This parameter is used to enable/disable SSL --> <!-- if using SSL always specify anonymous false --> <ssl>true</ssl> </connection> <query> <dn>uid=${CORPORATE_KEY},ou=people,o=ing</dn> <attributes> <attr>cn</attr> <attr>c</attr> </attributes> </query> </LDAP> </ldapCheck> </data> </check> </checker> The <connection> element is required and specifies the LDAP directory server. The <query> element is optional. If it is specified, then it should contain a <dn> element that specifies the distinguished name of LDAP entry, and a set <attributes> which contain the attributes <attr> that must be retrieved. The result values in the query can not be checked, they will only displayed in the detailed resultscreen. JCC Userguide 1.10 82 Result When the connection can be established, the result column will display the string “successful, otherwise the error will be displayed. The result of the query can be found in the detailed result screen, by pressing the magnifier glass in the result column. JCC Userguide 1.10 83 BOLoginChecker Purpose BOLoginChecker can be used to test if your Business Objects application is available by using the BO webservices (dswsbobje) to login and logout. The BO version will be displayed as result of the check Configuration <checker className="com.donkeydevelopment.checkcenter.check.bo.BOLoginChecker"> <check className="com.donkeydevelopment.checkcenter.check.bo.BOLoginCheck"> <id>CHK_BO_SPX1112</id> <name>Crystal Login</name> <selected>true</selected> <data> <boCheck> <connection> <host>SPX1112.mynet</host> <port>8080</port> <ssl>false</ssl> <domain>SPX1112:6400</domain> <secType>secEnterprise</secType> <user>claradm</user> <password>${BO_CLARADM_PW}</password> </connection> </boCheck> </data> </check> </checker> Element /@attribute <host> <port> <ssl> <domain> <sectype> Required description yes yes yes yes yes <user> Yes Business Object Server address Port If true then https will be used. Domain of this server One of: secEnterprise secWinNT secAD secLDAP secSAP secPSFT Login user JCC Userguide 1.10 84 <password> Yes Login Password The url to connect to the server will be constructed : http://host:port/dswsbobje/services/session. If ssl is true then https will be used. Result If the session is successful, then the BO version will be displayed in the result column. In the detailed result screen you will find more information. JCC Userguide 1.10 85 Required libraries The required Business Objects web services consumer API libraries (jar files) are not included in the package. JCC has been tested with the version 11.5.8 jar versions of the dsws jars . That version can be found in the META-INF of the jar files. This version is included in BOXI XI2 SP2 (not completely sure about that). The webservices java SDK originally contained following files: Size Date Needed Included in JCC axis.jar 1166769 YES YES commons-discovery.jar 71442 YES YES commons-httpclient.jar 225357 YES YES commons-logging.jar 31605 YES dsws.properties 185 YES YES (already on another place used) NO dsws-bicatalog.jar 50460 YES NO dsws-biplatform.jar 1070665 NO NO dsws-common.jar 112081 YES NO dswsmanagequeryasaservice.jar dsws-publish.jar 22803 18-01-2006 16:07:56 13-06-2003 10:27:58 10-10-2004 17:43:06 13-06-2003 10:27:58 25-01-2006 13:07:50 01-11-2007 04:58:20 01-11-2007 04:58:20 01-11-2007 04:58:20 01-11-2007 04:58:20 NO NO NO NO dsws-queryservice.jar 128026 NO NO dsws-reportengine.jar 146484 NO NO dsws-saveservice.jar 10920 NO NO dsws-session.jar 54189 YES NO jaxrpc.jar 35759 log4j.jar 352668 saaj.jar 18501 wilog.jar 19097 wsdl4j.jar 113853 xercesImpl.jar 1010806 01-11-2007 04:58:20 01-11-2007 04:58:20 01-11-2007 04:58:20 01-11-2007 04:58:20 01-11-2007 04:58:20 13-06-2003 10:27:58 11-05-2004 18:22:42 13-06-2003 10:27:58 01-11-2007 03:14:38 13-06-2003 10:27:58 20-02-2004 13:01:14 xml-apis.jar 124724 20-02-2004 13:01:14 YES File JCC Userguide 1.10 11254 YES YES YES (already on another place used) YES YES NO YES YES YES YES (already on another place used) YES (already on another place used) 86 This will eventally result in 11 files that should be in thelib\ bo folder Below is a screenshot taken of the jar files in the JCheckCenter\lib\bo folder. JCC was tested with the files in this screenshot. The red colored files are not included in the distribution of JCC. If you do not have the required jars one of the checklist in the configurations folder contains a BO Login Checks than the JCC will refuse to start. In the application log file, ypu will get an error like: ERROR 2014-03-05 12:41:32,606 [main] [com.donkeydevelopment.checkcenter.main.StartApp] – InvocationTargetException . . . . . . . . . . . . Caused by: java.lang.NoClassDefFoundError: com/businessobjects/dsws/session/Credential JCC Userguide 1.10 87 SSHSizeChecker Purpose SSHSizeChecker can be used to test if your unix filesystem has enough free space. Configuration Below is a complete example of a SSH patterncheck. <checker className="com.donkeydevelopment.checkcenter.check.ssh.size.SSHSizeChecker"> <check className="com.donkeydevelopment.checkcenter.check.ssh.size.SSHSizeCheck"> <id>SSH_SIZE_VLS12302_1</id> <name>VLS12302 diskspace /opt/CLARP</name> <selected>false</selected> <logResult>true</logResult> <graph> <title>VLS12302 diskspace /opt/CLARP</title> <labelX>Time</labelX> <labelY>% used</labelY> <rangeMarker> <color> <red>255</red> <green>0</green> <blue>0</blue> </color> <from>80</from> <to>100</to> </rangeMarker> <serie> <name>/opt/CLARP</name> <colname>SSH_SIZE_VLS12302_1 Result</colname> <coltype>integer</coltype> <colvalue>[0-9]+</colvalue> <decimalPointIsComma>false</decimalPointIsComma> </serie> </graph> <data> <sshSizeCheck> <connection> <hostname>vls12302.mynet</hostname> <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> </connection> <threshold>80</threshold> <directory>/opt/CLARP</directory> JCC Userguide 1.10 88 </sshSizeCheck> </data> </check> </checker> The blue section is optional, it is used to define custom graph of the result. See the chapter of (custom) graphs for more information about this part. You have three important elements. <connection>: element where you specify the remote unix machine and the credentials. If needed in your environment , you can add on extra element <privateKeyFile > with the path to an existing keyfile. <threshold> : the threshold is specified as a number. This number is interpreted as the maximum allowed percentage of used space (as ratio of the available space ). The checker will used the command “df –Pk “ on the specified directory. <directory> : the directory for which the available space will be checked. You can specify an empty value( <directory></directory>) to check all directories. If Result The result column in JCC will be filled with the output of the command. If you have specified a directory than the result will show : Used: xx%. The check will fail when the used percentage is above the specified threshold. If you specified an empty directory element, then the result will show the directory with the highest used space: The check will fail when the maximum used percentage found is above the specified threshold. You can press the magnifier glass in the result column for detailed information of the execution. JCC Userguide 1.10 89 DBChecker Purpose DBChecker checks the availability of your database by making a connection to the configured database. Though it is still available, this checker became obsolete when the QueryChecker became available. Configuration <checker className="com.donkeydevelopment.checkcenter.check.database.DBChecker"> <check className="com.donkeydevelopment.checkcenter.check.database.DBCheck"> <id>DB-1</id> <name>DB connection RN000:PCLARP01</name> <selected>true</selected> <data> <dbCheck> <database> <connection> <!-- the database url --> <url>jdbc:oracle:thin:@rn000.mynet:1521:PCLARP01</url> <!-- the database username --> <username>NIKU</username> <!-- * the database password --> <password>${PCLARP01_NIKU_PW}</password> </connection> </database> </dbCheck> </data> </check> </checker> Result When the connection can be established, the result column will display the string “successful, otherwise the error will be displayed. JCC Userguide 1.10 90 DQLChecker Purpose DQLChecker can do a check on your Documentum data by executing a DQL query against a docbase Configuration Example of a DQLCheck configuration <checker className="com.donkeydevelopment.checkcenter.check.documentum.DQLChecker"> <!--Run DQL queries--> <check className="com.donkeydevelopment.checkcenter.check.documentum.DQLCheck"> <id>DQL1</id> <name>Job check: Docu2store</name> <selected>true</selected> <data> <dqlCheck> <docBaseConnection> <host>SZ1234.mynet</host> <port>1489</port> <docBaseName>Docu2store</docBaseName> <username>${CORPORATE_KEY}</username> <password>${CORPORATE_KEY_PW}</password> </docBaseConnection> <checkRowCount> <count>0</count> <operator>=</operator> </checkRowCount> <dql>select r_object_id,a_last_return_code as status ,a_last_invocation as last_run, a_next_invocation as next_run, expiration_date as final_run, substr(a_current_status,1,87) as status_description, is_inactive as act, object_name as name from dm_job where ((expiration_date <= DATE('today')) and is_inactive = false) or (a_current_status not like '%Completed%' and a_current_status not like '%COMPLETED%' and a_current_status not like '%Finished%' and a_current_status not like '%STARTED%' and a_current_status not like '%In Progress%') and (is_inactive = false or inactivate_after_failure=true ) and ((DATEDIFF(week, a_next_invocation, DATE(TODAY)) <=2 and a_next_invocation is not nulldate)) order by is_inactive,a_next_invocation </dql> </dqlCheck> </data> </check> <checker> Specify the connection to the server. The number of result rows will be checked against the configured <checkRowCount> parameters. The <operator > is one of: GE >= GT > LE >= LT < EQ JCC Userguide 1.10 91 = Result The number of rows will be put in the result column. The test will be successful if the following is true: #result rows <operator> <count > In the detailed result screen , showed by pressing the magnifier glass, you will find more information over the executed check. All result rows will be displayed in this screen. Detailed statistics The DQLChecker writes detailed performance data to the directory configured in the <statistics> element. The data will be written to a csv file, named: stats_<check/id> _yyyy-mm-dd.csv . In the screenshot below you see the file stats_DQL1_2013-11-07.csv, whis is written for a DQL check with an id equal to “DQL1”. The file contains the following information for each check: Fieldname DateTime description Start time of check Status Result status of the check Total Genuine Time Summed time of all DQL actions getClientTime Time for the following two statements: IDfClientX clientx = new DfClientX(); IDfClient client = clientx.getLocalClient(); getSessionTime JCC Userguide 1.10 Time to get a session: 92 IDfSession session = client.newSession(qdocbaseName, loginInfo); ExecutionTime Excute query and get results Number of rows Number of return rows Required libraries The Documtentum libraries (jar files) are not included in the package. You can contact donkedevelopment for more information about the needed libraries. JCC Userguide 1.10 93 HelloWorldChecker Purpose HelloWorldChecker is a sample of a (third party) checker implementation. When you run this check, it displays the configured username in in the result. The checker also has a simple action. This action is not implemented as a configured action (like the SSH Script- and Command-ConfiguredAction ). This means the action is purely known by, and part of the HelloWorldCheck; it cannot be used in any other checks. Configuration The complete configuration is listed below. <?xml version="1.0" encoding="UTF-8" ?> <!-- created with XMLSpear --> <configuration color="green" description="Test HelloWorld" environment="HelloWorld" xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation="../xsd/jcc.xsd"> <statistics> <outdir>H:\My Documents\JCheckCenter\Statistics\HW</outdir> <datePattern>_yyyy-MM-dd</datePattern> </statistics> <checkList> <checker className= "com.donkeydevelopment.jcc.helloworld.HelloWorldChecker"> <check className= "com.donkeydevelopment.jcc.helloworld.HelloWorldCheck"> <id>HW1</id> <name>Say hello to the user</name> JCC Userguide 1.10 94 <selected>true</selected> <exitOnError>false</exitOnError> <data> <helloWorldCheck> <userName>Dick Deneer</userName> </helloWorldCheck> </data> </check> </checker> </checkList> </configuration> Result The result column will be filled with “Hello <username>”. Developer information The HelloWorldChecker will be made available as Eclipse java project and can be downloaded from the JCC site. JCC Userguide 1.10 95 SSH CommandConfiguredAction Purpose This action can be configured on any check to perform a shell command on a local or remote unix . Configuration Below is an example of a SSH CommandConfiguredAction. <checker> <check> ………… …….. </data> <actionList> <action className="com.donkeydevelopment.checkcenter.action.ssh.CommandConfiguredAc tion"> <name>Start Background</name> <description>Start Background server</description> <icon>player_play.png</icon> <data> <SSHCommandAction> <connection> <hostname>myhost.net</hostname> <username>${CORPORATE_KEY_UNIX}</username> <password>${CORPORATE_KEY_PW}</password> </connection> <command>sx -u niku /appl/CLARP/clarity/bin/niku start bg</command> </SSHCommandAction> </data> </action> </actionList> …… …….. <check> </checker> You have two important elements. Element /@attribute < connection > Required description yes < command > yes element where you specify the remote unix machine and the credentials. If needed in your environment , you can add on extra element <privateKeyFile > with the path to an existing keyfile. this is shell command Result If check containing this action is marked active automatically after the action is completed. JCC Userguide 1.10 then the check will be re-executed 96 SSH ScriptConfiguredAction Purpose This action can be configured on any check to perform a shell command on a local or remote unix . Configuration Below is an example of a SSH ScriptConfiguredAction. <checker> <check> ………… …….. </data> <actionList> <action className="com.donkeydevelopment.checkcenter.action.ssh.ScriptConfiguredAction "> <name>Start Background</name> <description>Start Background server</description> <icon>player_play.png</icon> <data> <SSHScriptAction> <command> # Autogenerated script on Wed Jun 13 12:24:46 CEST 2012 ssh.connect("myhost.net", 22, "${CORPORATE_KEY_UNIX}", "${CORPORATE_KEY_PW}"); ssh.waitFor("> "); ssh.sendLine("sx su - clarity"); ssh.waitFor("Password: "); ssh.sendLine("${CORPORATE_KEY_PW}"); ssh.waitFor("> "); ssh.sendLine("niku start app"); ssh.capture(1); ssh.waitFor("> "); ssh.capture(0); ssh.sendLine("exit"); ssh.waitFor("> "); ssh.sendLine("exit"); ssh.disconnect(); </command> </ SSHScriptAction> </data> </action> </actionList> …… …….. <check> </checker> You have two important elements. Element /@attribute < connection > Required description yes < command > yes element where you specify the remote unix machine and the credentials. If needed in your environment , you can add on extra element <privateKeyFile > with the path to an existing keyfile. In the example above the <connection> element is omitted, because the connection is established inside the script. this is shell command JCC Userguide 1.10 97 how you can record a script, is described in the chapter about SSHScriptExecutor. Result If check containing this action is marked active automatically after the action is completed. JCC Userguide 1.10 then the check will be re-executed 98 FAQ and Problem solving When I press on the graph button, my graph does not show any data. Check the configuration of the graph, by pressing the graph button. Now it will show the graph. Do not close the graph window . Now run the check again, for which this graph should show data. If the check is executed it should real-time update the graph. Look at your graph window if you see data appearing in the graph window. If you see nothing happening, then you should check the configuration of your graph and check the JCC log for errors. If you are using a regular expression to get the graph value from the result, then check the syntax and test it with a regular expression tool. Open the globalstats statistic file, to see if the check result is stored as expected. If you see the graph is now showing data, then the problem is in the globalstats statistics file. See the description of the statistics element for some more information. This issue can usually be solved by deleting or renaming the current globalstats statistics file. I made a change in the configuration, but it is not reflected in JCC gui JCC will only load the configuration files (checklists) during its start. That means that modifications in existing checklists or new checklists are not seen by JCC while it is running. To reload the complete configuration you must exit and start JCC again. But a faster way to accomplish the same, is pressing Ok in the variables popup screen. My configuration is not loaded in the GUI Most likely there is an xml error in the configuration. Look in the log4.log to find a clue for the problem. I have an error in the app.log : java.lang.UnsatisfiedLinkError: no EnJavaJni in java.library.path This error is reported using Java 7. Within the java runtime library look for a file named: accessibility.properties Then comment out assistive_technologies=com.encentuate.EncentuateAWTHook by placing a hash (#) in front of it, JCC Userguide 1.10 99