diff --git a/CHANGELOG.md b/CHANGELOG.md index 0099260..985ae69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # IBM websphere message broker Monitoring Extension CHANGELOG +### Version 6.0.1 +- Fixed issue related to reporting of metrics +- Fixed error related to log4j2 + ### Version 6.0.0 - Revamped extension to appd-exts-commons 2.2.4 \ No newline at end of file diff --git a/README.md b/README.md index 0c562ef..fbf0e95 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ ## Use Case -The IBM Integration Bus, formerly known as the IBM WebSphere Message Broker Family, provides a variety of options for implementing a -universal integration foundation based on an enterprise service bus (ESB). Implementations help to enable connectivity and transformation +The IBM Integration Bus, formerly known as the IBM WebSphere Message Broker Family, provides a variety of options for implementing a +universal integration foundation based on an enterprise service bus (ESB). Implementations help to enable connectivity and transformation in heterogeneous IT environments for businesses of any size, in any industry and covering a range of platforms. This extension extracts resource and message flow statistics. The list of metrics that it extracts can be found here: @@ -17,14 +17,14 @@ https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft. 2. Download and install [Apache Maven](https://maven.apache.org/) which is configured with `Java 8` to build the extension artifact from source. You can check the java version used in maven using command `mvn -v` or `mvn --version`. If your maven is using some other java version then please download java 8 for your platform and set JAVA_HOME parameter before starting maven. -3. If this extension is configured for *Client* transport type (more on that later), please make sure the MQ's host and port is accessible. +3. If this extension is configured for *Client* transport type (more on that later), please make sure the MQ's host and port is accessible. -4. If this extension is configured for *Bindings* transport type (more on that later), admin level credentials to the queue manager would be needed. If the hosting OS for IBM MQ is Windows, Windows user credentials will be needed. +4. If this extension is configured for *Bindings* transport type (more on that later), admin level credentials to the queue manager would be needed. If the hosting OS for IBM MQ is Windows, Windows user credentials will be needed. ### Dependencies **This extension requires the IBM MQ JMS client classes.** Refer to the IBM documentation for the specific jars. -For IBM MQ 8.0 and above, it depends on the following jars +For IBM MQ 8.0 and above, it depends on the following jars ``` com.ibm.mq.allclient.jar @@ -34,7 +34,7 @@ jms.jar providerutil.jar ``` -For previous versions, +For previous versions, ``` com.ibm.mqjms.jar @@ -42,13 +42,14 @@ jms.jar ``` -This extension works for Windows, Unix as well as AIX. +This extension works for Windows, Unix as well as AIX. + ## Installation 1. Clone the "websphere-message-broker-extension" repo using `git clone ` command. 2. Copy the following jars in the `websphere-message-broker-extension/lib` folder. (These jars are shipped with your Websphere message broker product itself) -* For IBM MQ 8.0 and above, it depends on the following jars +* For IBM MQ 8.0 and above, it depends on the following jars ``` com.ibm.mq.allclient.jar com.ibm.mq.traceControl.jar @@ -56,7 +57,7 @@ fscontext.jar jms.jar providerutil.jar ``` -* For previous versions, +* For previous versions, ``` com.ibm.mqjms.jar jms.jar @@ -81,18 +82,18 @@ If you are planning to use it in `Client` mode, please download the right versio ## Configuration - + There are two configurations needed: ### A. WebSphere Message Broker On the WebSphere Message Broker - + To get resource statistics from the broker, first you will have to enable the resource statistics on WMB (WebSphere Message Broker). There are two ways that you can enable statistics: -a. You can run "mqsichangeresourcestats" by running it in IBM Integration Console (in WMB 9.0) or IBM WMB Command Console (in previous versions). -A sample command can be - +a. You can run "mqsichangeresourcestats" by running it in IBM Integration Console (in WMB 9.0) or IBM WMB Command Console (in previous versions). +A sample command can be + ``` mqsichangeresourcestats BrokerA -c active -e default @@ -104,11 +105,11 @@ A sample command can be Please follow the below documentation to get more familiar with the mqsichangeresourcestats and mqsichangeflowstats command. https://www-01.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bj43320_.htm https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/an28420_.htm - -b. You can also enable resource statistics from IBM WebSphere MQ Explorer. - 1. Open IBM WebSphere MQ Explorer - 2. Click on Integration Node i.e. Broker Name. - 3. Right click on the execution group which you want statistics for and start resource statistics. + +b. You can also enable resource statistics from IBM WebSphere MQ Explorer. +1. Open IBM WebSphere MQ Explorer +2. Click on Integration Node i.e. Broker Name. +3. Right click on the execution group which you want statistics for and start resource statistics. To get message flow statistics, you have to enable them for a particular application / message flow: @@ -121,38 +122,38 @@ To get message flow statistics, you have to enable them for a particular applica application -> the application name messageflow -> the name of the message flow ``` - -Once you have started the statistic collection, you can confirm it by viewing the statistics as follows - + +Once you have started the statistic collection, you can confirm it by viewing the statistics as follows + - Open IBM WebSphere MQ Explorer - Click on Integration Node i.e. Broker Name. - Right click on the execution group which you want statistics for and view resource statistics. -Alternatively you can verify that the collection of statistics is enabled using the Broker's Web Interface. - +Alternatively you can verify that the collection of statistics is enabled using the Broker's Web Interface. + The resource metrics get published every 20 seconds to a topic. For the above command, the statistics will get published on this topic *$SYS/Broker/BrokerA/ResourceStatistics/default*. Similarly, snapshot statistics for message flows get published every 20 seconds to the corresponding topic *$SYS/Broker/+/StatisticsAccounting/SnapShot/application/messageflow*. - + For more details, please follow the IBM documentation: http://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/aq20080_.htm - + The extension subscribes to a particular topic in a queue manager's queue. Please confirm that you have all of the following in the IBM WebSphere MQ explorer: - - 1. A Queue Manager. - 2. A TCP Listener on some port controlled/managed by Queue Manager. - This port will be the port which we will use to subscribe to the statistics from the extension. - + +1. A Queue Manager. +2. A TCP Listener on some port controlled/managed by Queue Manager. + This port will be the port which we will use to subscribe to the statistics from the extension. + If the queue manager and/or TCP listener is not present, please create them. -### B. Appdynamics extension Config.yml +### B. Appdynamics extension Config.yml On the appdynamics extension - + You can run this extension in `Client` or `Bindings` mode. In `Bindings` mode the extension needs to be installed on the same box as the MQ Server. In `Client` mode the extension -needs to be remote and should have the access to the MQ Server. - -If you are planning to use it in `Bindings` mode, please make sure that -based on your OS, the IBM library path in the `appd-message-broker-monitor.sh` or `appd-message-broker-monitor.bat` exists and that IBM MQ jar files are available in that location. +needs to be remote and should have the access to the MQ Server. + +If you are planning to use it in `Bindings` mode, please make sure that +based on your OS, the IBM library path in the `appd-message-broker-monitor.sh` or `appd-message-broker-monitor.bat` exists and that IBM MQ jar files are available in that location. For eg. if the IBM jar files exist in opt/mqm/java/lib directory, update the `appd-message-broker-monitor.sh` file as below. (Take a note of two places where you may have to edit the path in the script file) ``` @@ -164,307 +165,221 @@ For eg. if the IBM jar files exist in opt/mqm/java/lib directory, update the `ap exit $? ``` -If you are planning to use it in `Client` mode, please download the right version of [IBM MQ Client](http://www-01.ibm.com/support/docview.wss?uid=swg21376217) on that remote server and obtain the above mentioned IBM jars from there. - +If you are planning to use it in `Client` mode, please download the right version of [IBM MQ Client](http://www-01.ibm.com/support/docview.wss?uid=swg21376217) on that remote server and obtain the above mentioned IBM jars from there. + Configure the config.yml file in the WMBMonitor directory. - + ``` -#This will create the metrics in all the tiers,under this path -#metricPrefix: "Custom Metrics|WMB" - -#This will create the metricUtils in a specific Tier/Component. Make sure to replace the -# with the appropriate one from your environment. To find the in your environment -#,please follow the screenshot here https://community.appdynamics.com/t5/Knowledge-Base/How-do-I-troubleshoot-missing-custom-metrics-or-extensions/ta-p/28695 -metricPrefix: "Server|Component:|Custom Metrics|WMB" - -queueManagers: -- host: "localhost" - - #TCP Listener port. Please make sure that the listener is started. - port: 2414 - - #Actual name of the queue manager. - name: "QMgr1" - - #The transport type for the queue manager connection, the default is "Bindings". - #For bindings type connection WMQ extension (i.e machine agent) need to be on the same machine on which WebsphereMQ server is running - #for client type connection WMQ extension is remote to the WebsphereMQ server. For client type, Change it to "Client". - transportType: "Bindings" - - #Channel name of the queue manager. Channel should be server-conn type. Make sure the channel is active. It is irrelevant for Bindings Mode - #channelName: "SYSTEM.ADMIN.SVRCONN" - - #userId and password with admin level credentials. For Windows, please provide the administrator credentials. These fields are irrelevant for Bindings Mode - #userID: "" - #password: "" - - #SSL related properties. Please provide the path. - #sslKeyRepository: "" - - #Cipher Suites. eg. "SSL_RSA_WITH_AES_128_CBC_SHA256" - #cipherSuite: "" - - #Client Connection Name - clientID: "AppDynamics Extension for Message Broker" - - #Resource Statistics Subscribers - https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/bj43310_.htm - #Please make sure to provide unique subscriber name for each statistic subscription. - resourceStatisticsSubscribers: - - topic: "$SYS/Broker/+/ResourceStatistics/#" - subscriberName: "allResourceStatistics" - - #Flow Statistics Subscribers - https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/aq20080_.htm - #Please make sure to provide unique subscriber name for each statistic subscription. - flowStatisticsSubscribers: - - topic: "$SYS/Broker/+/StatisticsAccounting/SnapShot/#/#" - subscriberName: "allFlowStatistics" - - - #For resource and flowstatistics, all the fields listed in this section will be reported as metrics. - #Remove fields you don't need to reduce the number of metricUtils. - #Available fields: - #https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bn43250_.htm - metrics: - resourceStatistics: - - type: "JVM" - identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] - include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" - - - type: "JDBCConnectionPools" - identifiers: ["summary"] - include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" - - - type: "JMS" - identifiers: ["summary"] - include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" - - - type: "Sockets" - identifiers: ["summary"] - include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" - - - type: "TCPIPClientNodes" - identifiers: ["summary"] - include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" - - - type: "TCPIPServerNodes" - identifiers: ["summary"] - include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" - - flowStatistics: - - type: "MessageFlow" - identifiers: [""] - include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "MinimumElapsedTime" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" - - - type: "Threads" - identifiers: ["ThreadStatistics"] - include: - - name : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread - alias: "TotalNumberOfInputMessages" - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - alias: "MinimumSizeOfInputMessages" - - - type: "Nodes" - identifiers: ["NodeStatistics"] - include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) - alias: "MaximumElapsedTime" - - name : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) - alias: "MinimumElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) - alias: "MaximumCPUTime" - - name : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) - alias: "MinimumCPUTime" - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - name: "NumberOfInputTerminals" #Number of input terminals - alias: "NumberOfInputTerminals" - - name : "NumberOfOutputTerminals" #Number of output terminals - alias: "NumberOfOutputTerminals" - - - type: "Nodes" - identifiers: ["NodeStatistics|TerminalStatistics"] - include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - derivedMetrics: - flowStatistics: - - type: "MessageFlow" - identifiers: [""] - include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" - - - type: "Threads" - identifiers: ["ThreadStatistics"] - include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" - - - type: "Nodes" - identifiers: ["NodeStatistics"] - include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - -#Don't change this unless you are having more than 10 queue managers to monitor. -numberOfThreads: 10 - -#Don't change this. -machineAgentWatchDog: -#In seconds -initialDelay: 0 -#Check the existence of MA process in 'period' seconds. -period: 5 + #This will create the metrics in all the tiers,under this path + #metricPrefix: "Custom Metrics|WMB" + + #This will create the metricUtils in a specific Tier/Component. Make sure to replace the + # with the appropriate one from your environment. To find the in your environment + #,please follow the screenshot here https://docs.appdynamics.com/display/PRO42/Build+a+Monitoring+Extension+Using+Java + metricPrefix: "Server|Component:|Custom Metrics|WMB" + + queueManagers: + - host: "localhost" + + #TCP Listener port. Please make sure that the listener is started. + port: 2414 + + #Actual name of the queue manager. + name: "QMgr1" + + #The transport type for the queue manager connection, the default is "Bindings". + #For bindings type connection WMQ extension (i.e machine agent) need to be on the same machine on which WebsphereMQ server is running + #for client type connection WMQ extension is remote to the WebsphereMQ server. For client type, Change it to "Client". + transportType: "Bindings" + + #Channel name of the queue manager. Channel should be server-conn type. Make sure the channel is active. It is irrelevant for Bindings Mode + #channelName: "SYSTEM.ADMIN.SVRCONN" + + #userId and password with admin level credentials. For Windows, please provide the administrator credentials. These fields are irrelevant for Bindings Mode + #userID: "" + #password: "" + + #SSL related properties. Please provide the path. + #sslKeyRepository: "" + + #Cipher Suites. eg. "SSL_RSA_WITH_AES_128_CBC_SHA256" + #cipherSuite: "" + + #Client Connection Name + clientID: "AppDynamics Extension for Message Broker" + + #Resource Statistics Subscribers - https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/bj43310_.htm + #Please make sure to provide unique subscriber name for each statistic subscription. + resourceStatisticsSubscribers: + - topic: "$SYS/Broker/+/ResourceStatistics/#" + subscriberName: "allResourceStatistics" + + #Flow Statistics Subscribers - https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/aq20080_.htm + #Please make sure to provide unique subscriber name for each statistic subscription. + flowStatisticsSubscribers: + - topic: "$SYS/Broker/+/StatisticsAccounting/SnapShot/#/#" + subscriberName: "allFlowStatistics" + + + #For resource and flowstatistics, all the fields listed in this section will be reported as metrics. + #Remove fields you don't need to reduce the number of metricUtils. + #Available fields: + #https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bn43250_.htm + metrics: + resourceStatistics: + - type: "JVM" + identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] + include: + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. + + - type: "JDBCConnectionPools" + identifiers: ["summary"] + include: + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. + + - type: "JMS" + identifiers: ["summary"] + include: + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. + + - type: "Sockets" + identifiers: ["summary"] + include: + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. + + - type: "TCPIPClientNodes" + identifiers: ["summary"] + include: + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. + + - type: "TCPIPServerNodes" + identifiers: ["summary"] + include: + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. + + flowStatistics: + - type: "MessageFlow" + identifiers: [""] + include: + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts + + - type: "Threads" + identifiers: ["ThreadStatistics"] + include: + - TotalNumberOfInputMessages : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) + + - type: "Nodes" + identifiers: ["NodeStatistics"] + include: + - Number: "Number" #Number of node statistics subfolders in Nodes folder + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + - NumberOfInputTerminals: "NumberOfInputTerminals" #Number of input terminals + - NumberOfOutputTerminals : "NumberOfOutputTerminals" #Number of output terminals + + - type: "Nodes" + identifiers: ["NodeStatistics|TerminalStatistics"] + include: + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + + derivedMetrics: + flowStatistics: + - type: "MessageFlow" + identifiers: [""] + include: + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" + + - type: "Threads" + identifiers: ["ThreadStatistics"] + include: + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" + + - type: "Nodes" + identifiers: ["NodeStatistics"] + include: + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + + + #Don't change this unless you are having more than 10 queue managers to monitor. + numberOfThreads: 10 + + #Don't change this. + machineAgentWatchDog: + #In seconds + initialDelay: 0 + #Check the existence of MA process in 'period' seconds. + period: 5 ``` @@ -473,47 +388,65 @@ Please copy all the contents of the config.yml file and go [here](https://jsonfo #### Metric Properties -The metrics shown in the file are customizable. You can choose to remove metrics or an entire section and they won't be reported. You can also add properties to individual metrics. The following properties can be added: -1. alias: The actual name of the metric as you would see it in the metric browser -2. multiplier: Used to transform the metric value, particularly for cases where memory is reported in bytes. 1.0 by default. -3. delta: Used to display a 'delta' or a difference between metrics that have an increasing value every minute. False by default. -4. clusterRollUpType: The cluster-rollup qualifier specifies how the Controller aggregates metric values in a tier (a cluster of nodes). The value is an enumerated type. Valid values are **INDIVIDUAL** (default) or **COLLECTIVE**. -5. aggregationType: The aggregator qualifier specifies how the Machine Agent aggregates the values reported during a one-minute period. Valid values are **AVERAGE** (default) or **SUM** or **OBSERVATION**. -6. timeRollUpType: The time-rollup qualifier specifies how the Controller rolls up the values when it converts from one-minute granularity tables to 10-minute granularity and 60-minute granularity tables over time. Valid values are **AVERAGE** (default) or **SUM** or **CURRENT**. -7. convert: Used to report a metric that is reporting text value by converting the value to its mapped integer +You may see some metrics as an ever increasing counter. Sometimes that is helpful but most of the times you may just want to see the change +in that minute for a particular metric. We let you configure that in the config.yml for each metric. -More details around this can be found [here](https://community.appdynamics.com/t5/Knowledge-Base/Extensions-Commons-Library-Metric-Transformers/ta-p/35413) +for eg. ``` - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - multiplier: "1" - aggregationType: "AVERAGE" - timeRollUpType: "AVERAGE" - clusterRollUpType: "INDIVIDUAL" - delta: "false" + - type: "TCPIPClientNodes" + identifiers: ["summary"] + include: + - OpenConnections: "OpenConnections" #The current number of open connections + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + delta: true + metricType: "SUM SUM INDIVIDUAL" + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + delta: true + metricType: "SUM SUM INDIVIDUAL" + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + delta: true + metricType: "SUM SUM INDIVIDUAL" + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + delta: true + metricType: "SUM SUM INDIVIDUAL" + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. + delta: true + metricType: "SUM SUM INDIVIDUAL" ``` +In the above configuration, for `MessagesReceived,MessagesSent,BytesSent,BytesReceived,FailedConnections`, we have configured two properties `delta` +and `metricType` + +delta - For each metric that has delta: true, the extension calculates a difference between the current and previous value and reports the difference. +Default value for delta: false + +metricType - It let's you define the metric qualifiers for the particular metric. +The format is "(Aggregation Qualifier) (Time Roll Up Qualifier) (Cluster Roll Up Qualifier)". To know more about these qualifiers, please visit https://docs.appdynamics.com/display/PRO43/Build+a+Monitoring+Extension+Using+Java +In the above example, metricType: "SUM SUM INDIVIDUAL", means +Aggregation Qualifier = SUM +Time Roll Up Qualifier = SUM +Cluster Roll Up Qualifier = INDIVIDUAL. + ## Performance overhead -There may be a performance overhead on activating resource and flow stats in your IIB environment. Please check [this](https://developer.ibm.com/answers/questions/190890/performance-impact-of-enabling-accounting-and-stat.html) link on what IBM has documented about the performance impact. +There may be a performance overhead on activating resource and flow stats in your IIB environment. Please check [this](https://developer.ibm.com/answers/questions/190890/performance-impact-of-enabling-accounting-and-stat.html) link on what IBM has documented about the performance impact. ## Support for AIX -This extension works on AIX if you point to ` appd-message-broker-monitor.sh` in the monitor.xml and change the appd-message-broker-monitor.sh and process_checker.sh files to using korn shell. +This extension works on AIX if you point to ` appd-message-broker-monitor.sh` in the monitor.xml and change the appd-message-broker-monitor.sh and process_checker.sh files to using korn shell. - ## Troubleshooting 1. Please follow the steps listed in this [troubleshooting-document](https://community.appdynamics.com/t5/Knowledge-Base/How-to-troubleshoot-missing-custom-metrics-or-extensions-metrics/ta-p/28695) in order to troubleshoot your issue. These are a set of common issues that customers might have faced during the installation of the extension. 2. Verify Machine Agent Data: Please start the Machine Agent without the extension and make sure that it reports data. Verify that the machine agent status is UP and it is reporting Hardware Metrics. -3. MQ Version incompatibilities : In case of any jar incompatibility issue, the rule of thumb is to use the jars from MQ version 8.0. +3. MQ Version incompatibilities : In case of any jar incompatibility issue, the rule of thumb is to use the jars from MQ version 8.0. 4. Metric Limit: Please start the machine agent with the argument `-Dappdynamics.agent.maxMetrics=5000` if there is a metric limit reached error in the logs. If you don't see the expected metrics, this could be the cause. 5. Check Logs: There could be some obvious errors in the machine agent logs. Please take a look. 6. `The config cannot be null` error. - This usually happenes when on a windows machine in monitor.xml you give config.yaml file path with linux file path separator */*. Use Windows file path separator *\* e.g. *monitors\MQMonitor\config.yaml*. For Windows, please specify + This usually happenes when on a windows machine in monitor.xml you give config.yaml file path with linux file path separator */*. Use Windows file path separator *\* e.g. *monitors\MQMonitor\config.yaml*. For Windows, please specify the complete path 7. Please confirm whether the resourcestats and flowstats were enabled for the queue manager and the listener port is up. -## Custom Dashboard +## Custom Dashboard ## ![](https://raw.githubusercontent.com/Appdynamics/ibm-websphere-msg-broker-monitor/master/ibm-wmb.png) ## Contributing @@ -523,9 +456,9 @@ Always feel free to fork and contribute any changes directly via [GitHub](https: | Name | Version | |--------------------------|------------| -|Extension Version |6.0.0 | +|Extension Version |6.0.1 | |Product Tested on |8.0.0.4 | -|Last Update |19/08/2021 | +|Last Update |01/12/2021 | |Change List |[ChangeLogs](https://github.com/Appdynamics/websphere-message-broker-extension/blob/master/CHANGELOG.md)| -**Note**: While extensions are maintained and supported by customers under the open-source licensing model, they interact with agents and Controllers that are subject to [AppDynamics’ maintenance and support policy](https://docs.appdynamics.com/latest/en/product-and-release-announcements/maintenance-support-for-software-versions). Some extensions have been tested with AppDynamics 4.5.13+ artifacts, but you are strongly recommended against using versions that are no longer supported. +**Note**: While extensions are maintained and supported by customers under the open-source licensing model, they interact with agents and Controllers that are subject to [AppDynamics’ maintenance and support policy](https://docs.appdynamics.com/latest/en/product-and-release-announcements/maintenance-support-for-software-versions). Some extensions have been tested with AppDynamics 4.5.13+ artifacts, but you are strongly recommended against using versions that are no longer supported. \ No newline at end of file diff --git a/pom.xml b/pom.xml index e7e1f93..55e8fc4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.appdynamics.extensions websphere-message-broker-extension - 6.0.0 + 6.0.1 UTF-8 @@ -177,7 +177,7 @@ - + diff --git a/src/main/java/com/appdynamics/extensions/wmb/StatsProcessor.java b/src/main/java/com/appdynamics/extensions/wmb/StatsProcessor.java index 4114809..39900e9 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/StatsProcessor.java +++ b/src/main/java/com/appdynamics/extensions/wmb/StatsProcessor.java @@ -1,10 +1,10 @@ package com.appdynamics.extensions.wmb; -import com.appdynamics.extensions.MetricWriteHelper; -import com.appdynamics.extensions.metrics.Metric; +import com.appdynamics.extensions.wmb.metricUtils.*; import com.google.common.collect.Maps; import javax.jms.*; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -17,19 +17,51 @@ public abstract class StatsProcessor { protected Map config; protected XmlParser parser; - protected MetricWriteHelper metricWriteHelper; - protected String metricPrefix; - protected Map metricPropsHolder; + protected MetricPrinter printer; + protected Map metricPropsHolder; + protected final MetricValueTransformer valueTransformer = new MetricValueTransformer(); - public StatsProcessor(Map config, XmlParser parser, MetricWriteHelper metricWriteHelper,String metricPrefix) { + public StatsProcessor(Map config, XmlParser parser, MetricPrinter printer) { this.config = config; + this.printer = printer; this.parser = parser; - this.metricWriteHelper = metricWriteHelper; - this.metricPrefix=metricPrefix; } public abstract void subscribe(Session session) throws JMSException; + protected MetricProperties createMetricProperties(Map metadata, String metricName, String alias) { + MetricProperties props = new DefaultMetricProperties(); + props.setAlias(alias); + props.setMetricName(metricName); + if(metadata.get("metricType") != null){ + props.setAggregationFields(metadata.get("metricType").toString()); + } + if(metadata.get("multiplier") != null){ + props.setMultiplier(Double.parseDouble(metadata.get("multiplier").toString())); + } + if(metadata.get("convert") != null){ + props.setConversionValues((Map)metadata.get("convert")); + } + if(metadata.get("delta") != null){ + props.setDelta(Boolean.parseBoolean(metadata.get("delta").toString())); + } + return props; + } + + protected Metric createMetricPoint(String metricPath, String value, MetricProperties properties, String metricName) { + BigDecimal decimalValue = valueTransformer.transform(metricPath + SEPARATOR + metricName, value, properties); + if (decimalValue != null) { + Metric m = new Metric(); + m.setMetricName(metricName); + m.setMetricPath(metricPath); + m.setProperties(properties); + m.setMetricValue(decimalValue); + return m; + } else { + return null; + } + } + protected String getMessageString(Message message) throws JMSException { if(message != null) { if (message instanceof TextMessage) { @@ -46,9 +78,8 @@ protected String getMessageString(Message message) throws JMSException { } //creates a map from the config.yaml of all the configured metrics along with their configured metric properties. - //protected Map buildMetricProperties(String name,String typeOfStatistics) { - protected Map buildMetricProperties(String name,String typeOfStatistics) { - Map propertiesMap = Maps.newHashMap(); + protected Map buildMetricProperties(String name,String typeOfStatistics) { + Map propertiesMap = Maps.newHashMap(); Object metricsObj = config.get(name); if(metricsObj != null){ Map metrics = (Map)metricsObj; @@ -65,8 +96,11 @@ protected Map buildMetricProperties(String name,String typeOfStatis if(includeMetrics != null){ for(Object includeObj : includeMetrics){ Map metadata = (Map)includeObj; - String metricName = (String) metadata.get("name"); - propertiesMap.put(join(SEPARATOR,type,identifier,metricName),metadata); + Map.Entry entry = (Map.Entry)metadata.entrySet().iterator().next(); + String metricName = entry.getKey().toString(); + String alias = entry.getValue().toString(); + MetricProperties props = createMetricProperties(metadata, metricName, alias); + propertiesMap.put(join(SEPARATOR,type,identifier,metricName),props); } } } @@ -79,4 +113,4 @@ protected Map buildMetricProperties(String name,String typeOfStatis } protected abstract List buildMetrics(T stats); -} +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/StatsSubscription.java b/src/main/java/com/appdynamics/extensions/wmb/StatsSubscription.java index 13258d6..37fc16d 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/StatsSubscription.java +++ b/src/main/java/com/appdynamics/extensions/wmb/StatsSubscription.java @@ -1,8 +1,9 @@ package com.appdynamics.extensions.wmb; -import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; import com.appdynamics.extensions.wmb.flowstats.FlowStatistics; +import com.appdynamics.extensions.wmb.flowstats.FlowStatsProcessor; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; import com.appdynamics.extensions.wmb.resourcestats.ResourceStatistics; import com.appdynamics.extensions.wmb.resourcestats.ResourceStatsProcessor; import org.slf4j.Logger; @@ -17,30 +18,26 @@ class StatsSubscription { private static final Logger logger = ExtensionsLoggerFactory.getLogger(StatsSubscription.class); private Map config; - private MetricWriteHelper metricWriteHelper; - private String metricPrefix; + private MetricPrinter printer; final ParserFactory parserFactory = new ParserFactory(); - StatsSubscription(Map queueManagerConfig, MetricWriteHelper metricWriteHelper,String metricPrefix) { + StatsSubscription(Map queueManagerConfig, MetricPrinter metricPrinter) { this.config = queueManagerConfig; - this.metricWriteHelper=metricWriteHelper; - this.metricPrefix=metricPrefix; + this.printer = metricPrinter; } void subscribe(Connection conn) throws JMSException, JAXBException { Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); // Subscribe to resource statistics if (config.get("resourceStatisticsSubscribers") != null) { - logger.info("Subscribing to resourceStatisticsSubscribers"); - StatsProcessor resourceStatsProcessor = new ResourceStatsProcessor(config,parserFactory.getResourceStatisticsParser(),metricWriteHelper,metricPrefix); + StatsProcessor resourceStatsProcessor = new ResourceStatsProcessor(config,parserFactory.getResourceStatisticsParser(),printer); resourceStatsProcessor.subscribe(session); } // Subscribe to message flow statistics if (config.get("flowStatisticsSubscribers") != null) { - logger.info("Subscribing to flowStatisticsSubscribers"); - StatsProcessor flowStatsProcessor = new com.appdynamics.extensions.wmb.flowstats.FlowStatsProcessor(config,parserFactory.getFlowStatisticsParser(),metricWriteHelper,metricPrefix); + StatsProcessor flowStatsProcessor = new FlowStatsProcessor(config,parserFactory.getFlowStatisticsParser(),printer); flowStatsProcessor.subscribe(session); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/WMBMonitor.java b/src/main/java/com/appdynamics/extensions/wmb/WMBMonitor.java index 03f3089..39ea69b 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/WMBMonitor.java +++ b/src/main/java/com/appdynamics/extensions/wmb/WMBMonitor.java @@ -1,5 +1,6 @@ package com.appdynamics.extensions.wmb; + import com.appdynamics.extensions.ABaseMonitor; import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.TasksExecutionServiceProvider; @@ -7,10 +8,10 @@ import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; import com.appdynamics.extensions.util.AssertUtils; import com.appdynamics.extensions.util.PathResolver; -import com.singularity.ee.agent.systemagent.api.exception.TaskExecutionException; +import com.appdynamics.extensions.wmb.metricUtils.CustomMetricWriter; +import com.google.common.collect.Maps; import org.slf4j.Logger; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -18,27 +19,26 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -public class WMBMonitor extends ABaseMonitor { +public class WMBMonitor extends ABaseMonitor{ + + private static final Logger logger = ExtensionsLoggerFactory.getLogger(WMBMonitor.class); private MonitorContextConfiguration monitorContextConfiguration; private Map configYml; - private static final String DEFAULT_METRIC_PREFIX = "Custom Metrics|WMB"; - private static final String MONITOR_NAME = "WMBMonitor"; - private static final String MA_PID = "MA-PID"; - private static final String CONFIG_FILE = "config-file"; - private static final String NAME = "name"; private static ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); private static CountDownLatch sharedLatch = new CountDownLatch(1); private static String pid; - private static final Logger logger = ExtensionsLoggerFactory.getLogger(WMBMonitor.class); + private static final String DEFAULT_METRIC_PREFIX = "Custom Metrics|WMB"; + private static final String MONITOR_NAME = "WMBMonitor"; + private static final String NAME = "name"; + private static final String MA_PID = "MA-PID"; + private static final String CONFIG_FILE = "config-file"; - @Override protected String getDefaultMetricPrefix() { return DEFAULT_METRIC_PREFIX; } - @Override public String getMonitorName() { return MONITOR_NAME; } @@ -47,69 +47,71 @@ public String getMonitorName() { protected void initializeMoreStuff(Map args) { monitorContextConfiguration = getContextConfiguration(); configYml = monitorContextConfiguration.getConfigYml(); + pid = args.get(MA_PID); } @Override protected void doRun(TasksExecutionServiceProvider tasksExecutionServiceProvider) { + List queueManagers = (List) configYml.get("queueManagers"); AssertUtils.assertNotNull(queueManagers, "QueueManagers cannot be null"); for (Map queueManager : queueManagers) { AssertUtils.assertNotNull(queueManager, "QueueManager cannot be null"); - WMBMonitorTask task = createTask(queueManager, tasksExecutionServiceProvider.getMetricWriteHelper()); + WMBMonitorTask task = createTask(queueManager, new CustomMetricWriter(),sharedLatch); tasksExecutionServiceProvider.submit((String) queueManager.get(NAME), task); } - Map watchDogProperties = (Map) configYml.get("machineAgentWatchDog"); + + Map watchDogProperties = (Map)configYml.get("machineAgentWatchDog"); /* * This extension works in continuous mode and starts a JVM by invoking a script. When the MA dies, the extension becomes * an orphanned process. To better manage the extension, we watch the MA process using MA PID passed through the script. */ - scheduler.scheduleAtFixedRate(new ProcessWatchDog(pid, sharedLatch, PathResolver.resolveDirectory(this.getClass())), ((Integer) watchDogProperties.get("initialDelay")).longValue(), ((Integer) watchDogProperties.get("period")).longValue(), TimeUnit.SECONDS); + scheduler.scheduleAtFixedRate(new ProcessWatchDog(pid, sharedLatch, PathResolver.resolveDirectory(this.getClass())), ((Integer)watchDogProperties.get("initialDelay")).longValue(),((Integer)watchDogProperties.get("period")).longValue(), TimeUnit.SECONDS); + } - private WMBMonitorTask createTask(Map queueManager, MetricWriteHelper metricWriteHelper) { + private WMBMonitorTask createTask(Map queueManager, MetricWriteHelper metricWriteHelper, CountDownLatch sharedLatch) { return new WMBMonitorTask.Builder() .metricPrefix(monitorContextConfiguration.getMetricPrefix()) .metricWriter(metricWriteHelper) .manager(queueManager) + .countdownLatch(sharedLatch) .build(); } - @Override protected List> getServers() { return (List>) configYml.get("queueManagers"); } - public static void main(String[] args) throws TaskExecutionException { - + public static void main(String[] args){ if (args == null || args.length == 0) { logger.error("MA PID was not passed as an argument to WMBMonitor."); return; } - if (args.length > 1) { + if(args.length > 1){ logger.error("Incorrect number of arguments were passed to WMBMonitor."); return; } - - logger.info("MA pid = [{}]", args[0]); - pid = args[0]; - final WMBMonitor monitor = new WMBMonitor(); + logger.info("MA pid = {}",args[0]); + final WMBMonitor wmbMonitor = new WMBMonitor(); String configFile = System.getProperty("extension.configuration"); - final Map taskArgs = new HashMap<>(); - taskArgs.put(CONFIG_FILE, configFile); - taskArgs.put(MA_PID, args[0]); - + Map taskArgs = Maps.newHashMap(); + taskArgs.put(CONFIG_FILE,configFile); + taskArgs.put(MA_PID,args[0]); try { - monitor.execute(taskArgs, null); + wmbMonitor.execute(taskArgs,null); logger.info("Connection started. Wait Indefinitely..."); sharedLatch.await(); logger.info("My parent has died. I have to die as well."); System.exit(0); - } catch (Exception e) { - logger.error("Error in Execution"); - } finally { - if (scheduler != null) { + } + catch(Exception e){ + logger.error("Error in execution",e); + } + finally{ + if(scheduler != null){ scheduler.shutdown(); } } } -} +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/WMBMonitorTask.java b/src/main/java/com/appdynamics/extensions/wmb/WMBMonitorTask.java index 57fd673..9f6e552 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/WMBMonitorTask.java +++ b/src/main/java/com/appdynamics/extensions/wmb/WMBMonitorTask.java @@ -1,46 +1,42 @@ package com.appdynamics.extensions.wmb; + import com.appdynamics.extensions.AMonitorTaskRunnable; import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; import org.slf4j.Logger; import javax.jms.Connection; import javax.jms.JMSException; import javax.xml.bind.JAXBException; import java.util.Map; +import java.util.concurrent.CountDownLatch; import static com.appdynamics.extensions.wmb.Util.convertToString; -class WMBMonitorTask implements AMonitorTaskRunnable { +class WMBMonitorTask implements AMonitorTaskRunnable{ private static final Logger logger = ExtensionsLoggerFactory.getLogger(WMBMonitorTask.class); - private static final String SEPARATOR = "|"; private String displayName; - - /* metric prefix from the config.yaml to be applied to each metric path*/ private String metricPrefix; - - /* a facade to report metricUtils to the machine agent.*/ - private MetricWriteHelper metricWriteHelper; - private Map queueManagerConfig; + private MetricWriteHelper metricWriter; + private CountDownLatch countDownLatch; - private WMBMonitorTask(){ - } - + @Override public void run() { try { logger.info("Executing a run of WMBMonitor."); displayName = convertToString(queueManagerConfig.get("name"),""); + MetricPrinter metricPrinter = new MetricPrinter(metricPrefix,displayName,metricWriter); Connection conn = new ConnectionFactory().createConnection(queueManagerConfig); //subscribe subscribers - StatsSubscription sub = new StatsSubscription(queueManagerConfig,metricWriteHelper,metricPrefix +SEPARATOR+displayName); + StatsSubscription sub = new StatsSubscription(queueManagerConfig,metricPrinter); sub.subscribe(conn); //start connection conn.start(); - } catch (JMSException e) { logger.error("Unable to connect to the queue manager with name={}",displayName,e); } catch (JAXBException e) { @@ -52,10 +48,14 @@ public void run() { @Override public void onTaskComplete() { + try { + countDownLatch.await(); + } catch (InterruptedException e) { + logger.error("An unexpected error occurred while completing task",e); + } logger.info("WMB monitor run completed successfully."); } - static class Builder { private WMBMonitorTask task = new WMBMonitorTask(); @@ -64,8 +64,8 @@ Builder metricPrefix(String metricPrefix) { return this; } - Builder metricWriter(MetricWriteHelper metricWriteHelper) { - task.metricWriteHelper = metricWriteHelper; + Builder metricWriter(MetricWriteHelper metricWriter) { + task.metricWriter = metricWriter; return this; } @@ -74,8 +74,13 @@ Builder manager(Map manager){ return this; } + Builder countdownLatch(CountDownLatch countDownLatch){ + task.countDownLatch = countDownLatch; + return this; + } + WMBMonitorTask build() { return task; } } -} +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/flowstats/FlowStatsProcessor.java b/src/main/java/com/appdynamics/extensions/wmb/flowstats/FlowStatsProcessor.java index d8990ef..5e39943 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/flowstats/FlowStatsProcessor.java +++ b/src/main/java/com/appdynamics/extensions/wmb/flowstats/FlowStatsProcessor.java @@ -1,18 +1,20 @@ package com.appdynamics.extensions.wmb.flowstats; -import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; -import com.appdynamics.extensions.metrics.Metric; import com.appdynamics.extensions.wmb.StatsProcessor; import com.appdynamics.extensions.wmb.XmlParser; +import com.appdynamics.extensions.wmb.metricUtils.DefaultMetricProperties; +import com.appdynamics.extensions.wmb.metricUtils.Metric; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; +import com.appdynamics.extensions.wmb.metricUtils.MetricProperties; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jms.*; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -23,21 +25,21 @@ public class FlowStatsProcessor extends StatsProcessor implements MessageListener { private static final Logger logger = ExtensionsLoggerFactory.getLogger(FlowStatsProcessor.class); - private static final String SEPARATOR = "|"; private static final String EXECUTION_GROUP_NAME = "ExecutionGroupName"; private enum DerivedMetric { AverageElapsedTime, AverageCPUTime, AverageCPUTimeWaitingForInputMessage, AverageElapsedTimeWaitingForInputMessage, AverageSizeOfInputMessages } - public FlowStatsProcessor(Map config, XmlParser parser, MetricWriteHelper metricWriteHelper, String metricPrefix) { - super(config, parser, metricWriteHelper, metricPrefix); - this.metricPropsHolder = buildMetricProperties("metrics", "flowStatistics"); - Map derivedPropsHolder = buildMetricProperties("derivedMetrics", "flowStatistics"); + public FlowStatsProcessor(Map config, XmlParser parser, MetricPrinter printer) { + super(config,parser,printer); + this.metricPropsHolder = buildMetricProperties("metrics","flowStatistics"); + Map derivedPropsHolder = buildMetricProperties("derivedMetrics","flowStatistics"); this.metricPropsHolder.putAll(derivedPropsHolder); } + public void subscribe(Session session) throws JMSException { if (config.get("flowStatisticsSubscribers") != null) { List resourceSubscribers = (List) config.get("flowStatisticsSubscribers"); @@ -53,7 +55,6 @@ public void subscribe(Session session) throws JMSException { /** * This method is called every time when there is a message on the topic. - * * @param message */ public void onMessage(Message message) { @@ -67,7 +68,7 @@ public void onMessage(Message message) { T flowStatistics = parser.parse(text); if (flowStatistics != null) { List metrics = buildMetrics(flowStatistics); - metricWriteHelper.transformAndPrintMetrics(metrics); + printer.reportMetrics(metrics); } } catch (JAXBException e) { logger.error("Unable to unmarshal XML message {}", text, e); @@ -85,40 +86,44 @@ public void onMessage(Message message) { } } - protected List buildMetrics(T stats) { - FlowStatistics flowStatistics = (FlowStatistics) stats; + protected List buildMetrics(T stats){ + FlowStatistics flowStatistics = (FlowStatistics)stats; List metrics = new ArrayList(); - if (flowStatistics != null && flowStatistics.getMessageFlow() != null) { + if(flowStatistics != null && flowStatistics.getMessageFlow() != null){ //message flow statistics MessageFlow messageFlow = flowStatistics.getMessageFlow(); String executionGroupName = messageFlow.getAttributes().get(new QName(EXECUTION_GROUP_NAME)); - for (QName key : messageFlow.getAttributes().keySet()) { - String messageFlowMetric = join(SEPARATOR, "MessageFlow", key.toString()); - Map flowMetricProperties = metricPropsHolder.get(messageFlowMetric); - if (flowMetricProperties != null) { + for (QName key: messageFlow.getAttributes().keySet()) { + String messageFlowMetric = join(SEPARATOR,"MessageFlow",key.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(messageFlowMetric); + if(flowMetricProperties != null){ String value = messageFlow.getAttributes().get(key); - String metricPath = join(SEPARATOR, executionGroupName, + String metricPath = join(SEPARATOR,executionGroupName, "Flow Statistics", "MessageFlow"); - Metric metric = new Metric(key.toString(), value, metricPrefix + SEPARATOR + metricPath + SEPARATOR + flowMetricProperties.get("alias"), flowMetricProperties); - metrics.add(metric); + Metric metricPoint = createMetricPoint(metricPath,value,flowMetricProperties,key.toString()); + if(metricPoint != null){ + metrics.add(metricPoint); + } } } derivedMetrics(metrics, messageFlow, executionGroupName); // thread statistics List threadStats = flowStatistics.getThreadStatistics(); - if (threadStats != null) { - for (Thread t : threadStats) { + if(threadStats != null){ + for(Thread t : threadStats){ String threadNumber = t.getAttributes().get(new QName("Number")); - for (QName key : t.getAttributes().keySet()) { - String threadFlowStatistics = join(SEPARATOR, "Threads", "ThreadStatistics", key.toString()); - Map flowMetricProperties = metricPropsHolder.get(threadFlowStatistics); - if (flowMetricProperties != null) { - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "Threads", "ThreadStatistics", threadNumber); + for (QName key: t.getAttributes().keySet()) { + String threadFlowStatistics = join(SEPARATOR,"Threads","ThreadStatistics",key.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(threadFlowStatistics); + if(flowMetricProperties != null){ + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","Threads","ThreadStatistics",threadNumber); String value = t.getAttributes().get(key); - Metric metric = new Metric(key.toString(),value,metricPrefix+SEPARATOR+metricPath+SEPARATOR+flowMetricProperties.get("alias"),flowMetricProperties); - metrics.add(metric); + Metric metricPoint = createMetricPoint(metricPath,value,flowMetricProperties,key.toString()); + if(metricPoint != null){ + metrics.add(metricPoint); + } } } @@ -126,38 +131,44 @@ protected List buildMetrics(T stats) { derivedMetrics(metrics, executionGroupName, t, threadNumber); } //adding a metric for inserting the count of threads - Metric metric = new Metric("Number",Integer.toString(threadStats.size()),metricPrefix+SEPARATOR+join(SEPARATOR, executionGroupName, "Flow Statistics", "Threads")+SEPARATOR+"Number"); - metrics.add(metric); + Metric countMetricPoint = createMetricPoint(join(SEPARATOR,executionGroupName,"Flow Statistics","Threads"),Integer.toString(threadStats.size()),new DefaultMetricProperties(),"Number"); + if(countMetricPoint != null){ + metrics.add(countMetricPoint); + } } //node statistics List nodeStats = flowStatistics.getNodeStatistics(); - if (nodeStats != null) { - for (Node n : nodeStats) { + if(nodeStats != null){ + for(Node n : nodeStats){ String nodeLabel = n.getAttributes().get(new QName("Label")); - for (QName key : n.getAttributes().keySet()) { - String nodeFlowStatistics = join(SEPARATOR, "Nodes", "NodeStatistics", key.toString()); - Map flowMetricProperties = metricPropsHolder.get(nodeFlowStatistics); - if (flowMetricProperties != null) { - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "Nodes", "NodeStatistics", nodeLabel); + for(QName key : n.getAttributes().keySet()){ + String nodeFlowStatistics = join(SEPARATOR,"Nodes","NodeStatistics",key.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(nodeFlowStatistics); + if(flowMetricProperties != null) { + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","Nodes","NodeStatistics",nodeLabel); String value = n.getAttributes().get(key); - Metric metric = new Metric(key.toString(),value,metricPrefix+SEPARATOR+metricPath+flowMetricProperties.get("alias"),flowMetricProperties); - metrics.add(metric); + Metric metricPoint = createMetricPoint(metricPath,value,flowMetricProperties,key.toString()); + if(metricPoint != null){ + metrics.add(metricPoint); + } } } //terminal statistics List terminalStats = n.getTerminalStatistics(); - if (terminalStats != null) { - for (Terminal t : n.getTerminalStatistics()) { + if(terminalStats != null){ + for(Terminal t : n.getTerminalStatistics()){ String terminalLabel = t.getAttributes().get(new QName("Label")); - for (QName key : t.getAttributes().keySet()) { - String terminalFlowStatistics = join(SEPARATOR, "Nodes", "NodeStatistics", "TerminalStatistics", key.toString()); - Map flowMetricProperties = metricPropsHolder.get(terminalFlowStatistics); - if (flowMetricProperties != null) { - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "Nodes", "NodeStatistics", nodeLabel, "TerminalStatistics", terminalLabel); + for(QName key : t.getAttributes().keySet()){ + String terminalFlowStatistics = join(SEPARATOR,"Nodes","NodeStatistics","TerminalStatistics",key.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(terminalFlowStatistics); + if(flowMetricProperties != null){ + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","Nodes","NodeStatistics",nodeLabel,"TerminalStatistics",terminalLabel); String value = t.getAttributes().get(key); - Metric metric = new Metric(key.toString(),value,metricPrefix+SEPARATOR+metricPath+SEPARATOR+flowMetricProperties.get("alias"),flowMetricProperties); - metrics.add(metric); + Metric metricPoint = createMetricPoint(metricPath,value,flowMetricProperties,key.toString()); + if(metricPoint != null){ + metrics.add(metricPoint); + } } } } @@ -166,40 +177,42 @@ protected List buildMetrics(T stats) { derivedMetrics(metrics, executionGroupName, n, nodeLabel); } //adding a metric for inserting the count of threads - Metric metric = new Metric("Number",Integer.toString(nodeStats.size()),metricPrefix+SEPARATOR+join(SEPARATOR, executionGroupName, "Flow Statistics", "Nodes")+SEPARATOR+"Number"); - metrics.add(metric); + Metric countMetricPoint = createMetricPoint(join(SEPARATOR,executionGroupName,"Flow Statistics","Nodes"),Integer.toString(nodeStats.size()),new DefaultMetricProperties(),"Number"); + if(countMetricPoint != null){ + metrics.add(countMetricPoint); + } } } return metrics; } private void derivedMetrics(List metrics, String executionGroupName, Node n, String nodeLabel) { - for (DerivedMetric metric : DerivedMetric.values()) { - String nodeStatistics = join(SEPARATOR, "Nodes", "NodeStatistics", metric.toString()); - Map flowMetricProperties = metricPropsHolder.get(nodeStatistics); - try { - if (flowMetricProperties != null) { + for(DerivedMetric metric : DerivedMetric.values()){ + String nodeStatistics = join(SEPARATOR,"Nodes","NodeStatistics",metric.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(nodeStatistics); + try{ + if(flowMetricProperties != null){ Metric metricPoint = null; - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "Nodes", "NodeStatistics", nodeLabel); - switch (metric) { + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","Nodes","NodeStatistics",nodeLabel); + switch(metric){ case AverageElapsedTime: metricPoint = createFractionMetricPoint(n.getAttributes(), "TotalElapsedTime", "CountOfInvocations", metric.toString(), - metricPath, flowMetricProperties); + metricPath,flowMetricProperties); break; case AverageCPUTime: metricPoint = createFractionMetricPoint(n.getAttributes(), "TotalCPUTime", - "CountOfInvocations", metric.toString(), metricPath, flowMetricProperties); + "CountOfInvocations", metric.toString(), metricPath,flowMetricProperties); break; default: break; } - if (metricPoint != null) { + if(metricPoint != null){ metrics.add(metricPoint); } } - } catch (ClassCastException e) { + }catch (ClassCastException e) { logger.error("Configuration Error: Could not parse a derived \"Node\" field"); } catch (IllegalArgumentException e) { logger.error("Configuration Error: Derived \"Node\" field \"" + metric.toString() @@ -209,47 +222,47 @@ private void derivedMetrics(List metrics, String executionGroupName, Nod } private void derivedMetrics(List metrics, String executionGroupName, Thread t, String threadNumber) { - for (DerivedMetric metric : DerivedMetric.values()) { - String threadFlowStatistics = join(SEPARATOR, "Threads", "ThreadStatistics", metric.toString()); - Map flowMetricProperties = metricPropsHolder.get(threadFlowStatistics); - try { - if (flowMetricProperties != null) { + for(DerivedMetric metric : DerivedMetric.values()){ + String threadFlowStatistics = join(SEPARATOR,"Threads","ThreadStatistics",metric.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(threadFlowStatistics); + try{ + if(flowMetricProperties != null){ Metric metricPoint = null; - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "Threads", "ThreadStatistics", threadNumber); - switch (metric) { + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","Threads","ThreadStatistics",threadNumber); + switch(metric){ case AverageElapsedTime: metricPoint = createFractionMetricPoint(t.getAttributes(), "TotalElapsedTime", "TotalNumberOfInputMessages", metric.toString(), - metricPath, flowMetricProperties); + metricPath,flowMetricProperties); break; case AverageCPUTime: metricPoint = createFractionMetricPoint(t.getAttributes(), "TotalCPUTime", - "TotalNumberOfInputMessages", metric.toString(), metricPath, flowMetricProperties); + "TotalNumberOfInputMessages", metric.toString(), metricPath,flowMetricProperties); break; case AverageCPUTimeWaitingForInputMessage: metricPoint = createFractionMetricPoint(t.getAttributes(), "CPUTimeWaitingForInputMessage", "TotalNumberOfInputMessages", - metric.toString(), metricPath, flowMetricProperties); + metric.toString(), metricPath,flowMetricProperties); break; case AverageSizeOfInputMessages: metricPoint = createFractionMetricPoint(t.getAttributes(), "TotalSizeOfInputMessages", "TotalNumberOfInputMessages", - metric.toString(), metricPath, flowMetricProperties); + metric.toString(), metricPath,flowMetricProperties); break; case AverageElapsedTimeWaitingForInputMessage: - metricPoint = createFractionMetricPoint(t.getAttributes(), "ElapsedTimeWaitingForInputMessage", "TotalNumberOfInputMessages", - metric.toString(), metricPath, flowMetricProperties); + metricPoint = createFractionMetricPoint(t.getAttributes(),"ElapsedTimeWaitingForInputMessage","TotalNumberOfInputMessages", + metric.toString(),metricPath,flowMetricProperties); break; default: break; } - if (metricPoint != null) { + if(metricPoint != null){ metrics.add(metricPoint); } } - } catch (ClassCastException e) { + }catch (ClassCastException e) { logger.error("Configuration Error: Could not parse a derived \"Threads\" field"); } catch (IllegalArgumentException e) { logger.error("Configuration Error: Derived \"Threads\" field \"" + metric.toString() @@ -261,42 +274,42 @@ private void derivedMetrics(List metrics, String executionGroupName, Thr private void derivedMetrics(List metrics, MessageFlow messageFlow, String executionGroupName) { //derived metrics - message flow - for (DerivedMetric metric : DerivedMetric.values()) { - String messageFlowMetric = join(SEPARATOR, "MessageFlow", metric.toString()); - Map flowMetricProperties = metricPropsHolder.get(messageFlowMetric); - try { - if (flowMetricProperties != null) { + for(DerivedMetric metric : DerivedMetric.values()){ + String messageFlowMetric = join(SEPARATOR,"MessageFlow",metric.toString()); + MetricProperties flowMetricProperties = metricPropsHolder.get(messageFlowMetric); + try{ + if(flowMetricProperties != null){ Metric metricPoint = null; - String metricPath = join(SEPARATOR, executionGroupName, "Flow Statistics", "MessageFlow"); - switch (metric) { + String metricPath = join(SEPARATOR,executionGroupName,"Flow Statistics","MessageFlow"); + switch(metric){ case AverageElapsedTime: metricPoint = createFractionMetricPoint(messageFlow.getAttributes(), "TotalElapsedTime", "TotalInputMessages", metric.toString(), - metricPath, flowMetricProperties); + metricPath,flowMetricProperties); break; case AverageCPUTime: metricPoint = createFractionMetricPoint(messageFlow.getAttributes(), "TotalCPUTime", - "TotalInputMessages", metric.toString(), metricPath, flowMetricProperties); + "TotalInputMessages", metric.toString(), metricPath,flowMetricProperties); break; case AverageCPUTimeWaitingForInputMessage: metricPoint = createFractionMetricPoint(messageFlow.getAttributes(), "CPUTimeWaitingForInputMessage", "TotalInputMessages", - metric.toString(), metricPath, flowMetricProperties); + metric.toString(), metricPath,flowMetricProperties); break; case AverageSizeOfInputMessages: metricPoint = createFractionMetricPoint(messageFlow.getAttributes(), "TotalSizeOfInputMessages", "TotalInputMessages", - metric.toString(), metricPath, flowMetricProperties); + metric.toString(), metricPath,flowMetricProperties); break; default: break; } - if (metricPoint != null) { + if(metricPoint != null){ metrics.add(metricPoint); } } - } catch (ClassCastException e) { + }catch (ClassCastException e) { logger.error("Configuration Error: Could not parse a derived \"MessageFlow\" field"); } catch (IllegalArgumentException e) { logger.error("Configuration Error: Derived \"MessageFlow\" field \"" + metric.toString() @@ -306,18 +319,18 @@ private void derivedMetrics(List metrics, MessageFlow messageFlow, Strin } - //private Metric createFractionMetricPoint(Map attributes, String numeratorName, String denominatorName, String metricName, String metricPath, MetricProperties metricProperties) { - private Metric createFractionMetricPoint(Map attributes, String numeratorName, String denominatorName, String metricName, String metricPath, Map metricProperties) { + private Metric createFractionMetricPoint(Map attributes, String numeratorName, + String denominatorName, String metricName, String metricPath,MetricProperties metricProperties) { BigDecimal numerator = new BigDecimal(attributes.get(new QName(numeratorName))); BigDecimal denominator = new BigDecimal(attributes.get(new QName(denominatorName))); BigDecimal fractionValue; if (denominator.equals(BigDecimal.ZERO)) { return null; } else { - fractionValue = numerator.divide(denominator, 0, RoundingMode.HALF_UP); + fractionValue = numerator.divide(denominator,2,BigDecimal.ROUND_HALF_UP); } - return new Metric(metricName,fractionValue.toString(),metricPrefix+SEPARATOR+metricPath+SEPARATOR+metricProperties.get("alias"),metricProperties); + return createMetricPoint(metricPath, fractionValue.toString(), metricProperties, metricName); } -} +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/CustomMetricWriter.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/CustomMetricWriter.java new file mode 100644 index 0000000..c383011 --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/CustomMetricWriter.java @@ -0,0 +1,29 @@ +package com.appdynamics.extensions.wmb.metricUtils; + + +import com.appdynamics.extensions.MetricWriteHelper; + +public class CustomMetricWriter extends MetricWriteHelper { + + public void printMetric(String metricPath, String metricValue, String aggregationType, String timeRollup, String clusterRollup) { + StringBuilder sb = new StringBuilder(); + sb.append("name").append("=").append(metricPath).append(","); + sb.append("value").append("=").append(metricValue); + if(aggregationType != null) { + sb.append(","); + sb.append("aggregator").append("=").append(aggregationType); + } + + if(timeRollup != null) { + sb.append(","); + sb.append("time-rollup").append("=").append(timeRollup); + } + + if(clusterRollup != null) { + sb.append(","); + sb.append("cluster-rollup").append("=").append(clusterRollup); + } + System.out.println(sb.toString()); + } + +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/DefaultMetricProperties.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/DefaultMetricProperties.java new file mode 100644 index 0000000..fd4a6c3 --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/DefaultMetricProperties.java @@ -0,0 +1,16 @@ +package com.appdynamics.extensions.wmb.metricUtils; + +import com.singularity.ee.agent.systemagent.api.MetricWriter; + +public class DefaultMetricProperties extends MetricProperties{ + + private static final String DEFAULT_METRIC_TYPE = MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE + " " + MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE + " " + MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL; + private static final boolean DEFAULT_DELTA = false; + + public DefaultMetricProperties(){ + setAggregationFields(DEFAULT_METRIC_TYPE); + setMultiplier(DEFAULT_MULTIPLIER); + setDelta(DEFAULT_DELTA); + } + +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/Metric.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/Metric.java new file mode 100644 index 0000000..8bedae8 --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/Metric.java @@ -0,0 +1,56 @@ +package com.appdynamics.extensions.wmb.metricUtils; + +import com.google.common.base.Strings; + +import java.math.BigDecimal; + +public class Metric { + private String metricName; + private String metricPath; + private String clusterKey; + private BigDecimal metricValue; + private MetricProperties properties; + + public String getMetricNameOrAlias() { + if(properties == null || Strings.isNullOrEmpty(properties.getAlias())){ + return metricName; + } + return properties.getAlias(); + } + + public void setMetricName(String metricName) { + this.metricName = metricName; + } + + public String getMetricPath() { + return metricPath; + } + + public void setMetricPath(String metricPath) { + this.metricPath = metricPath; + } + + public BigDecimal getMetricValue() { + return metricValue; + } + + public void setMetricValue(BigDecimal metricValue) { + this.metricValue = metricValue; + } + + public MetricProperties getProperties() { + return properties; + } + + public void setProperties(MetricProperties properties) { + this.properties = properties; + } + + public String getClusterKey() { + return clusterKey; + } + + public void setClusterKey(String clusterKey) { + this.clusterKey = clusterKey; + } +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricPrinter.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricPrinter.java new file mode 100644 index 0000000..0601475 --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricPrinter.java @@ -0,0 +1,72 @@ +package com.appdynamics.extensions.wmb.metricUtils; + + +import com.appdynamics.extensions.MetricWriteHelper; +import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; +import java.util.List; + +import static com.appdynamics.extensions.wmb.Util.toBigIntString; + +public class MetricPrinter { + + private static final Logger logger = ExtensionsLoggerFactory.getLogger(MetricPrinter.class); + + private int totalMetricsReported; + private String metricPrefix; + private String displayName; + private MetricWriteHelper metricWriter; + + @VisibleForTesting + public MetricPrinter(String metricPrefix, String displayName, MetricWriteHelper metricWriter){ + this.metricPrefix = metricPrefix; + this.displayName = displayName; + this.metricWriter = metricWriter; + } + + public void reportMetrics(final List metrics) { + totalMetricsReported = 0; + if(metrics == null || metrics.isEmpty()){ + return; + } + for(Metric metric : metrics){ + MetricProperties props = metric.getProperties(); + String fullMetricPath = formMetricPath(metric.getMetricPath(),metric.getMetricNameOrAlias()); + printMetric(fullMetricPath,metric.getMetricValue(), props.getAggregationType(),props.getTimeRollupType(),props.getClusterRollupType()); + } + logger.debug("Total number of metricUtils reported by WMBMonitor {}",getTotalMetricsReported()); + } + + @VisibleForTesting + public void printMetric(String metricPath, BigDecimal metricValue, String aggType, String timeRollupType, String clusterRollupType) { + try{ + String metricValStr = toBigIntString(metricValue); + if(metricValStr != null) { + metricWriter.printMetric(metricPath,metricValStr,aggType,timeRollupType,clusterRollupType); + //System.out.println("Sending [" + aggType + "|" + timeRollupType + "|" + clusterRollupType + // + "] metric = " + metricPath + " = " + metricValStr); + logger.debug("Sending [{}|{}|{}] metric= {},value={}", aggType, timeRollupType, clusterRollupType, metricPath, metricValStr); + totalMetricsReported++; + } + } + catch (Exception e){ + logger.error("Error reporting metric {} with value {}",metricPath,metricValue,e); + } + } + + private String formMetricPath(String metricPath, String metricName) { + if(!Strings.isNullOrEmpty(displayName)){ + return metricPrefix + "|" + displayName + "|" + metricPath + "|" + metricName; + } + return metricPrefix + "|" + metricPath + "|" + metricName; + } + + public int getTotalMetricsReported() { + return totalMetricsReported; + } +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricProperties.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricProperties.java new file mode 100644 index 0000000..7b7f661 --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricProperties.java @@ -0,0 +1,92 @@ +package com.appdynamics.extensions.wmb.metricUtils; + +import java.util.Map; + +import static com.appdynamics.extensions.wmb.Util.split; + + +public class MetricProperties { + static final double DEFAULT_MULTIPLIER = 1d; + private String alias; + private String metricName; + private String aggregationType; + private String timeRollupType; + private String clusterRollupType; + private double multiplier = DEFAULT_MULTIPLIER; + private boolean delta; + private Map conversionValues; + + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public String getMetricName() { + return metricName; + } + + public void setMetricName(String metricName) { + this.metricName = metricName; + } + + public String getAggregationType() { + return aggregationType; + } + + public void setAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + } + + public String getTimeRollupType() { + return timeRollupType; + } + + public void setTimeRollupType(String timeRollupType) { + this.timeRollupType = timeRollupType; + } + + public String getClusterRollupType() { + return clusterRollupType; + } + + public void setClusterRollupType(String clusterRollupType) { + this.clusterRollupType = clusterRollupType; + } + + public double getMultiplier() { + return multiplier; + } + + public void setMultiplier(double multiplier) { + this.multiplier = multiplier; + } + + public Map getConversionValues() { + return conversionValues; + } + + public void setConversionValues(Map conversionValues) { + this.conversionValues = conversionValues; + } + + public boolean isDelta() { + return delta; + } + + public void setDelta(boolean delta) { + this.delta = delta; + } + + public void setAggregationFields(String metricType) { + String[] metricTypes = split(metricType," "); + this.setAggregationType(metricTypes[0]); + this.setTimeRollupType(metricTypes[1]); + this.setClusterRollupType(metricTypes[2]); + } + + +} + diff --git a/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricValueTransformer.java b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricValueTransformer.java new file mode 100644 index 0000000..d00efcc --- /dev/null +++ b/src/main/java/com/appdynamics/extensions/wmb/metricUtils/MetricValueTransformer.java @@ -0,0 +1,64 @@ +package com.appdynamics.extensions.wmb.metricUtils; + + +import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; +import com.appdynamics.extensions.metrics.DeltaMetricsCalculator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; + +public class MetricValueTransformer { + + private static final Logger logger = ExtensionsLoggerFactory.getLogger(MetricValueTransformer.class); + + private final DeltaMetricsCalculator deltaCalculator = new DeltaMetricsCalculator(10); + + public BigDecimal transform(String metric, Object metricValue, MetricProperties props) { + if (metricValue == null) { + logger.error("Metric value for {} is null", metric); + throw new IllegalArgumentException("Metric value cannot be null"); + } + Object convertedValue = applyConvert(metric, metricValue, props); + BigDecimal val = applyMultiplier(metric, convertedValue, props); + BigDecimal deltaValue = applyDelta(metric, val, props); + return deltaValue; + } + + private BigDecimal applyDelta(String metric, BigDecimal val, MetricProperties props) { + if (props.isDelta()) { + return deltaCalculator.calculateDelta(metric, val); + } + return val; + } + + private BigDecimal applyMultiplier(String metricName, Object metricValue, MetricProperties props) { + try { + BigDecimal bigD = new BigDecimal(metricValue.toString()); + double multiplier = props.getMultiplier(); + bigD = bigD.multiply(new BigDecimal(multiplier)); + return bigD; + } catch (NumberFormatException nfe) { + logger.error("Cannot convert into BigDecimal {} value for metric {}.", metricValue, metricName, nfe); + } + throw new IllegalArgumentException("Cannot convert into BigInteger " + metricValue); + } + + private Object applyConvert(String metricName, Object metricValue, MetricProperties props) { + //get converted values if configured + if (props.getConversionValues() != null && !props.getConversionValues().isEmpty()) { + Object convertedValue = props.getConversionValues().get(metricValue); + if (convertedValue != null) { + logger.debug("Applied conversion on {} and replaced value {} with {}", metricName, metricValue, convertedValue); + return convertedValue; + } else { + + if (props.getConversionValues().get("$default") != null) { + logger.debug("Choosing the $default value to go with {} for conversion", metricValue); + return props.getConversionValues().get("$default"); + } + } + } + return metricValue; + } +} \ No newline at end of file diff --git a/src/main/java/com/appdynamics/extensions/wmb/resourcestats/ResourceStatsProcessor.java b/src/main/java/com/appdynamics/extensions/wmb/resourcestats/ResourceStatsProcessor.java index 7d5a52e..cf8cce4 100644 --- a/src/main/java/com/appdynamics/extensions/wmb/resourcestats/ResourceStatsProcessor.java +++ b/src/main/java/com/appdynamics/extensions/wmb/resourcestats/ResourceStatsProcessor.java @@ -1,11 +1,13 @@ package com.appdynamics.extensions.wmb.resourcestats; -import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; -import com.appdynamics.extensions.metrics.Metric; import com.appdynamics.extensions.wmb.StatsProcessor; import com.appdynamics.extensions.wmb.XmlParser; +import com.appdynamics.extensions.wmb.metricUtils.Metric; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; +import com.appdynamics.extensions.wmb.metricUtils.MetricProperties; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jms.*; import javax.xml.bind.JAXBException; @@ -21,11 +23,11 @@ public class ResourceStatsProcessor extends StatsProcessor implements Mess private static final Logger logger = ExtensionsLoggerFactory.getLogger(ResourceStatsProcessor.class); private static final String EXECUTION_GROUP_NAME = "executionGroupName"; - private static final String SEPARATOR = "|"; - private Map metricPropsHolder; - public ResourceStatsProcessor(Map config, XmlParser parser, MetricWriteHelper metricWriteHelper, String metricPrefix) { - super(config,parser,metricWriteHelper,metricPrefix); + private Map metricPropsHolder; + + public ResourceStatsProcessor(Map config, XmlParser parser, MetricPrinter printer) { + super(config,parser,printer); this.metricPropsHolder = buildMetricProperties("metrics","resourceStatistics"); } @@ -47,16 +49,16 @@ public void subscribe(Session session) throws JMSException { * @param message */ public void onMessage(Message message) { - long startTime = System.currentTimeMillis(); + long startTime = System.currentTimeMillis(); String text = null; try { - text = getMessageString(message); + text = getMessageString(message); if(text != null) { try { T resourceStatistics = parser.parse(text); if (resourceStatistics != null) { List metrics = buildMetrics(resourceStatistics); - metricWriteHelper.transformAndPrintMetrics(metrics); + printer.reportMetrics(metrics); } } catch (JAXBException e) { logger.error("Unable to unmarshal XML message {}", text,e); @@ -75,6 +77,7 @@ protected List buildMetrics(T stats) { ResourceStatistics resourceStatistics = (ResourceStatistics) stats; List metrics = new ArrayList(); if(resourceStatistics != null){ + //String brokerName = resourceStatistics.getAttributes().get(new QName(BROKER_LABEL)); String executionGroupName = resourceStatistics.getAttributes().get(new QName(EXECUTION_GROUP_NAME)); if(resourceStatistics.getResourceType() != null){ for(ResourceType resourceType : resourceStatistics.getResourceType()){ @@ -84,13 +87,15 @@ protected List buildMetrics(T stats) { String resourceIdName = resourceIdentifier.getName(); for (QName key: resourceIdentifier.getAttributes().keySet()) { String resourceMetric = join(SEPARATOR,resourceTypeName,resourceIdName,key.toString()); - Map resourceMetricProps = metricPropsHolder.get(resourceMetric); + MetricProperties resourceMetricProps = metricPropsHolder.get(resourceMetric); if(resourceMetricProps != null){ String value = resourceIdentifier.getAttributes().get(key); String metricPath = join(SEPARATOR,executionGroupName, "Resource Statistics", resourceTypeName, resourceIdName); - Metric metric = new Metric(key.toString(),value,metricPrefix+SEPARATOR+metricPath+SEPARATOR+resourceMetricProps.get("alias"),resourceMetricProps); - metrics.add(metric); + Metric metricPoint = createMetricPoint(metricPath,value,resourceMetricProps,key.toString()); + if(metricPoint != null){ + metrics.add(metricPoint); + } } } } @@ -100,4 +105,4 @@ protected List buildMetrics(T stats) { } return metrics; } -} +} \ No newline at end of file diff --git a/src/main/resources/appd-message-broker-monitor.bat b/src/main/resources/appd-message-broker-monitor.bat index 09eadf2..8831421 100755 --- a/src/main/resources/appd-message-broker-monitor.bat +++ b/src/main/resources/appd-message-broker-monitor.bat @@ -22,6 +22,6 @@ FOR /f "tokens=1" %%a in ('wmic process where ^(processid^=!CURR_PROCESS_ID!^) g ) REM ****Pass MA process id to the java process**** -..\..\jre\bin\java -cp ".\*;..\..\machineagent.jar;C:\Program Files\IBM\MQ\java\lib\*" -Djava.library.path="C:\Program Files\IBM\MQ\java\lib64" -Dlog4j.configuration=file:.\log4j.xml -Dextension.configuration=.\monitors\WMBMonitor\config.yml com.appdynamics.extensions.wmb.WMBMonitor !PARENT_PROCESS_ID! +..\..\jre\bin\java -cp ".\*;..\..\machineagent.jar;C:\Program Files\IBM\MQ\java\lib\*" -Djava.library.path="C:\Program Files\IBM\MQ\java\lib64" -Dlog4j.configurationFile=.\log4j2.xml -Dextension.configuration=.\monitors\WMBMonitor\config.yml com.appdynamics.extensions.wmb.WMBMonitor !PARENT_PROCESS_ID! endlocal diff --git a/src/main/resources/appd-message-broker-monitor.sh b/src/main/resources/appd-message-broker-monitor.sh index 4b7c24d..57a4e6b 100755 --- a/src/main/resources/appd-message-broker-monitor.sh +++ b/src/main/resources/appd-message-broker-monitor.sh @@ -1,6 +1,6 @@ #!/bin/bash #Passing machine agent process id to java process. -../../jre/bin/java -cp "./*:../../machineagent.jar:/opt/mqm/java/lib/*" -Djava.library.path="/opt/mqm/java/lib64" -Dlog4j.configuration=file:./log4j.xml -Dextension.configuration=./monitors/WMBMonitor/config.yml com.appdynamics.extensions.wmb.WMBMonitor $PPID +../../jre/bin/java -cp "./*:../../machineagent.jar:/opt/mqm/java/lib/*" -Djava.library.path="/opt/mqm/java/lib64" -Dlog4j.configurationFile=./log4j2.xml -Dextension.configuration=./monitors/WMBMonitor/config.yml com.appdynamics.extensions.wmb.WMBMonitor $PPID exit $? diff --git a/src/main/resources/conf/config.yml b/src/main/resources/conf/config.yml index 42be8aa..fac04fd 100644 --- a/src/main/resources/conf/config.yml +++ b/src/main/resources/conf/config.yml @@ -58,231 +58,145 @@ queueManagers: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - type: "JMS" identifiers: ["summary"] include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - type: "Sockets" identifiers: ["summary"] include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - type: "TCPIPClientNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - type: "TCPIPServerNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "MinimumElapsedTime" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread - alias: "TotalNumberOfInputMessages" - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - alias: "MinimumSizeOfInputMessages" + - TotalNumberOfInputMessages : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) - alias: "MaximumElapsedTime" - - name : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) - alias: "MinimumElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) - alias: "MaximumCPUTime" - - name : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) - alias: "MinimumCPUTime" - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - name: "NumberOfInputTerminals" #Number of input terminals - alias: "NumberOfInputTerminals" - - name : "NumberOfOutputTerminals" #Number of output terminals - alias: "NumberOfOutputTerminals" + - Number: "Number" #Number of node statistics subfolders in Nodes folder + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + - NumberOfInputTerminals: "NumberOfInputTerminals" #Number of input terminals + - NumberOfOutputTerminals : "NumberOfOutputTerminals" #Number of output terminals - type: "Nodes" identifiers: ["NodeStatistics|TerminalStatistics"] include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node derivedMetrics: flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" #Don't change this unless you are having more than 10 queue managers to monitor. @@ -293,4 +207,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/main/resources/conf/log4j.xml b/src/main/resources/conf/log4j2.xml similarity index 92% rename from src/main/resources/conf/log4j.xml rename to src/main/resources/conf/log4j2.xml index ad9d598..9395ad6 100644 --- a/src/main/resources/conf/log4j.xml +++ b/src/main/resources/conf/log4j2.xml @@ -1,6 +1,5 @@ - @@ -21,9 +20,11 @@ + + diff --git a/src/test/java/com/appdynamics/extensions/wmb/flowStats/FlowStatsProcessorTest.java b/src/test/java/com/appdynamics/extensions/wmb/flowStats/FlowStatsProcessorTest.java index 2247f04..0574752 100644 --- a/src/test/java/com/appdynamics/extensions/wmb/flowStats/FlowStatsProcessorTest.java +++ b/src/test/java/com/appdynamics/extensions/wmb/flowStats/FlowStatsProcessorTest.java @@ -1,14 +1,15 @@ package com.appdynamics.extensions.wmb.flowStats; + import com.appdynamics.extensions.MetricWriteHelper; -import com.appdynamics.extensions.metrics.Metric; import com.appdynamics.extensions.wmb.ParserFactory; import com.appdynamics.extensions.wmb.flowstats.FlowStatistics; import com.appdynamics.extensions.wmb.flowstats.FlowStatsProcessor; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; +import com.appdynamics.extensions.wmb.resourcestats.ResourceStatsProcessor; import com.appdynamics.extensions.yml.YmlReader; import com.google.common.base.Charsets; -import com.google.common.collect.Maps; import com.google.common.io.Files; import org.junit.Assert; import org.junit.Test; @@ -19,10 +20,10 @@ import javax.xml.bind.JAXBException; import java.io.File; import java.io.IOException; -import java.math.BigDecimal; import java.util.List; import java.util.Map; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.*; public class FlowStatsProcessorTest { @@ -31,20 +32,17 @@ public class FlowStatsProcessorTest { @Test public void canParseXmlMessageSuccessfully() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/config.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m : (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); - Assert.assertTrue(metricMap.containsValue("1289")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); + Assert.assertTrue(valueCaptor.getAllValues().contains("1289")); } @Test @@ -53,99 +51,89 @@ public void shouldNotThrowErrorWhenMessageIsNull() throws IOException, JMSExcept FlowStatsProcessor processor = getFlowStatProcessor("/conf/config.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(null); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,never()).transformAndPrintMetrics(pathCaptor.capture()); + verify(writer,never()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); } + @Test public void shouldCalculateCorrectDerivedMetricWhenDerivedMetricConfigured() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/config.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|AverageCPUTimeWaitingForInputMessage")); - Assert.assertTrue(metricMap.get("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|AverageCPUTimeWaitingForInputMessage").equals("26")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|AverageElapsedTimeWaitingForInputMessage")); - Assert.assertTrue(metricMap.get("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|AverageElapsedTimeWaitingForInputMessage").equals("200034")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|HTTP Input|AverageCPUTime")); - Assert.assertTrue(metricMap.get("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|HTTP Input|AverageCPUTime").equals("2")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|AverageCPUTimeWaitingForInputMessage")); + Assert.assertTrue(valueCaptor.getAllValues().contains("26")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|AverageElapsedTimeWaitingForInputMessage")); + Assert.assertTrue(valueCaptor.getAllValues().contains("200034")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|HTTP Input|AverageCPUTime")); + Assert.assertTrue(valueCaptor.getAllValues().contains("2")); } @Test public void shouldNotEmitDerivedStatsWhenDerivedAreNotConfigured() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithNoDerivedMetrics.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|AverageElapsedTimeWaitingForInputMessage")); - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|HTTP Input|AverageCPUTime")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|AverageElapsedTimeWaitingForInputMessage")); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|HTTP Input|AverageCPUTime")); + } + @Test public void shouldNotEmitFlowStatsWhenFlowStatsAreNotConfigured() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithNoFlowStatsConfiguration.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); + } @Test public void shouldEmitFlowStatsIncludedWhenIncludeClausesAreConfigured() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|FAILQueue|TerminalStatistics|failure|CountOfInvocations")); - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|FAILQueue|TerminalStatistics|failure|CountOfInvocations")); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Threads|ThreadStatistics|16375|TotalSizeOfInputMessages")); } @Test public void shouldEmitMetricAliasWhenMetricsAreIncluded() throws JAXBException, JMSException, IOException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|Minimum Elapsed Time")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|Minimum CPU Time")); } @Test @@ -154,34 +142,31 @@ public void shouldEmitRightMetricTypeWhenMetricTypeIsConfigured() throws JAXBExc FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor aggCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor timeRollupCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor clusterRollupCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|AverageCPUTime")){ - Assert.assertTrue(m.getMetricValue().equals("0")); - Assert.assertTrue(m.getAggregationType().equals("OBSERVATION")); - Assert.assertTrue(m.getTimeRollUpType().equals("CURRENT")); - Assert.assertTrue(m.getClusterRollUpType().equals("INDIVIDUAL")); - } - } + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),anyString(),aggCaptor.capture(),timeRollupCaptor.capture(),clusterRollupCaptor.capture()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|AverageCPUTime")); + Assert.assertTrue(aggCaptor.getAllValues().contains("OBSERVATION")); + Assert.assertTrue(timeRollupCaptor.getAllValues().contains("CURRENT")); + Assert.assertTrue(clusterRollupCaptor.getAllValues().contains("INDIVIDUAL")); } @Test - public void shouldEmitRightMultiplierValueWhenMultiplierIsConfigured() throws JAXBException, JMSException, IOException { + public void shouldEmitRightMetricValueWhenMultiplierIsConfigured() throws JAXBException, JMSException, IOException { MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); processor.onMessage(mockMsg); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")){ - Assert.assertTrue(m.getMetricProperties().getMultiplier().equals(new BigDecimal("0.001"))); - } - } + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalElapsedTime")); + Assert.assertTrue(valueCaptor.getAllValues().contains("1000")); } @@ -191,36 +176,29 @@ public void shouldEmitDeltaMetricValueWhenDeltaIsConfigured() throws JAXBExcepti FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); + TextMessage mockMsg1 = mock(TextMessage.class); + when(mockMsg1.getText()).thenReturn(getFileContents("/flowStats1.xml")); processor.onMessage(mockMsg); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m:(List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalNumberOfMQErrors")){ - Assert.assertTrue(m.getMetricProperties().getDelta()); - } - } + processor.onMessage(mockMsg1); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|MessageFlow|TotalNumberOfMQErrors")); + Assert.assertTrue(valueCaptor.getAllValues().contains("100")); } @Test public void shouldEmitConvertedValueWhenConvertIsConfigured() throws JAXBException, JMSException, IOException { - Map expectedConversionMap = Maps.newHashMap(); - expectedConversionMap.put("WSInputNode",1); - expectedConversionMap.put("WSReplyNode",2); - expectedConversionMap.put("MSLMappingNode",3); - expectedConversionMap.put("$default",4); - MetricWriteHelper writer = mock(MetricWriteHelper.class); FlowStatsProcessor processor = getFlowStatProcessor("/conf/configWithSomeFlowStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/flowStats.xml")); processor.onMessage(mockMsg); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|FAILQueue|Type")){ - Assert.assertTrue(m.getMetricProperties().getConversionValues().equals(expectedConversionMap)); - } - } + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Flow Statistics|Nodes|NodeStatistics|FAILQueue|Type")); + Assert.assertTrue(valueCaptor.getAllValues().contains("4")); } @@ -234,7 +212,8 @@ private FlowStatsProcessor getFlowStatProcessor(String configFil Map configMap = YmlReader.readFromFileAsMap(new File(this.getClass().getResource(configFile).getFile())); List qMgrs = (List)configMap.get("queueManagers"); Map qMgrConfig = qMgrs.get(0); - FlowStatsProcessor processor = new FlowStatsProcessor(qMgrConfig,parserFactory.getFlowStatisticsParser(),writer,"Custom Metrics|WMB|QMgr1"); + MetricPrinter printer = new MetricPrinter("Custom Metrics|WMB","QMgr1",writer); + FlowStatsProcessor processor = new FlowStatsProcessor(qMgrConfig,parserFactory.getFlowStatisticsParser(),printer); return processor; } -} +} \ No newline at end of file diff --git a/src/test/java/com/appdynamics/extensions/wmb/resourceStats/ResourceStatsProcessorTest.java b/src/test/java/com/appdynamics/extensions/wmb/resourceStats/ResourceStatsProcessorTest.java index d4b796c..b2528cb 100644 --- a/src/test/java/com/appdynamics/extensions/wmb/resourceStats/ResourceStatsProcessorTest.java +++ b/src/test/java/com/appdynamics/extensions/wmb/resourceStats/ResourceStatsProcessorTest.java @@ -1,14 +1,14 @@ package com.appdynamics.extensions.wmb.resourceStats; + import com.appdynamics.extensions.MetricWriteHelper; -import com.appdynamics.extensions.metrics.Metric; +import com.appdynamics.extensions.wmb.metricUtils.MetricPrinter; import com.appdynamics.extensions.wmb.ParserFactory; import com.appdynamics.extensions.wmb.resourcestats.ResourceStatistics; import com.appdynamics.extensions.wmb.resourcestats.ResourceStatsProcessor; import com.appdynamics.extensions.yml.YmlReader; import com.google.common.base.Charsets; -import com.google.common.collect.Maps; import com.google.common.io.Files; import org.junit.Assert; import org.junit.Test; @@ -19,10 +19,10 @@ import javax.xml.bind.JAXBException; import java.io.File; import java.io.IOException; -import java.math.BigDecimal; import java.util.List; import java.util.Map; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.*; public class ResourceStatsProcessorTest { @@ -31,20 +31,17 @@ public class ResourceStatsProcessorTest { @Test public void canParseXmlMessageSuccessfully() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); ResourceStatsProcessor processor = getResourceStatProcessor("/conf/config.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|summary|InitialMemoryInMB")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|Sockets|summary|TotalDataSent_KB")); - Assert.assertTrue(metricMap.containsValue("256")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|summary|InitialMemoryInMB")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|Sockets|summary|TotalDataSent_KB")); + Assert.assertTrue(valueCaptor.getAllValues().contains("256")); } @Test @@ -53,9 +50,10 @@ public void shouldNotThrowErrorWhenMessageIsNull() throws IOException, JMSExcept ResourceStatsProcessor processor = getResourceStatProcessor("/conf/config.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(null); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,never()).transformAndPrintMetrics(pathCaptor.capture()); + verify(writer,never()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); } @Test @@ -64,48 +62,41 @@ public void shouldNotEmitResourceStatsWhenResourceStatsAreNotConfigured() throws ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithNoResourceStatsConfiguration.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer).transformAndPrintMetrics(pathCaptor.capture()); - List metricList = (List)pathCaptor.getValue(); - Assert.assertTrue(metricList.isEmpty()); + verify(writer,never()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); } @Test public void shouldEmitResourceStatsIncludedWhenIncludeClausesAreConfigured() throws IOException, JMSException, JAXBException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithSomeResourceStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|summary|InitialMemoryInMB")); - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|Garbage Collection - MarkSweepCompact|CumulativeNumberOfGCCollections")); - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|Sockets|summary|TotalDataSent_KB")); - Assert.assertTrue(metricMap.containsValue("256")); - Assert.assertFalse(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|TCPIPClientNodes|summary|BytesReceived")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|summary|InitialMemoryInMB")); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JVM|Garbage Collection - MarkSweepCompact|CumulativeNumberOfGCCollections")); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|Sockets|summary|TotalDataSent_KB")); + Assert.assertTrue(valueCaptor.getAllValues().contains("256")); + Assert.assertFalse(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|Parsers|summary|ApproxMemKB")); } @Test public void shouldEmitMetricAliasWhenMetricsAreIncluded() throws JAXBException, JMSException, IOException { - Map metricMap = Maps.newHashMap(); MetricWriteHelper writer = mock(MetricWriteHelper.class); ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithSomeResourceStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - metricMap.put(m.getMetricPath(),m.getMetricValue()); - } - Assert.assertTrue(metricMap.containsKey("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|This is max pool")); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|This is max pool")); } @Test @@ -114,34 +105,31 @@ public void shouldEmitRightMetricTypeWhenMetricTypeIsConfigured() throws JAXBExc ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithSomeResourceStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor aggCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor timeRollupCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor clusterRollupCaptor = ArgumentCaptor.forClass(String.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeTimedOutRequests")){ - Assert.assertTrue(m.getMetricValue().equals("1000000")); - Assert.assertTrue(m.getAggregationType().equals("OBSERVATION")); - Assert.assertTrue(m.getTimeRollUpType().equals("CURRENT")); - Assert.assertTrue(m.getClusterRollUpType().equals("INDIVIDUAL")); - } - } + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),anyString(),aggCaptor.capture(),timeRollupCaptor.capture(),clusterRollupCaptor.capture()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeTimedOutRequests")); + Assert.assertTrue(aggCaptor.getAllValues().contains("OBSERVATION")); + Assert.assertTrue(timeRollupCaptor.getAllValues().contains("CURRENT")); + Assert.assertTrue(clusterRollupCaptor.getAllValues().contains("INDIVIDUAL")); } @Test - public void shouldEmitRightMultiplierValueWhenMultiplierIsConfigured() throws JAXBException, JMSException, IOException { + public void shouldEmitRightMetricValueWhenMultiplierIsConfigured() throws JAXBException, JMSException, IOException { MetricWriteHelper writer = mock(MetricWriteHelper.class); ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithSomeResourceStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); processor.onMessage(mockMsg); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeTimedOutRequests")){ - Assert.assertTrue(m.getMetricProperties().getMultiplier().equals(new BigDecimal("0.5"))); - } - } + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeTimedOutRequests")); + Assert.assertTrue(valueCaptor.getAllValues().contains("500000")); } @@ -151,14 +139,15 @@ public void shouldEmitDeltaMetricValueWhenDeltaIsConfigured() throws JAXBExcepti ResourceStatsProcessor processor = getResourceStatProcessor("/conf/configWithSomeResourceStatsIncludesMissing.yml",writer); TextMessage mockMsg = mock(TextMessage.class); when(mockMsg.getText()).thenReturn(getFileContents("/resourceStats.xml")); + TextMessage mockMsg1 = mock(TextMessage.class); + when(mockMsg1.getText()).thenReturn(getFileContents("/resourceStats2.xml")); processor.onMessage(mockMsg); - ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - verify(writer,atLeastOnce()).transformAndPrintMetrics(pathCaptor.capture()); - for(Metric m: (List)pathCaptor.getValue()){ - if(m.getMetricPath().equals("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeDelayedRequests")){ - Assert.assertTrue(m.getMetricProperties().getDelta()); - } - } + processor.onMessage(mockMsg1); + ArgumentCaptor metricPathCaptor = ArgumentCaptor.forClass(String.class); + ArgumentCaptor valueCaptor = ArgumentCaptor.forClass(String.class); + verify(writer,atLeastOnce()).printMetric(metricPathCaptor.capture(),valueCaptor.capture(),anyString(),anyString(),anyString()); + Assert.assertTrue(metricPathCaptor.getAllValues().contains("Custom Metrics|WMB|QMgr1|default|Resource Statistics|JDBCConnectionPools|summary|CumulativeDelayedRequests")); + Assert.assertTrue(valueCaptor.getAllValues().contains("750")); } private String getFileContents(String filepath) throws IOException { @@ -171,8 +160,9 @@ private ResourceStatsProcessor getResourceStatProcessor(Stri Map configMap = YmlReader.readFromFileAsMap(new File(this.getClass().getResource(configFile).getFile())); List qMgrs = (List)configMap.get("queueManagers"); Map qMgrConfig = qMgrs.get(0); - ResourceStatsProcessor processor = new ResourceStatsProcessor(qMgrConfig,parserFactory.getResourceStatisticsParser(),writer,"Custom Metrics|WMB|QMgr1"); + MetricPrinter printer = new MetricPrinter("Custom Metrics|WMB","QMgr1",writer); + ResourceStatsProcessor processor = new ResourceStatsProcessor(qMgrConfig,parserFactory.getResourceStatisticsParser(),printer); return processor; } -} +} \ No newline at end of file diff --git a/src/test/resources/conf/config.yml b/src/test/resources/conf/config.yml index c56791a..26f4743 100644 --- a/src/test/resources/conf/config.yml +++ b/src/test/resources/conf/config.yml @@ -58,231 +58,145 @@ queueManagers: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - type: "JMS" identifiers: ["summary"] include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - type: "Sockets" identifiers: ["summary"] include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - type: "TCPIPClientNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - type: "TCPIPServerNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. + flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "MinimumElapsedTime" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread - alias: "TotalNumberOfInputMessages" - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - alias: "MinimumSizeOfInputMessages" + - TotalNumberOfInputMessages : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) - alias: "MaximumElapsedTime" - - name : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) - alias: "MinimumElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) - alias: "MaximumCPUTime" - - name : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) - alias: "MinimumCPUTime" - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - name: "NumberOfInputTerminals" #Number of input terminals - alias: "NumberOfInputTerminals" - - name : "NumberOfOutputTerminals" #Number of output terminals - alias: "NumberOfOutputTerminals" + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + - NumberOfInputTerminals: "NumberOfInputTerminals" #Number of input terminals + - NumberOfOutputTerminals : "NumberOfOutputTerminals" #Number of output terminals - type: "Nodes" identifiers: ["NodeStatistics|TerminalStatistics"] include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node derivedMetrics: flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" #Don't change this unless you are having more than 10 queue managers to monitor. @@ -293,4 +207,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/test/resources/conf/configWithNoDerivedMetrics.yml b/src/test/resources/conf/configWithNoDerivedMetrics.yml index 95c2c0b..87e2953 100644 --- a/src/test/resources/conf/configWithNoDerivedMetrics.yml +++ b/src/test/resources/conf/configWithNoDerivedMetrics.yml @@ -53,202 +53,126 @@ queueManagers: #Remove fields you don't need to reduce the number of metricUtils. #Available fields: #https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bn43250_.htm - metrics: resourceStatistics: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - type: "JMS" identifiers: ["summary"] include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - type: "Sockets" identifiers: ["summary"] include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - type: "TCPIPClientNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - type: "TCPIPServerNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "MinimumElapsedTime" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread - alias: "TotalNumberOfInputMessages" - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - alias: "MinimumSizeOfInputMessages" + - TotalNumberOfInputMessages : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) - alias: "MaximumElapsedTime" - - name : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) - alias: "MinimumElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) - alias: "MaximumCPUTime" - - name : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) - alias: "MinimumCPUTime" - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - name: "NumberOfInputTerminals" #Number of input terminals - alias: "NumberOfInputTerminals" - - name : "NumberOfOutputTerminals" #Number of output terminals - alias: "NumberOfOutputTerminals" + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + - NumberOfInputTerminals: "NumberOfInputTerminals" #Number of input terminals + - NumberOfOutputTerminals : "NumberOfOutputTerminals" #Number of output terminals - type: "Nodes" identifiers: ["NodeStatistics|TerminalStatistics"] include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + #Don't change this unless you are having more than 10 queue managers to monitor. numberOfThreads: 10 @@ -258,4 +182,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/test/resources/conf/configWithNoFlowStatsConfiguration.yml b/src/test/resources/conf/configWithNoFlowStatsConfiguration.yml index e44a803..a0ee00c 100644 --- a/src/test/resources/conf/configWithNoFlowStatsConfiguration.yml +++ b/src/test/resources/conf/configWithNoFlowStatsConfiguration.yml @@ -58,138 +58,89 @@ queueManagers: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - type: "JMS" identifiers: ["summary"] include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - type: "Sockets" identifiers: ["summary"] include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - type: "TCPIPClientNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - type: "TCPIPServerNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. derivedMetrics: flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" #Don't change this unless you are having more than 10 queue managers to monitor. @@ -200,4 +151,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/test/resources/conf/configWithNoResourceStatsConfiguration.yml b/src/test/resources/conf/configWithNoResourceStatsConfiguration.yml index 8da2ea6..e12c52d 100644 --- a/src/test/resources/conf/configWithNoResourceStatsConfiguration.yml +++ b/src/test/resources/conf/configWithNoResourceStatsConfiguration.yml @@ -56,132 +56,84 @@ queueManagers: metrics: flowStatistics: - type: "MessageFlow" - identifiers: [""] + indentifiers: [""] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "MinimumElapsedTime" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread - alias: "TotalNumberOfInputMessages" - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - alias: "MinimumSizeOfInputMessages" + - TotalNumberOfInputMessages : "TotalNumberOfInputMessages" #Total number of messages that are processed by a thread + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" #Total elapsed time that is spent waiting for input messages (microseconds) + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum size of input messages (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum size of input messages (bytes) - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - - name : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) - alias: "MaximumElapsedTime" - - name : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) - alias: "MinimumElapsedTime" - - name : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) - alias: "MaximumCPUTime" - - name : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) - alias: "MinimumCPUTime" - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" - - name: "NumberOfInputTerminals" #Number of input terminals - alias: "NumberOfInputTerminals" - - name : "NumberOfOutputTerminals" #Number of output terminals - alias: "NumberOfOutputTerminals" + - Number: "Number" #Number of node statistics subfolders in Nodes folder + - TotalElapsedTime: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time spent processing input messages (microseconds) + - MinimumElapsedTime : "MinimumElapsedTime" #Minimum elapsed time spent processing input messages (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time spent processing input messages (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time spent processing input messages (microseconds) + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node + - NumberOfInputTerminals: "NumberOfInputTerminals" #Number of input terminals + - NumberOfOutputTerminals : "NumberOfOutputTerminals" #Number of output terminals - type: "Nodes" identifiers: ["NodeStatistics|TerminalStatistics"] include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node derivedMetrics: flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" #Don't change this unless you are having more than 10 queue managers to monitor. @@ -192,4 +144,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/test/resources/conf/configWithNullFields.yml b/src/test/resources/conf/configWithNullFields.yml index a216be8..726fb9a 100755 --- a/src/test/resources/conf/configWithNullFields.yml +++ b/src/test/resources/conf/configWithNullFields.yml @@ -66,4 +66,4 @@ queueManagers: threadFields: nodeFields: -numberOfThreads: 10 +numberOfThreads: 10 \ No newline at end of file diff --git a/src/test/resources/conf/configWithSomeFlowStatsIncludesMissing.yml b/src/test/resources/conf/configWithSomeFlowStatsIncludesMissing.yml index ba4e952..05c60c9 100644 --- a/src/test/resources/conf/configWithSomeFlowStatsIncludesMissing.yml +++ b/src/test/resources/conf/configWithSomeFlowStatsIncludesMissing.yml @@ -58,149 +58,91 @@ queueManagers: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "MaxSizeOfPool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" + - MaxSizeOfPool : "MaxSizeOfPool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - type: "JMS" identifiers: ["summary"] include: - - name : "NumberOfOpenJMSConnections" #The current number of open JMS connections. - alias: "NumberOfOpenJMSConnections" - - name : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. - alias: "NumberOfClosedJMSConnections" - - name : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. - alias: "NumberOfOpenJMSSessions" - - name : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. - alias: "NumberOfClosedJMSSessions" - - name : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. - alias: "NumberOfMessagesReceived" - - name : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. - alias: "NumberOfMessagesSent" - - name : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. - alias: "NumberOfMessagesBrowsed" - - name : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - alias: "NumberOfJMSConnectionFailures" + - NumberOfOpenJMSConnections : "NumberOfOpenJMSConnections" #The current number of open JMS connections. + - NumberOfClosedJMSConnections : "NumberOfClosedJMSConnections" #The total number of JMS connections that were closed since the last integration server restart. + - NumberOfOpenJMSSessions : "NumberOfOpenJMSSessions" #The current number of open JMS sessions. + - NumberOfClosedJMSSessions : "NumberOfClosedJMSSessions" #The total number of JMS sessions that were closed since the last integration server restart. + - NumberOfMessagesReceived : "NumberOfMessagesReceived" #The total number of messages received by JMSInput or JMSReceive nodes. + - NumberOfMessagesSent : "NumberOfMessagesSent" #The total number of messages sent by JMSOutput nodes. + - NumberOfMessagesBrowsed : "NumberOfMessagesBrowsed" #The total number of messages browsed by JMSReceive nodes. + - NumberOfJMSConnectionFailures : "NumberOfJMSConnectionFailures" #The total number of attempted JMS connections that failed since the last integration server restarts. - type: "Sockets" identifiers: ["summary"] include: - - name : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. - alias: "TotalSockets" - - name : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. - alias: "TotalMessages" - - name : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). - alias: "TotalDataSent_KB" - - name : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). - alias: "TotalDataReceived_KB" - - name : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - alias: "SentMessageSize_10KB-100KB" + - TotalSockets : "TotalSockets" #The number of outbound sockets that have been opened since the last integration server restart. + - TotalMessages : "TotalMessages" #The number of requests for a socket; for example, from a SOAPRequest node. + - TotalDataSent_KB : "TotalDataSent_KB" #The number of bytes sent, in kilobytes (KB). + - TotalDataReceived_KB : "TotalDataReceived_KB" #The number of bytes received, in kilobytes (KB). + - SentMessageSize_10KB-100KB : "SentMessageSize_10KB-100KB" #The number of messages sent in each size range. For example, a message of 999 bytes is counted in SentMessageSize_0-1KB; a message of 1000 bytes is counted in SentMessageSize_1KB-10KB. - type: "TCPIPClientNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - type: "TCPIPServerNodes" identifiers: ["summary"] include: - - name: "OpenConnections" #The current number of open connections - alias: "OpenConnections" - - name: "ClosedConnections" #The total number of connections that were closed since the last integration server restart - alias: "ClosedConnections" - - name: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) - alias: "MessagesReceived" - - name : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) - alias: "MessagesSent" - - name : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. - alias: "BytesSent" - - name: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. - alias: "BytesReceived" - - name : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. - alias: "FailedConnections" + - OpenConnections: "OpenConnections" #The current number of open connections + - ClosedConnections: "ClosedConnections" #The total number of connections that were closed since the last integration server restart + - MessagesReceived: "MessagesReceived" #The total number of messages received (by TCPIPClientInput or TCPIPClientReceive nodes) + - MessagesSent : "MessagesSent" #The total number of messages sent (by TCPIPClientOutput nodes) + - BytesSent : "BytesSent" #The total amount of data sent (by TCPIPClientOutput nodes), excluding SSL wrappers. + - BytesReceived: "BytesReceived" #The total amount of data received (by TCPIPClientInput or TCPIPClientReceive nodes), excluding SSL wrappers. + - FailedConnections : "FailedConnections" #The total number of attempted connections that failed since the last integration server restarts. flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name: "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) - alias: "TotalElapsedTime" - multiplier: "0.001" - - name: "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) - alias: "MaximumElapsedTime" - - name: "MinimumElapsedTime" #Minimum elapsed time that is spent processing an input message (microseconds) - alias: "Minimum Elapsed Time" - - name: "TotalCPUTime" #Total processor time spent processing input messages (microseconds) - alias: "TotalCPUTime" - - name: "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) - alias: "MaximumCPUTime" - - name: "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) - alias: "MinimumCPUTime" - - name: "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) - alias: "CPUTimeWaitingForInputMessage" - - name: "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) - alias: "ElapsedTimeWaitingForInputMessage" - - name: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. - alias: "TotalInputMessages" - - name : "TotalSizeOfInputMessages" #Total size of input messages (bytes) - alias: "TotalSizeOfInputMessages" - - name : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) - alias: "MaximumSizeOfInputMessages" - - name : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) - alias: "MinimumSizeOfInputMessages" - - name : "NumberOfThreadsInPool" #Number of threads in pool - alias: "NumberOfThreadsInPool" - - name : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached - alias: "TimesMaximumNumberofThreadsReached" - - name : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. - alias: "TotalNumberOfMQErrors" + - TotalElapsedTime : "TotalElapsedTime" #Total elapsed time spent processing input messages (microseconds) + multiplier: 0.001 + - MaximumElapsedTime : "MaximumElapsedTime" #Maximum elapsed time that is spent processing an input message (microseconds) + - MinimumElapsedTime : "Minimum CPU Time" #Minimum elapsed time that is spent processing an input message (microseconds) + - TotalCPUTime : "TotalCPUTime" #Total processor time spent processing input messages (microseconds) + - MaximumCPUTime : "MaximumCPUTime" #Maximum processor time that is spent processing an input message (microseconds) + - MinimumCPUTime : "MinimumCPUTime" #Minimum processor time that is spent processing an input message (microseconds) + - CPUTimeWaitingForInputMessage : "CPUTimeWaitingForInputMessage" #Total processor time spent waiting for input messages (microseconds) + - ElapsedTimeWaitingForInputMessage : "ElapsedTimeWaitingForInputMessage" # Total elapsed time that is spent waiting for input messages (microseconds) + - TotalInputMessages: "TotalInputMessages" #Total number of messages processed.TotalInputMessages records only those messages that are propagated from input node terminals. + - TotalSizeOfInputMessages : "TotalSizeOfInputMessages" #Total size of input messages (bytes) + - MaximumSizeOfInputMessages : "MaximumSizeOfInputMessages" #Maximum input message size (bytes) + - MinimumSizeOfInputMessages : "MinimumSizeOfInputMessages" #Minimum message input size (bytes) + - NumberOfThreadsInPool : "NumberOfThreadsInPool" #Number of threads in pool + - TimesMaximumNumberofThreadsReached : "TimesMaximumNumberofThreadsReached" #Number of times the maximum number of threads is reached + - TotalNumberOfMQErrors : "TotalNumberOfMQErrors" #Number of MQGET errors (MQInput node) or web services errors (HTTPInput node). For example, a conversion error occurs when the message is got from the queue. delta: true - - name : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors - alias: "TotalNumberOfMessagesWithErrors" - - name : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message - alias: "TotalNumberOfErrorsProcessingMessages" - - name : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) - alias: "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" - - name : "TotalNumberOfCommits" #Number of transaction commits - alias: "TotalNumberOfCommits" - - name : "TotalNumberOfBackouts" #Number of transaction backouts - alias: "TotalNumberOfBackouts" + - TotalNumberOfMessagesWithErrors : "TotalNumberOfMessagesWithErrors" #Number of messages that contain errors + - TotalNumberOfErrorsProcessingMessages : "TotalNumberOfErrorsProcessingMessages" #Number of errors when processing a message + - TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages : "TotalNumberOfTimeOutsWaitingForRepliesToAggregateMessages" #Number of timeouts when processing a message (AggregateReply node only) + - TotalNumberOfCommits : "TotalNumberOfCommits" #Number of transaction commits + - TotalNumberOfBackouts : "TotalNumberOfBackouts" #Number of transaction backouts - type: "Threads" identifiers: ["ThreadStatistics"] @@ -208,59 +150,44 @@ queueManagers: - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "Type" #Total elapsed time spent processing input messages (microseconds) - alias: "Type" - convert: - "WSInputNode": 1 - "WSReplyNode": 2 - "MSLMappingNode": 3 - "$default": 4 - + - Type: "Type" + convert: { + "WSInputNode" : "1", + "WSReplyNode" : "2", + "MSLMappingNode" : "3", + "$default" : "4" + } - type: "Nodes" identifiers: ["NodeStatistics|TerminalStatistics"] include: - - name : "CountOfInvocations" #Total number of messages that are processed by this node - alias: "CountOfInvocations" + - CountOfInvocations : "CountOfInvocations" #Total number of messages that are processed by this node derivedMetrics: flowStatistics: - type: "MessageFlow" identifiers: [""] include: - - name : "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - aggregationType: "OBSERVATION" - timeRollUpType: "CURRENT" - clusterRollUpType: "INDIVIDUAL" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime : "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + metricType: "OBSERVATION CURRENT INDIVIDUAL" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Threads" identifiers: ["ThreadStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" - - name: "AverageCPUTimeWaitingForInputMessage" - alias: "AverageCPUTimeWaitingForInputMessage" - - name: "AverageElapsedTimeWaitingForInputMessage" - alias: "AverageElapsedTimeWaitingForInputMessage" - - name: "AverageSizeOfInputMessages" - alias: "AverageSizeOfInputMessages" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" + - AverageCPUTimeWaitingForInputMessage: "AverageCPUTimeWaitingForInputMessage" + - AverageElapsedTimeWaitingForInputMessage: "AverageElapsedTimeWaitingForInputMessage" + - AverageSizeOfInputMessages: "AverageSizeOfInputMessages" - type: "Nodes" identifiers: ["NodeStatistics"] include: - - name: "AverageElapsedTime" - alias: "AverageElapsedTime" - - name: "AverageCPUTime" - alias: "AverageCPUTime" + - AverageElapsedTime: "AverageElapsedTime" + - AverageCPUTime: "AverageCPUTime" #Don't change this unless you are having more than 10 queue managers to monitor. @@ -271,4 +198,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file diff --git a/src/test/resources/conf/configWithSomeResourceStatsIncludesMissing.yml b/src/test/resources/conf/configWithSomeResourceStatsIncludesMissing.yml index a0048e4..b730823 100644 --- a/src/test/resources/conf/configWithSomeResourceStatsIncludesMissing.yml +++ b/src/test/resources/conf/configWithSomeResourceStatsIncludesMissing.yml @@ -58,37 +58,24 @@ queueManagers: - type: "JVM" identifiers: ["summary","Heap Memory","Non-Heap Memory","Garbage Collection - Copy","Garbage Collection - MarkSweepCompact"] include: - - name : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. - alias: "InitialMemoryInMB" - - name : "UsedMemoryInMB" #The amount of memory that is currently in use. - alias: "UsedMemoryInMB" - - name : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. - alias: "CommittedMemoryInMB" - - name : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. - alias: "MaxMemoryInMB" - - name : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - alias: "CumulativeNumberOfGCCollections" + - InitialMemoryInMB : "InitialMemoryInMB" #The initial amount of memory that the JVM requests from the operating system for memory management during startup. Its value might be undefined. + - UsedMemoryInMB : "UsedMemoryInMB" #The amount of memory that is currently in use. + - CommittedMemoryInMB : "CommittedMemoryInMB" #The amount of memory that is allocated to the JVM by the operating system. + - MaxMemoryInMB : "MaxMemoryInMB" #The maximum amount of memory that can be used for memory management. Its value might be undefined. + - CumulativeNumberOfGCCollections : "CumulativeNumberOfGCCollections" #The total number of garbage collections that have occurred for this instance of the JVM. Its value might be undefined. - type: "JDBCConnectionPools" identifiers: ["summary"] include: - - name : "MaxSizeOfPool" #The maximum size of the connection pool. - alias: "This is max pool" - - name : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. - alias: "ActualSizeOfPool" - - name : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. - alias: "CumulativeRequests" - - name : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. - alias: "CumulativeDelayedRequests" + - MaxSizeOfPool : "This is max pool" #The maximum size of the connection pool. + - ActualSizeOfPool : "ActualSizeOfPool" #A snapshot of the number of connections currently in the pool when the statistics were reported. + - CumulativeRequests : "CumulativeRequests" #A count of the number of requests received by the connection pool during this accounting period. + - CumulativeDelayedRequests : "CumulativeDelayedRequests" #The number of times a request for a connection could not be satisfied immediately, because the number of allocated connections reached the maximum pool size and no connections are currently available. delta: true - - name : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. - alias: "MaxDelayInMilliseconds" - - name : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. - alias: "CumulativeTimedOutRequests" - aggregationType: "OBSERVATION" - timeRollUpType: "CURRENT" - clusterRollUpType: "INDIVIDUAL" - multiplier: "0.5" + - MaxDelayInMilliseconds : "MaxDelayInMilliseconds" #The maximum time a caller waited for a connection to be allocated, in milliseconds. + - CumulativeTimedOutRequests : "CumulativeTimedOutRequests" #A count of the number of requests for connections that could not be satisfied within 15 seconds. + metricType: "OBSERVATION CURRENT INDIVIDUAL" + multiplier: 0.5 - type: "Sockets" identifiers: ["summary"] @@ -103,4 +90,4 @@ machineAgentWatchDog: #In seconds initialDelay: 0 #Check the existence of MA process in 'period' seconds. - period: 5 + period: 5 \ No newline at end of file